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

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

Issue 1348473002: Fix size estimation for prerender in custom tabs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comments to size estimate Created 5 years, 3 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/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 b40f9a4e465faae371ed8aad320d362e60182729..baa2c952862de2346bc6218ffe9f469ce17fb1c8 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
@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.customtabs;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
+import android.graphics.Point;
import android.graphics.Rect;
import android.os.IBinder;
import android.os.SystemClock;
@@ -154,6 +155,7 @@ public class CustomTab extends ChromeTab {
private CustomTabObserver mTabObserver;
private final boolean mEnableUrlBarHiding;
private boolean mShouldReplaceCurrentEntry;
+ private Point mPrerenderedSize = new Point();
/**
* Construct an CustomTab. Note that url and referrer given here is only used to retrieve a
@@ -167,11 +169,13 @@ public class CustomTab extends ChromeTab {
mEnableUrlBarHiding = enableUrlBarHiding;
CustomTabsConnection customTabsConnection =
CustomTabsConnection.getInstance(activity.getApplication());
- WebContents webContents = customTabsConnection.takePrerenderedUrl(session, url, referrer);
+ WebContents webContents = customTabsConnection.takePrerenderedUrl(
+ session, url, referrer, mPrerenderedSize);
if (webContents == null) {
webContents = customTabsConnection.takeSpareWebContents();
// TODO(lizeb): Remove this once crbug.com/521729 is fixed.
if (webContents != null) mShouldReplaceCurrentEntry = true;
+ mPrerenderedSize = null;
}
if (webContents == null) {
webContents = WebContentsFactory.createWebContents(isIncognito(), false);
@@ -182,6 +186,14 @@ public class CustomTab extends ChromeTab {
addObserver(mTabObserver);
}
+ @Override
+ protected void initContentViewCore(WebContents webContents) {
+ super.initContentViewCore(webContents);
+ if (mPrerenderedSize != null) {
+ getContentViewCore().onSizeChanged(mPrerenderedSize.x, mPrerenderedSize.y, 0, 0);
+ }
+ }
+
/**
* Loads a URL and tracks its load time, from the timestamp of the intent arrival.
*

Powered by Google App Engine
This is Rietveld 408576698