OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |