OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ |
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ |
7 | 7 |
8 #include <string> | |
9 | |
10 class Profile; | 8 class Profile; |
11 | 9 |
12 namespace base { | 10 namespace base { |
13 class CommandLine; | 11 class CommandLine; |
14 } | 12 } |
15 | 13 |
16 namespace prerender { | 14 namespace prerender { |
17 | 15 |
18 // Parse the --prerender= command line switch, which controls prerendering. If | 16 // 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 | 17 // the switch is unset or is set to "auto" then the user is assigned to a |
20 // field trial. | 18 // field trial. |
21 void ConfigurePrerender(const base::CommandLine& command_line); | 19 void ConfigurePrerender(const base::CommandLine& command_line); |
22 | 20 |
23 // Returns true if the user has opted in or has been opted in to the | 21 // Returns true if the user has opted in or has been opted in to the |
24 // prerendering from Omnibox experiment. | 22 // prerendering from Omnibox experiment. |
25 bool IsOmniboxEnabled(Profile* profile); | 23 bool IsOmniboxEnabled(Profile* profile); |
26 | 24 |
27 // Returns true iff the Prerender Local Predictor is enabled. | |
28 bool IsLocalPredictorEnabled(); | |
29 | |
30 // Indicates whether to disable the local predictor due to unencrypted sync | |
31 // settings and configuration. | |
32 bool ShouldDisableLocalPredictorBasedOnSyncAndConfiguration(Profile* profile); | |
33 | |
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); | |
37 | |
38 // Returns true iff the LoggedIn Predictor is enabled. | |
39 bool IsLoggedInPredictorEnabled(); | |
40 | |
41 // Returns true iff the side-effect free whitelist is enabled. | 25 // Returns true iff the side-effect free whitelist is enabled. |
42 bool IsSideEffectFreeWhitelistEnabled(); | 26 bool IsSideEffectFreeWhitelistEnabled(); |
43 | 27 |
44 // Returns true if the local predictor should actually launch prerenders. | |
45 bool IsLocalPredictorPrerenderLaunchEnabled(); | |
46 | |
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 | |
49 // is irrelevant. | |
50 bool IsLocalPredictorPrerenderAlwaysControlEnabled(); | |
51 | |
52 // Returns true if the local predictor should prefetch rather than prerender. | |
53 bool IsLocalPredictorPrerenderPrefetchEnabled(); | |
54 | |
55 // Returns true if we should query the prerender service for the profile | |
56 // provided. | |
57 bool ShouldQueryPrerenderService(Profile* profile); | |
58 | |
59 // Indicates whether we should query the prerender service for the current URL | |
60 // and candidate URLs, respectively. | |
61 bool ShouldQueryPrerenderServiceForCurrentURL(); | |
62 bool ShouldQueryPrerenderServiceForCandidateURLs(); | |
63 | |
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(); | |
67 | |
68 // Returns the prerender service behavior ID that should be passed to the | |
69 // to the prerender service in requests. | |
70 int GetPrerenderServiceBehaviorID(); | |
71 | |
72 // Returns the fetch timeout to be used for the prerender service, in ms. | |
73 int GetPrerenderServiceFetchTimeoutMs(); | |
74 | |
75 // Returns the timeout for entries in the prefetch list, in seconds. | |
76 int GetPrerenderPrefetchListTimeoutSeconds(); | |
77 | |
78 // Returns the TTL to be used for the local predictor. | |
79 int GetLocalPredictorTTLSeconds(); | |
80 | |
81 // Returns the half-life time to use to decay local predictor prerender | |
82 // priorities. | |
83 int GetLocalPredictorPrerenderPriorityHalfLifeTimeSeconds(); | |
84 | |
85 // Returns the maximum number of concurrent prerenders the local predictor | |
86 // may maintain. | |
87 int GetLocalPredictorMaxConcurrentPrerenders(); | |
88 | |
89 // Returns the maximum number of concurrent prerenders the local predictor | |
90 // may launch concurrently. | |
91 int GetLocalPredictorMaxLaunchPrerenders(); | |
92 | |
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(); | |
103 | |
104 } // namespace prerender | 28 } // namespace prerender |
105 | 29 |
106 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ | 30 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ |
OLD | NEW |