Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(620)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java

Issue 1688603004: AGSA-initiated weblite intents should be rewritten if Chrome can use weblite (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bug fix Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698