1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ 7 8 #include <string> 9 10 class Profile; 11 12 namespace base { 13 class CommandLine; 14 } 15 16 namespace prerender { 17 18 // Parse the --prerender= command line switch, which controls prerendering. If 19 // the switch is unset or is set to "auto" then the user is assigned to a 20 // field trial. 21 void ConfigurePrerender(const base::CommandLine& command_line); 22 23 // Returns true if the user has opted in or has been opted in to the 24 // prerendering from Omnibox experiment. 25 bool IsOmniboxEnabled(Profile* profile); 26 27 // Returns true if session storage namespace merging is not disabled. 28 bool ShouldMergeSessionStorageNamespaces(); 29 30 // Returns true iff the Prerender Local Predictor is enabled. 31 bool IsLocalPredictorEnabled(); 32 33 // Indicates whether to disable the local predictor due to unencrypted sync 34 // settings and configuration. 35 bool DisableLocalPredictorBasedOnSyncAndConfiguration(Profile* profile); 36 37 // Returns true iff the LoggedIn Predictor is enabled. 38 bool IsLoggedInPredictorEnabled(); 39 40 // Returns true iff the side-effect free whitelist is enabled. 41 bool IsSideEffectFreeWhitelistEnabled(); 42 43 // Returns true if the local predictor should actually launch prerenders. 44 bool IsLocalPredictorPrerenderLaunchEnabled(); 45 46 // Returns true if the local predictor should prerender, but only as control 47 // group. If the local predictor never launches prerenders, then this setting 48 // is irrelevant. 49 bool IsLocalPredictorPrerenderAlwaysControlEnabled(); 50 51 // Returns true if the local predictor should prefetch rather than prerender. 52 bool IsLocalPredictorPrerenderPrefetchEnabled(); 53 54 // Returns true if we should query the prerender service for the profile 55 // provided. 56 bool ShouldQueryPrerenderService(Profile* profile); 57 58 // Indicates whether we should query the prerender service for the current URL 59 // and candidate URLs, respectively. 60 bool ShouldQueryPrerenderServiceForCurrentURL(); 61 bool ShouldQueryPrerenderServiceForCandidateURLs(); 62 63 // Returns the URL prefix to be used for the prerender service. The only thing 64 // that will be appended is the urlencoded query json. 65 std::string GetPrerenderServiceURLPrefix(); 66 67 // Returns the prerender service behavior ID that should be passed to the 68 // to the prerender service in requests. 69 int GetPrerenderServiceBehaviorID(); 70 71 // Returns the fetch timeout to be used for the prerender service, in ms. 72 int GetPrerenderServiceFetchTimeoutMs(); 73 74 // Returns the TTL to be used for the local predictor. 75 int GetLocalPredictorTTLSeconds(); 76 77 // Returns the half-life time to use to decay local predictor prerender 78 // priorities. 79 int GetLocalPredictorPrerenderPriorityHalfLifeTimeSeconds(); 80 81 // Returns the maximum number of concurrent prerenders the local predictor 82 // may maintain. 83 int GetLocalPredictorMaxConcurrentPrerenders(); 84 85 // Returns the maximum number of concurrent prerenders the local predictor 86 // may launch concurrently. 87 int GetLocalPredictorMaxLaunchPrerenders(); 88 89 // The following functions return whether certain LocalPredictor checks should 90 // be skipped, as indicated by the name. 91 bool SkipLocalPredictorFragment(); 92 bool SkipLocalPredictorHTTPS(); 93 bool SkipLocalPredictorWhitelist(); 94 bool SkipLocalPredictorServiceWhitelist(); 95 bool SkipLocalPredictorLoggedIn(); 96 bool SkipLocalPredictorDefaultNoPrerender(); 97 bool SkipLocalPredictorLocalCandidates(); 98 bool SkipLocalPredictorServiceCandidates(); 99 100 // Indicates whether no prerender cookie stores should be used for prerendering. 101 bool IsPrerenderCookieStoreEnabled(); 102 103 } // namespace prerender 104 105 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ 106