15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string> 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Profile; 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace base { 13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class CommandLine; 14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace prerender { 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Parse the --prerender= command line switch, which controls prerendering. If 195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// the switch is unset or is set to "auto" then the user is assigned to a 205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// field trial. 21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)void ConfigurePrerender(const base::CommandLine& command_line); 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Returns true if the user has opted in or has been opted in to the 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// prerendering from Omnibox experiment. 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool IsOmniboxEnabled(Profile* profile); 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 27f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Returns true if session storage namespace merging is not disabled. 28f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)bool ShouldMergeSessionStorageNamespaces(); 29f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Returns true iff the Prerender Local Predictor is enabled. 318bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)bool IsLocalPredictorEnabled(); 328bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 338bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Indicates whether to disable the local predictor due to unencrypted sync 348bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// settings and configuration. 351320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccibool ShouldDisableLocalPredictorBasedOnSyncAndConfiguration(Profile* profile); 361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// Returns whether or not the local predictor is temporarily disabled, due 381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// to network predictive action settings and current network. 391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccibool ShouldDisableLocalPredictorDueToPreferencesAndNetwork(Profile* profile); 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 41c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// Returns true iff the LoggedIn Predictor is enabled. 42c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)bool IsLoggedInPredictorEnabled(); 43c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 44c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// Returns true iff the side-effect free whitelist is enabled. 45c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)bool IsSideEffectFreeWhitelistEnabled(); 46c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 477d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Returns true if the local predictor should actually launch prerenders. 487d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)bool IsLocalPredictorPrerenderLaunchEnabled(); 497d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 507d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Returns true if the local predictor should prerender, but only as control 517d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// group. If the local predictor never launches prerenders, then this setting 527d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// is irrelevant. 537d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)bool IsLocalPredictorPrerenderAlwaysControlEnabled(); 547d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 556d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)// Returns true if the local predictor should prefetch rather than prerender. 566d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)bool IsLocalPredictorPrerenderPrefetchEnabled(); 576d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 5858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// Returns true if we should query the prerender service for the profile 5958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// provided. 6058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)bool ShouldQueryPrerenderService(Profile* profile); 6158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 6258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// Indicates whether we should query the prerender service for the current URL 6358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// and candidate URLs, respectively. 6458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)bool ShouldQueryPrerenderServiceForCurrentURL(); 6558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)bool ShouldQueryPrerenderServiceForCandidateURLs(); 6658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 6758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// Returns the URL prefix to be used for the prerender service. The only thing 6858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// that will be appended is the urlencoded query json. 6958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)std::string GetPrerenderServiceURLPrefix(); 7058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 7158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// Returns the prerender service behavior ID that should be passed to the 7258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// to the prerender service in requests. 7358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)int GetPrerenderServiceBehaviorID(); 7458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 7558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// Returns the fetch timeout to be used for the prerender service, in ms. 7658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)int GetPrerenderServiceFetchTimeoutMs(); 7758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 785f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Returns the timeout for entries in the prefetch list, in seconds. 795f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)int GetPrerenderPrefetchListTimeoutSeconds(); 805f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 817d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Returns the TTL to be used for the local predictor. 827d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)int GetLocalPredictorTTLSeconds(); 837d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 847d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Returns the half-life time to use to decay local predictor prerender 857d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// priorities. 867d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)int GetLocalPredictorPrerenderPriorityHalfLifeTimeSeconds(); 877d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 887d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Returns the maximum number of concurrent prerenders the local predictor 897d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// may maintain. 907d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)int GetLocalPredictorMaxConcurrentPrerenders(); 917d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 926d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)// Returns the maximum number of concurrent prerenders the local predictor 936d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)// may launch concurrently. 946d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)int GetLocalPredictorMaxLaunchPrerenders(); 956d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles) 962385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch// The following functions return whether certain LocalPredictor checks should 972385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch// be skipped, as indicated by the name. 982385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdochbool SkipLocalPredictorFragment(); 992385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdochbool SkipLocalPredictorHTTPS(); 1002385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdochbool SkipLocalPredictorWhitelist(); 10158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)bool SkipLocalPredictorServiceWhitelist(); 1022385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdochbool SkipLocalPredictorLoggedIn(); 1032385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdochbool SkipLocalPredictorDefaultNoPrerender(); 10458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)bool SkipLocalPredictorLocalCandidates(); 10558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)bool SkipLocalPredictorServiceCandidates(); 1062385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch 107cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Indicates whether no prerender cookie stores should be used for prerendering. 108cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)bool IsPrerenderCookieStoreEnabled(); 109cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace prerender 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ 113