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

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

Issue 1232123009: customtabs: Pre-create a renderer in mayLaunchUrl(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 4 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTab.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTab.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTab.java
index 53312f14b1332038f4fc0bcbc76dc6f4cfca5aea..e970e1c788b734c2af7c19d3ea567d0e02b2bc64 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTab.java
@@ -152,6 +152,7 @@ public class CustomTab extends ChromeTab {
private CustomTabObserver mTabObserver;
private final boolean mEnableUrlBarHiding;
+ private boolean mShouldReplaceCurrentEntry;
/**
* Construct an CustomTab. Note that url and referrer given here is only used to retrieve a
@@ -167,6 +168,11 @@ public class CustomTab extends ChromeTab {
CustomTabsConnection.getInstance(activity.getApplication());
WebContents webContents = customTabsConnection.takePrerenderedUrl(session, url, referrer);
if (webContents == null) {
+ webContents = customTabsConnection.takeSpareWebContents();
+ // TODO(lizeb): Remove this once crbug.com/521729 is fixed.
+ if (webContents != null) mShouldReplaceCurrentEntry = true;
+ }
+ if (webContents == null) {
webContents = WebContentsFactory.createWebContents(isIncognito(), false);
}
initialize(webContents, activity.getTabContentManager(), false);
@@ -184,6 +190,8 @@ public class CustomTab extends ChromeTab {
*/
void loadUrlAndTrackFromTimestamp(LoadUrlParams params, long timestamp) {
mTabObserver.trackNextPageLoadFromTimestamp(timestamp);
+ if (mShouldReplaceCurrentEntry) params.setShouldReplaceCurrentEntry(true);
+ mShouldReplaceCurrentEntry = false;
loadUrl(params);
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698