| Index: chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java
|
| index b96062e9f402c018c11fa641e0064fffa088dd65..e604aa4c4800b27618961d787503cce55026621b 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java
|
| @@ -5,6 +5,7 @@
|
| package org.chromium.chrome.browser.prerender;
|
|
|
| import org.chromium.base.JNINamespace;
|
| +import org.chromium.base.VisibleForTesting;
|
| import org.chromium.chrome.browser.ContentViewUtil;
|
| import org.chromium.chrome.browser.profiles.Profile;
|
|
|
| @@ -20,6 +21,15 @@ public class ExternalPrerenderHandler {
|
| mNativeExternalPrerenderHandler = nativeInit();
|
| }
|
|
|
| + /**
|
| + * Add a prerender for the given url and given content view dimensions.
|
| + * @param profile The profile to use for the prerender.
|
| + * @param url The url to prerender.
|
| + * @param referrer The referrer for the prerender request.
|
| + * @param width The width for the content view (render widget host view) for the prerender.
|
| + * @param height The height for the content view (render widget host view) for the prerender.
|
| + * @return The native web contents pointer that is linked to this prerender. 0 if unsuccessful.
|
| + */
|
| public long addPrerender(Profile profile, String url, String referrer, int width, int height) {
|
| long webContentsPtr = ContentViewUtil.createNativeWebContents(false);
|
| if (nativeAddPrerender(mNativeExternalPrerenderHandler, profile, webContentsPtr,
|
| @@ -30,15 +40,33 @@ public class ExternalPrerenderHandler {
|
| return 0;
|
| }
|
|
|
| + /**
|
| + * Cancel the current prerender action on this {@link ExternalPrerenderHandler}.
|
| + */
|
| public void cancelCurrentPrerender() {
|
| nativeCancelCurrentPrerender(mNativeExternalPrerenderHandler);
|
| }
|
|
|
| + /**
|
| + * Check whether a given url has been prerendering for the given profile and session id for the
|
| + * given web contents.
|
| + * @param profile The profile to check for prerendering.
|
| + * @param url The url to check for prerender.
|
| + * @param webContentsPtr The native pointer for which to compare the session info.
|
| + * @return Whether the given url was prerendered.
|
| + */
|
| public static boolean hasPrerenderedUrl(Profile profile, String url, long webContentsPtr) {
|
| return nativeHasPrerenderedUrl(profile, url, webContentsPtr);
|
| }
|
|
|
| - public static boolean hasCookieStoreLoaded(Profile profile) {
|
| + /**
|
| + * Check whether the cookie store has been loaded. This is needed for prerender manager to allow
|
| + * to add prerenders and this call is to be used to wait until that happens in tests.
|
| + * @param profile The profile to be used.
|
| + * @return Whether the cookie store has been loaded.
|
| + */
|
| + @VisibleForTesting
|
| + public static boolean checkCookieStoreLoadedForTesting(Profile profile) {
|
| return nativeHasCookieStoreLoaded(profile);
|
| }
|
|
|
|
|