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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java

Issue 2837873002: Finch kill switch feature for background tab. (Closed)
Patch Set: rebase Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.customtabs; 5 package org.chromium.chrome.browser.customtabs;
6 6
7 import android.app.ActivityManager; 7 import android.app.ActivityManager;
8 import android.app.Application; 8 import android.app.Application;
9 import android.app.PendingIntent; 9 import android.app.PendingIntent;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 980
981 /* 981 /*
982 * This function will do as much as it can to have a subsequent navigation 982 * This function will do as much as it can to have a subsequent navigation
983 * to the specified url sped up. 983 * to the specified url sped up.
984 */ 984 */
985 private void startSpeculation(CustomTabsSessionToken session, String url, in t speculationMode, 985 private void startSpeculation(CustomTabsSessionToken session, String url, in t speculationMode,
986 Bundle extras, int uid) { 986 Bundle extras, int uid) {
987 WarmupManager warmupManager = WarmupManager.getInstance(); 987 WarmupManager warmupManager = WarmupManager.getInstance();
988 Profile profile = Profile.getLastUsedProfile(); 988 Profile profile = Profile.getLastUsedProfile();
989 boolean preconnect = true, createSpareWebContents = true; 989 boolean preconnect = true, createSpareWebContents = true;
990 if (speculationMode == SpeculationParams.HIDDEN_TAB
991 && !ChromeFeatureList.isEnabled(ChromeFeatureList.CCT_BACKGROUND _TAB)) {
992 speculationMode = SpeculationParams.PRERENDER;
993 }
990 switch (speculationMode) { 994 switch (speculationMode) {
991 case SpeculationParams.PREFETCH: 995 case SpeculationParams.PREFETCH:
992 boolean didPrefetch = new ResourcePrefetchPredictor(profile).sta rtPrefetching(url); 996 boolean didPrefetch = new ResourcePrefetchPredictor(profile).sta rtPrefetching(url);
993 if (didPrefetch) mSpeculation = SpeculationParams.forPrefetch(se ssion, url); 997 if (didPrefetch) mSpeculation = SpeculationParams.forPrefetch(se ssion, url);
994 preconnect = !didPrefetch; 998 preconnect = !didPrefetch;
995 break; 999 break;
996 case SpeculationParams.PRERENDER: 1000 case SpeculationParams.PRERENDER:
997 boolean didPrerender = prerenderUrl(session, url, extras, uid); 1001 boolean didPrerender = prerenderUrl(session, url, extras, uid);
998 createSpareWebContents = !didPrerender; 1002 createSpareWebContents = !didPrerender;
999 break; 1003 break;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 */ 1127 */
1124 String getReferrer(CustomTabsSessionToken session, Intent intent) { 1128 String getReferrer(CustomTabsSessionToken session, Intent intent) {
1125 String referrer = IntentHandler.getReferrerUrlIncludingExtraHeaders(inte nt); 1129 String referrer = IntentHandler.getReferrerUrlIncludingExtraHeaders(inte nt);
1126 if (referrer == null && getReferrerForSession(session) != null) { 1130 if (referrer == null && getReferrerForSession(session) != null) {
1127 referrer = getReferrerForSession(session).getUrl(); 1131 referrer = getReferrerForSession(session).getUrl();
1128 } 1132 }
1129 if (referrer == null) referrer = ""; 1133 if (referrer == null) referrer = "";
1130 return referrer; 1134 return referrer;
1131 } 1135 }
1132 } 1136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698