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> | 8 #include <string> |
9 | 9 |
10 class CommandLine; | 10 class CommandLine; |
11 class Profile; | 11 class Profile; |
12 | 12 |
13 namespace prerender { | 13 namespace prerender { |
14 | 14 |
15 // Parse the --prerender= command line switch, which controls both prerendering | 15 // Parse the --prerender= command line switch, which controls both prerendering |
16 // and prefetching. If the switch is unset, or is set to "auto", then the user | 16 // and prefetching. If the switch is unset, or is set to "auto", then the user |
17 // is assigned to a field trial. | 17 // is assigned to a field trial. |
18 void ConfigurePrefetchAndPrerender(const CommandLine& command_line); | 18 void ConfigurePrefetchAndPrerender(const CommandLine& command_line); |
19 | 19 |
20 // Returns true if the user has opted in or has been opted in to the | 20 // Returns true if the user has opted in or has been opted in to the |
21 // prerendering from Omnibox experiment. | 21 // prerendering from Omnibox experiment. |
22 bool IsOmniboxEnabled(Profile* profile); | 22 bool IsOmniboxEnabled(Profile* profile); |
23 | 23 |
24 // Returns true iff the Prerender Local Predictor is enabled. | 24 // Returns true iff the Prerender Local Predictor is enabled. |
25 bool IsLocalPredictorEnabled(); | 25 bool IsLocalPredictorEnabled(Profile* profile); |
26 | 26 |
27 // Returns true iff the LoggedIn Predictor is enabled. | 27 // Returns true iff the LoggedIn Predictor is enabled. |
28 bool IsLoggedInPredictorEnabled(); | 28 bool IsLoggedInPredictorEnabled(); |
29 | 29 |
30 // Returns true iff the side-effect free whitelist is enabled. | 30 // Returns true iff the side-effect free whitelist is enabled. |
31 bool IsSideEffectFreeWhitelistEnabled(); | 31 bool IsSideEffectFreeWhitelistEnabled(); |
32 | 32 |
33 // Returns true if the local predictor should actually launch prerenders. | 33 // Returns true if the local predictor should actually launch prerenders. |
34 bool IsLocalPredictorPrerenderLaunchEnabled(); | 34 bool IsLocalPredictorPrerenderLaunchEnabled(); |
35 | 35 |
36 // Returns true if the local predictor should prerender, but only as control | 36 // Returns true if the local predictor should prerender, but only as control |
37 // group. If the local predictor never launches prerenders, then this setting | 37 // group. If the local predictor never launches prerenders, then this setting |
38 // is irrelevant. | 38 // is irrelevant. |
39 bool IsLocalPredictorPrerenderAlwaysControlEnabled(); | 39 bool IsLocalPredictorPrerenderAlwaysControlEnabled(); |
40 | 40 |
| 41 // Returns true if we should query the prerender service for the profile |
| 42 // provided. |
| 43 bool ShouldQueryPrerenderService(Profile* profile); |
| 44 |
| 45 // Returns the URL prefix to be used for the prerender service. The only thing |
| 46 // that will be appended is the urlencoded query json. |
| 47 std::string GetPrerenderServiceURLPrefix(); |
| 48 |
| 49 // Returns the prerender service behavior ID that should be passed to the |
| 50 // to the prerender service in requests. |
| 51 int GetPrerenderServiceBehaviorID(); |
| 52 |
| 53 // Returns the fetch timeout to be used for the prerender service, in ms. |
| 54 int GetPrerenderServiceFetchTimeoutMs(); |
| 55 |
41 // Returns the TTL to be used for the local predictor. | 56 // Returns the TTL to be used for the local predictor. |
42 int GetLocalPredictorTTLSeconds(); | 57 int GetLocalPredictorTTLSeconds(); |
43 | 58 |
44 // Returns the half-life time to use to decay local predictor prerender | 59 // Returns the half-life time to use to decay local predictor prerender |
45 // priorities. | 60 // priorities. |
46 int GetLocalPredictorPrerenderPriorityHalfLifeTimeSeconds(); | 61 int GetLocalPredictorPrerenderPriorityHalfLifeTimeSeconds(); |
47 | 62 |
48 // Returns the maximum number of concurrent prerenders the local predictor | 63 // Returns the maximum number of concurrent prerenders the local predictor |
49 // may maintain. | 64 // may maintain. |
50 int GetLocalPredictorMaxConcurrentPrerenders(); | 65 int GetLocalPredictorMaxConcurrentPrerenders(); |
51 | 66 |
52 // The following functions return whether certain LocalPredictor checks should | 67 // The following functions return whether certain LocalPredictor checks should |
53 // be skipped, as indicated by the name. | 68 // be skipped, as indicated by the name. |
54 bool SkipLocalPredictorFragment(); | 69 bool SkipLocalPredictorFragment(); |
55 bool SkipLocalPredictorHTTPS(); | 70 bool SkipLocalPredictorHTTPS(); |
56 bool SkipLocalPredictorWhitelist(); | 71 bool SkipLocalPredictorWhitelist(); |
| 72 bool SkipLocalPredictorServiceWhitelist(); |
57 bool SkipLocalPredictorLoggedIn(); | 73 bool SkipLocalPredictorLoggedIn(); |
58 bool SkipLocalPredictorDefaultNoPrerender(); | 74 bool SkipLocalPredictorDefaultNoPrerender(); |
59 | 75 |
60 } // namespace prerender | 76 } // namespace prerender |
61 | 77 |
62 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ | 78 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ |
OLD | NEW |