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.
5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_
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
21 void ConfigurePrerender(const base::CommandLine
& command_line
);
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
);
27 // Returns true iff the Prerender Local Predictor is enabled.
28 bool IsLocalPredictorEnabled();
30 // Indicates whether to disable the local predictor due to unencrypted sync
31 // settings and configuration.
32 bool ShouldDisableLocalPredictorBasedOnSyncAndConfiguration(Profile
* profile
);
34 // Returns whether or not the local predictor is temporarily disabled, due
35 // to network predictive action settings and current network.
36 bool ShouldDisableLocalPredictorDueToPreferencesAndNetwork(Profile
* profile
);
38 // Returns true iff the LoggedIn Predictor is enabled.
39 bool IsLoggedInPredictorEnabled();
41 // Returns true iff the side-effect free whitelist is enabled.
42 bool IsSideEffectFreeWhitelistEnabled();
44 // Returns true if the local predictor should actually launch prerenders.
45 bool IsLocalPredictorPrerenderLaunchEnabled();
47 // Returns true if the local predictor should prerender, but only as control
48 // group. If the local predictor never launches prerenders, then this setting
50 bool IsLocalPredictorPrerenderAlwaysControlEnabled();
52 // Returns true if the local predictor should prefetch rather than prerender.
53 bool IsLocalPredictorPrerenderPrefetchEnabled();
55 // Returns true if we should query the prerender service for the profile
57 bool ShouldQueryPrerenderService(Profile
* profile
);
59 // Indicates whether we should query the prerender service for the current URL
60 // and candidate URLs, respectively.
61 bool ShouldQueryPrerenderServiceForCurrentURL();
62 bool ShouldQueryPrerenderServiceForCandidateURLs();
64 // Returns the URL prefix to be used for the prerender service. The only thing
65 // that will be appended is the urlencoded query json.
66 std::string
GetPrerenderServiceURLPrefix();
68 // Returns the prerender service behavior ID that should be passed to the
69 // to the prerender service in requests.
70 int GetPrerenderServiceBehaviorID();
72 // Returns the fetch timeout to be used for the prerender service, in ms.
73 int GetPrerenderServiceFetchTimeoutMs();
75 // Returns the timeout for entries in the prefetch list, in seconds.
76 int GetPrerenderPrefetchListTimeoutSeconds();
78 // Returns the TTL to be used for the local predictor.
79 int GetLocalPredictorTTLSeconds();
81 // Returns the half-life time to use to decay local predictor prerender
83 int GetLocalPredictorPrerenderPriorityHalfLifeTimeSeconds();
85 // Returns the maximum number of concurrent prerenders the local predictor
87 int GetLocalPredictorMaxConcurrentPrerenders();
89 // Returns the maximum number of concurrent prerenders the local predictor
90 // may launch concurrently.
91 int GetLocalPredictorMaxLaunchPrerenders();
93 // The following functions return whether certain LocalPredictor checks should
94 // be skipped, as indicated by the name.
95 bool SkipLocalPredictorFragment();
96 bool SkipLocalPredictorHTTPS();
97 bool SkipLocalPredictorWhitelist();
98 bool SkipLocalPredictorServiceWhitelist();
99 bool SkipLocalPredictorLoggedIn();
100 bool SkipLocalPredictorDefaultNoPrerender();
101 bool SkipLocalPredictorLocalCandidates();
102 bool SkipLocalPredictorServiceCandidates();
104 } // namespace prerender
106 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_