| Index: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
|
| index 01e9ff142c75b0063ed8f3d0f104853e01c11cd4..1c03b3acfaee2196c6a276ccc9a23f62bc53177d 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
|
| @@ -508,6 +508,11 @@ public class CustomTabsConnection {
|
| return mClientManager.getIgnoreFragmentsForSession(session);
|
| }
|
|
|
| + @VisibleForTesting
|
| + void setShouldPrerenderOnCellularForSession(CustomTabsSessionToken session, boolean value) {
|
| + mClientManager.setPrerenderCellularForSession(session, value);
|
| + }
|
| +
|
| /**
|
| * Extracts the creator package name from the intent.
|
| * @param intent The intent to get the package name from.
|
| @@ -699,7 +704,8 @@ public class CustomTabsConnection {
|
| // Last one wins and cancels the previous prerender.
|
| cancelPrerender(null);
|
| if (TextUtils.isEmpty(url)) return false;
|
| - if (!mClientManager.isPrerenderingAllowed(uid)) return false;
|
| + boolean throttle = !shouldPrerenderOnCellularForSession(session);
|
| + if (throttle && !mClientManager.isPrerenderingAllowed(uid)) return false;
|
|
|
| // A prerender will be requested. Time to destroy the spare WebContents.
|
| destroySpareWebContents();
|
| @@ -721,7 +727,7 @@ public class CustomTabsConnection {
|
| Profile.getLastUsedProfile(), url, referrer, contentSize.x, contentSize.y,
|
| shouldPrerenderOnCellularForSession(session));
|
| if (webContents == null) return false;
|
| - mClientManager.registerPrerenderRequest(uid, url);
|
| + if (throttle) mClientManager.registerPrerenderRequest(uid, url);
|
| mPrerender = new PrerenderedUrlParams(session, webContents, url, referrer, extras);
|
| return true;
|
| }
|
| @@ -759,4 +765,9 @@ public class CustomTabsConnection {
|
| void resetThrottling(Context context, int uid) {
|
| mClientManager.resetThrottling(uid);
|
| }
|
| +
|
| + @VisibleForTesting
|
| + void ban(Context context, int uid) {
|
| + mClientManager.ban(uid);
|
| + }
|
| }
|
|
|