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

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

Issue 2043833003: customtabs: Initialize the spare renderer using the new WebContents method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Proguard fix for a test. Created 4 years, 6 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 8c89984ececd97088056a9e5b540e06501a4c690..94133d8744a415ed2154b4b1350ce41a3f770bbc 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
@@ -61,7 +61,6 @@ import org.chromium.chrome.browser.widget.findinpage.FindToolbarManager;
import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.browser.WebContents;
-import org.chromium.content_public.browser.WebContentsObserver;
import org.chromium.content_public.common.Referrer;
import org.chromium.ui.base.PageTransition;
@@ -91,7 +90,6 @@ public class CustomTabActivity extends ChromeActivity {
private boolean mShouldOverridePackage;
private boolean mRecordedStartupUma;
- private boolean mShouldReplaceCurrentEntry;
private boolean mHasCreatedTabEarly;
private CustomTabObserver mTabObserver;
@@ -375,14 +373,8 @@ public class CustomTabActivity extends ChromeActivity {
WebContents webContents =
customTabsConnection.takePrerenderedUrl(mSession, url, referrerUrl);
mHasPrerendered = webContents != null;
- 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(false, false);
- }
+ if (webContents == null) webContents = customTabsConnection.takeSpareWebContents();
+ if (webContents == null) webContents = WebContentsFactory.createWebContents(false, false);
tab.initialize(webContents, getTabContentManager(),
new CustomTabDelegateFactory(mIntentDataProvider.shouldEnableUrlBarHiding()), false,
false);
@@ -466,25 +458,7 @@ public class CustomTabActivity extends ChromeActivity {
params.setTransitionType(IntentHandler.getTransitionTypeFromIntent(this, intent,
PageTransition.LINK | PageTransition.FROM_API));
mTabObserver.trackNextPageLoadFromTimestamp(timeStamp);
- if (mShouldReplaceCurrentEntry) params.setShouldReplaceCurrentEntry(true);
- if (mShouldReplaceCurrentEntry
- && tab.getWebContents().getNavigationController().getEntryAtIndex(0)
- == null) {
- // If the spare web contents has gotten a loadurl but has not committed yet, wait
- // until commit to start the actual load.
- tab.getWebContents().addObserver(new WebContentsObserver() {
- @Override
- public void didCommitProvisionalLoadForFrame(long frameId, boolean isMainFrame,
- String url, int transitionType) {
- if (!isMainFrame) return;
- tab.loadUrl(params);
- tab.getWebContents().removeObserver(this);
- }
- });
- } else {
- tab.loadUrl(params);
- }
- mShouldReplaceCurrentEntry = false;
+ tab.loadUrl(params);
}
@Override

Powered by Google App Engine
This is Rietveld 408576698