Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Commit

Permalink
Update to 63.0.3239.40
Browse files Browse the repository at this point in the history
  • Loading branch information
kuoruan committed Nov 13, 2017
1 parent 39aee8d commit a109795
Show file tree
Hide file tree
Showing 27 changed files with 297 additions and 48 deletions.
1 change: 0 additions & 1 deletion Chromium/args.gn
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ enable_nacl = false
remove_webcore_debug_symbols = true
proprietary_codecs = true
ffmpeg_branding = "Chrome"
exclude_unwind_tables = true
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ idea {
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support:design:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support:gridlayout-v7:$rootProject.ext.supportLibraryVersion"
Expand Down
Binary file modified app/libs/gcm.jar
Binary file not shown.
18 changes: 15 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,9 @@ by a child template that "extends" this file.
<category android:name="com.google.intent.category.CARDBOARD" />
</intent-filter>
</activity>
<!-- TODO(crbug.com/780674): retarget .Main back to CTA for non-modern APK -->
<activity-alias android:name="com.google.android.apps.chrome.Main"
android:targetActivity="org.chromium.chrome.browser.ChromeTabbedActivity"
android:targetActivity="org.chromium.chrome.browser.document.ChromeLauncherActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down Expand Up @@ -669,19 +670,30 @@ by a child template that "extends" this file.
</activity>
<activity android:name="org.chromium.chrome.browser.firstrun.LightweightFirstRunActivity"
android:theme="@style/SimpleDialog"
android:launchMode="singleInstance"
android:launchMode="singleInstance"
android:excludeFromRecents="true"
android:autoRemoveFromRecents="true"
android:windowSoftInputMode="stateHidden|adjustPan"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize">
>
</activity>
<activity android:name="org.chromium.chrome.browser.firstrun.FirstRunActivity"
android:theme="@style/DialogWhenLarge"
android:theme="@style/FirstRunTheme"
android:launchMode="singleInstance"
android:excludeFromRecents="true"
android:autoRemoveFromRecents="true"
android:windowSoftInputMode="stateHidden|adjustPan"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize">
</activity>
<activity android:name="org.chromium.chrome.browser.firstrun.TabbedModeFirstRunActivity"
android:theme="@style/TabbedModeFirstRunTheme"
android:launchMode="singleInstance"
android:excludeFromRecents="true"
android:autoRemoveFromRecents="true"
android:windowSoftInputMode="stateHidden|adjustPan"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize">
>
</activity>
<activity android:name="org.chromium.chrome.browser.vr_shell.VrFirstRunActivity"
android:exported="false"
android:launchMode="singleInstance"
Expand Down
Binary file modified app/src/main/assets/resources.pak
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ public class NativeLibraries {
public static final String[] LIBRARIES =
{"chrome"};
static String sVersionNumber =
"63.0.3239.30";
"63.0.3239.40";
}
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public AppMenuHandler get(Activity activity, AppMenuPropertiesDelegate delegate,
private boolean mDeferredStartupPosted;

private boolean mTabModelsInitialized;
private boolean mNativeInitialized;
protected boolean mNativeInitialized;
private boolean mRemoveWindowBackgroundDone;

// The class cannot implement TouchExplorationStateChangeListener,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2265,7 +2265,7 @@ protected void setStatusBarColor(Tab tab, int color) {
@Override
public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
super.onMultiWindowModeChanged(isInMultiWindowMode);
if (!FeatureUtilities.isTabModelMergingEnabled()) return;
if (!FeatureUtilities.isTabModelMergingEnabled() || !mNativeInitialized) return;
if (!isInMultiWindowMode) {
// If the activity is currently resumed when multi-window mode is exited, try to merge
// tabs from the other activity instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class ChromeVersionConstants {
static final String PRODUCT_NAME = "Chromium";
static final String PRODUCT_VERSION = "63.0.3239.30";
static final String PRODUCT_VERSION = "63.0.3239.40";
static final boolean IS_OFFICIAL_BUILD = 1 == 1;

static final int PRODUCT_MAJOR_VERSION = 63;
Expand Down
12 changes: 2 additions & 10 deletions app/src/main/java/org/chromium/chrome/browser/IntentHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.blink_public.web.WebReferrerPolicy;
import org.chromium.chrome.browser.browserservices.BrowserSessionContentUtils;
import org.chromium.chrome.browser.document.ChromeLauncherActivity;
import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
import org.chromium.chrome.browser.externalnav.ExternalNavigationDelegateImpl;
import org.chromium.chrome.browser.externalnav.IntentWithGesturesHandler;
Expand Down Expand Up @@ -236,15 +237,6 @@ private static ComponentName getFakeComponentName(String packageName) {
public static final String GOOGLECHROME_NAVIGATE_PREFIX =
GOOGLECHROME_SCHEME + "://navigate?url=";

/**
* The class name to be specified in the ComponentName for Intents that are creating a new
* tab (regardless of whether the user is in document or tabbed mode).
*/
// TODO(tedchoc): Remove this and directly reference the Launcher activity when that becomes
// publicly available.
private static final String TAB_ACTIVITY_COMPONENT_CLASS_NAME =
"com.google.android.apps.chrome.Main";

private static boolean sTestIntentsEnabled;

private final IntentHandlerDelegate mDelegate;
Expand Down Expand Up @@ -610,7 +602,7 @@ public static void startActivityForTrustedIntent(Intent intent) {
public static void startChromeLauncherActivityForTrustedIntent(Intent intent) {
// Specify the exact component that will handle creating a new tab. This allows specifying
// URLs that are not exposed in the intent filters (i.e. chrome://).
startActivityForTrustedIntentInternal(intent, TAB_ACTIVITY_COMPONENT_CLASS_NAME);
startActivityForTrustedIntentInternal(intent, ChromeLauncherActivity.class.getName());
}

private static void startActivityForTrustedIntentInternal(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.StringRes;
import android.text.TextUtils;
import android.view.View;

import org.chromium.base.ActivityState;
import org.chromium.base.ApplicationStatus;
Expand Down Expand Up @@ -179,16 +181,26 @@ protected Bundle transformSavedInstanceStateForOnCreate(Bundle savedInstanceStat
return null;
}

/**
* Creates the content view for this activity.
* The only thing subclasses can do is wrapping the view returned by super implementation
* in some extra layout.
*/
@CallSuper
protected View createContentView() {
mPager = new FirstRunViewPager(this);
mPager.setId(R.id.fre_pager);
mPager.setOffscreenPageLimit(3);
return mPager;
}

@Override
public void setContentView() {
initializeStateFromLaunchData();

setFinishOnTouchOutside(true);

mPager = new FirstRunViewPager(this);
mPager.setId(R.id.fre_pager);
mPager.setOffscreenPageLimit(3);
setContentView(mPager);
setContentView(createContentView());

mFirstRunFlowSequencer = new FirstRunFlowSequencer(this) {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
Expand All @@ -18,6 +19,7 @@
import org.chromium.base.CommandLine;
import org.chromium.base.Log;
import org.chromium.base.VisibleForTesting;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.locale.LocaleManager;
import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
Expand Down Expand Up @@ -366,6 +368,14 @@ public static boolean launch(Context caller, Intent intent, boolean requiresBroa
freCallerIntent = new Intent(intent);
VrIntentUtils.updateFreCallerIntent(caller, intent);
}

if (maybeSwitchToTabbedMode(caller, freIntent)) {
// We switched to TabbedModeFRE. We need to disable animation on the original
// intent, to make transition seamless.
intent = new Intent(intent);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
}

// Add a PendingIntent so that the intent used to launch Chrome will be resent when
// First Run is completed or canceled.
addPendingIntent(caller, freIntent, intent, requiresBroadcast);
Expand All @@ -384,4 +394,39 @@ public static boolean launch(Context caller, Intent intent, boolean requiresBroa
}
return true;
}

/**
* On tablets, where FRE activity is a dialog, transitions from fillscreen activities
* (the ones that use TabbedModeTheme, e.g. ChromeTabbedActivity) look ugly, because
* when FRE is started from CTA.onCreate(), currently running animation for CTA window
* is aborted. This is perceived as a flash of white and doesn't look good.
*
* To solve this, we added TabbedMode FRE activity, which has the same window background
* as TabbedModeTheme activities, but shows content in a FRE-like dialog.
*
* This function attempts to switch FRE to TabbedModeFRE if certain conditions are met.
*/
private static boolean maybeSwitchToTabbedMode(Context caller, Intent freIntent) {
// Caller must be an activity.
if (!(caller instanceof Activity)) return false;

// We must be on a tablet (where FRE is a dialog).
boolean isTablet = caller.getResources().getBoolean(R.bool.is_tablet);
if (!isTablet) return false;

// Caller must use a theme with @drawable/window_background (the same background
// used by TabbedModeFRE).
TypedArray a = caller.obtainStyledAttributes(new int[] {android.R.attr.windowBackground});
int backgroundResourceId = a.getResourceId(0 /* index */, 0);
a.recycle();
if (backgroundResourceId != R.drawable.window_background) return false;

// Switch FRE -> TabbedModeFRE.
if (FirstRunActivity.class.getName().equals(freIntent.getComponent().getClassName())) {
freIntent.setClass(caller, TabbedModeFirstRunActivity.class);
return true;
}

return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.firstrun;

import android.content.Context;
import android.content.res.Resources;
import android.support.annotation.AnyRes;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import org.chromium.chrome.R;

/**
* FirstRunActivity variant that fills the whole screen, but displays the content
* in a dialog-like layout.
*/
public class TabbedModeFirstRunActivity extends FirstRunActivity {
@Override
protected View createContentView() {
return wrapInDialogLayout(super.createContentView());
}

/**
* Wraps contentView into layout that resembles DialogWhenLarge. The layout centers
* the content and dims the background to simulate a modal dialog.
*/
private View wrapInDialogLayout(View contentView) {
ContentLayout contentLayout = new ContentLayout(this);
contentLayout.addView(contentView);

contentLayout.setBackgroundResource(R.drawable.bg_white_dialog);

// We need an outer layout for two things:
// * centering the content
// * dimming the background
FrameLayout outerLayout = new FrameLayout(this);
outerLayout.addView(contentLayout,
new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER));
outerLayout.setBackgroundResource(R.color.modal_dialog_scrim_color);
return outerLayout;
}

/**
* Layout that sizes itself according to DialogWhenLarge constraints.
*/
private static class ContentLayout extends FrameLayout {
private TypedValue mFixedWidthMajor = new TypedValue();
private TypedValue mFixedWidthMinor = new TypedValue();
private TypedValue mFixedHeightMajor = new TypedValue();
private TypedValue mFixedHeightMinor = new TypedValue();

public ContentLayout(Context context) {
super(context);
fetchConstraints();
}

/**
* Wrapper around Resources.getValue() that translates Resources.NotFoundException
* into false return value. Otherwise the function returns true.
*/
private boolean safeGetResourceValue(@AnyRes int id, TypedValue value) {
try {
getContext().getResources().getValue(id, value, true);
return true;
} catch (Resources.NotFoundException e) {
return false;
}
}

private void fetchConstraints() {
// Fetch size constraints. These are copies of corresponding abc_* AppCompat values,
// because abc_* values are private, and even though corresponding theme attributes
// are public in AppCompat (e.g. windowFixedWidthMinor), there is no guarantee that
// AppCompat.DialogWhenLarge is actually defined by AppCompat and not based on
// system DialogWhenLarge theme.
// Note that we don't care about the return values, because onMeasure() handles null
// constraints (and they will be null when the device is not considered "large").
safeGetResourceValue(R.dimen.dialog_fixed_width_minor, mFixedWidthMinor);
safeGetResourceValue(R.dimen.dialog_fixed_width_major, mFixedWidthMajor);
safeGetResourceValue(R.dimen.dialog_fixed_height_minor, mFixedHeightMinor);
safeGetResourceValue(R.dimen.dialog_fixed_height_major, mFixedHeightMajor);
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
final boolean isPortrait = metrics.widthPixels < metrics.heightPixels;

// Constraint handling is adapted from
// sdk/sources/android-25/android/support/v7/widget/ContentFrameLayout.java.
final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
assert widthMode == MeasureSpec.AT_MOST;
{
final TypedValue tvw = isPortrait ? mFixedWidthMinor : mFixedWidthMajor;
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
if (tvw.type != TypedValue.TYPE_NULL) {
assert tvw.type == TypedValue.TYPE_FRACTION;
int width = (int) tvw.getFraction(metrics.widthPixels, metrics.widthPixels);
widthSize = Math.min(width, widthSize);
}
// This either sets the width calculated from the constraints, or simply
// takes all of the available space (as if MATCH_PARENT was specified).
// The behavior is similar to how DialogWhenLarge windows are sized - they
// are either sized by the constraints, or are full screen, but are never
// sized based on the content size.
widthMeasureSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY);
}

// This is similar to the above block that calculates width.
final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
assert heightMode == MeasureSpec.AT_MOST;
{
final TypedValue tvh = isPortrait ? mFixedHeightMajor : mFixedHeightMinor;
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
if (tvh.type != TypedValue.TYPE_NULL) {
assert tvh.type == TypedValue.TYPE_FRACTION;
int height = (int) tvh.getFraction(metrics.heightPixels, metrics.heightPixels);
heightSize = Math.min(height, heightSize);
}
heightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, MeasureSpec.EXACTLY);
}

super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
}
Loading

0 comments on commit a109795

Please sign in to comment.