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

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: yusufo comments 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 745e0504029ed914080bd7cf0760952014036c94..be589a453bcdf3c761f155e087807f142ec10036 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
@@ -208,11 +208,13 @@ public class CustomTabActivity extends ChromeActivity {
@Override
public void finishNativeInitialization() {
+ CustomTabsConnection customTabsConnection =
Yusuf 2016/02/24 00:42:10 if you rebase, you will see that this is already t
megjablon 2016/02/24 02:42:57 Ah now I see what you're saying. Done.
+ CustomTabsConnection.getInstance(getApplication());
mSession = mIntentDataProvider.getSession();
// If extra headers have been passed, cancel any current prerender, as
// prerendering doesn't support extra headers.
if (IntentHandler.getExtraHeadersFromIntent(getIntent()) != null) {
- CustomTabsConnection.getInstance(getApplication()).cancelPrerender(mSession);
+ customTabsConnection.cancelPrerender(mSession);
}
Tab mainTab = createMainTab();
getTabModelSelector().getModel(false).addObserver(mTabModelObserver);
@@ -244,6 +246,10 @@ public class CustomTabActivity extends ChromeActivity {
mCustomTabContentHandler = new CustomTabContentHandler() {
@Override
public void loadUrlAndTrackFromTimestamp(LoadUrlParams params, long timestamp) {
+ if (params.getUrl() != null) {
+ params.setUrl(CustomTabsConnection.getInstance(getApplication())
Yusuf 2016/02/24 00:42:10 use the local instance?
megjablon 2016/02/24 02:42:58 Done.
+ .overrideUrlIfNecessary(params.getUrl(), mSession));
+ }
loadUrlInCurrentTab(params, timestamp);
}
@@ -274,32 +280,31 @@ public class CustomTabActivity extends ChromeActivity {
return true;
}
};
+ String url = IntentHandler.getUrlFromIntent(getIntent());
+ if (url != null) url = customTabsConnection.overrideUrlIfNecessary(url, mSession);
DataUseTabUIManager.onCustomTabInitialNavigation(mainTab,
- CustomTabsConnection.getInstance(getApplication())
- .getClientPackageNameForSession(mSession),
- IntentHandler.getUrlFromIntent(getIntent()));
- mainTab.setAppAssociatedWith(CustomTabsConnection.getInstance(getApplication())
- .getClientPackageNameForSession(mSession));
+ customTabsConnection.getClientPackageNameForSession(mSession), url);
+ mainTab.setAppAssociatedWith(customTabsConnection.getClientPackageNameForSession(mSession));
Yusuf 2016/02/24 00:42:10 rebasing will remove some of these, fyi
megjablon 2016/02/24 02:42:58 Done.
recordClientPackageName();
- loadUrlInCurrentTab(new LoadUrlParams(IntentHandler.getUrlFromIntent(getIntent())),
+ loadUrlInCurrentTab(new LoadUrlParams(url),
IntentHandler.getTimestampFromIntent(getIntent()));
super.finishNativeInitialization();
}
private Tab createMainTab() {
+ CustomTabsConnection customTabsConnection =
Yusuf 2016/02/24 00:42:10 rebasing will remove some of these.
megjablon 2016/02/24 02:42:57 Done.
+ 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());
WebContents webContents =
customTabsConnection.takePrerenderedUrl(mSession, url, referrerUrl);
if (webContents == null) {

Powered by Google App Engine
This is Rietveld 408576698