| Index: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
|
| index e331b7ea9338a9fe9673d1c29b02bfd4cb502bab..22a3e5bd8e4ec00b3d5a6df0d612b8243b2d0f2c 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
|
| @@ -231,7 +231,7 @@ public class CustomTabActivity extends ChromeActivity {
|
|
|
| @Override
|
| public void finishNativeInitialization() {
|
| - CustomTabsConnection connection = CustomTabsConnection.getInstance(getApplication());
|
| + final CustomTabsConnection connection = CustomTabsConnection.getInstance(getApplication());
|
| // If extra headers have been passed, cancel any current prerender, as
|
| // prerendering doesn't support extra headers.
|
| if (IntentHandler.getExtraHeadersFromIntent(getIntent()) != null) {
|
| @@ -274,6 +274,9 @@ public class CustomTabActivity extends ChromeActivity {
|
| mCustomTabContentHandler = new CustomTabContentHandler() {
|
| @Override
|
| public void loadUrlAndTrackFromTimestamp(LoadUrlParams params, long timestamp) {
|
| + if (params.getUrl() != null) {
|
| + params.setUrl(connection.overrideUrlIfNecessary(params.getUrl(), mSession));
|
| + }
|
| loadUrlInTab(getActivityTab(), params, timestamp);
|
| }
|
|
|
| @@ -317,34 +320,35 @@ public class CustomTabActivity extends ChromeActivity {
|
| return true;
|
| }
|
| };
|
| - DataUseTabUIManager.onCustomTabInitialNavigation(mMainTab,
|
| - connection.getClientPackageNameForSession(mSession),
|
| - IntentHandler.getUrlFromIntent(getIntent()));
|
| + String url = IntentHandler.getUrlFromIntent(getIntent());
|
| + if (url != null) url = connection.overrideUrlIfNecessary(url, mSession);
|
| + DataUseTabUIManager.onCustomTabInitialNavigation(
|
| + mMainTab, connection.getClientPackageNameForSession(mSession), url);
|
| recordClientPackageName();
|
| connection.showSignInToastIfNecessary(mSession, getIntent());
|
| if (mHasCreatedTabEarly) {
|
| if (!mMainTab.isLoading()) postDeferredStartupIfNeeded();
|
| } else {
|
| - loadUrlInTab(mMainTab, new LoadUrlParams(IntentHandler.getUrlFromIntent(getIntent())),
|
| + loadUrlInTab(mMainTab, new LoadUrlParams(url),
|
| IntentHandler.getTimestampFromIntent(getIntent()));
|
| }
|
| super.finishNativeInitialization();
|
| }
|
|
|
| private Tab createMainTab() {
|
| + CustomTabsConnection customTabsConnection =
|
| + CustomTabsConnection.getInstance(getApplication());
|
| String url = IntentHandler.getUrlFromIntent(getIntent());
|
| + if (url != null) url = customTabsConnection.overrideUrlIfNecessary(url, mSession);
|
| // Get any referrer that has been explicitly set by the app.
|
| String referrerUrl = IntentHandler.getReferrerUrlIncludingExtraHeaders(getIntent(), this);
|
| if (referrerUrl == null) {
|
| - Referrer referrer = CustomTabsConnection.getInstance(getApplication())
|
| - .getReferrerForSession(mSession);
|
| + Referrer referrer = customTabsConnection.getReferrerForSession(mSession);
|
| if (referrer != null) referrerUrl = referrer.getUrl();
|
| }
|
| Tab tab = new Tab(TabIdManager.getInstance().generateValidId(Tab.INVALID_TAB_ID),
|
| Tab.INVALID_TAB_ID, false, this, getWindowAndroid(),
|
| TabLaunchType.FROM_EXTERNAL_APP, null, null);
|
| - CustomTabsConnection customTabsConnection =
|
| - CustomTabsConnection.getInstance(getApplication());
|
| tab.setAppAssociatedWith(customTabsConnection.getClientPackageNameForSession(mSession));
|
| WebContents webContents =
|
| customTabsConnection.takePrerenderedUrl(mSession, url, referrerUrl);
|
|
|