• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 ShouldDisableLocalPredictorBasedOnSyncAndConfiguration(Profile* profile);
36 
37 // Returns whether or not the local predictor is temporarily disabled, due
38 // to network predictive action settings and current network.
39 bool ShouldDisableLocalPredictorDueToPreferencesAndNetwork(Profile* profile);
40 
41 // Returns true iff the LoggedIn Predictor is enabled.
42 bool IsLoggedInPredictorEnabled();
43 
44 // Returns true iff the side-effect free whitelist is enabled.
45 bool IsSideEffectFreeWhitelistEnabled();
46 
47 // Returns true if the local predictor should actually launch prerenders.
48 bool IsLocalPredictorPrerenderLaunchEnabled();
49 
50 // Returns true if the local predictor should prerender, but only as control
51 // group. If the local predictor never launches prerenders, then this setting
52 // is irrelevant.
53 bool IsLocalPredictorPrerenderAlwaysControlEnabled();
54 
55 // Returns true if the local predictor should prefetch rather than prerender.
56 bool IsLocalPredictorPrerenderPrefetchEnabled();
57 
58 // Returns true if we should query the prerender service for the profile
59 // provided.
60 bool ShouldQueryPrerenderService(Profile* profile);
61 
62 // Indicates whether we should query the prerender service for the current URL
63 // and candidate URLs, respectively.
64 bool ShouldQueryPrerenderServiceForCurrentURL();
65 bool ShouldQueryPrerenderServiceForCandidateURLs();
66 
67 // Returns the URL prefix to be used for the prerender service. The only thing
68 // that will be appended is the urlencoded query json.
69 std::string GetPrerenderServiceURLPrefix();
70 
71 // Returns the prerender service behavior ID that should be passed to the
72 // to the prerender service in requests.
73 int GetPrerenderServiceBehaviorID();
74 
75 // Returns the fetch timeout to be used for the prerender service, in ms.
76 int GetPrerenderServiceFetchTimeoutMs();
77 
78 // Returns the timeout for entries in the prefetch list, in seconds.
79 int GetPrerenderPrefetchListTimeoutSeconds();
80 
81 // Returns the TTL to be used for the local predictor.
82 int GetLocalPredictorTTLSeconds();
83 
84 // Returns the half-life time to use to decay local predictor prerender
85 // priorities.
86 int GetLocalPredictorPrerenderPriorityHalfLifeTimeSeconds();
87 
88 // Returns the maximum number of concurrent prerenders the local predictor
89 // may maintain.
90 int GetLocalPredictorMaxConcurrentPrerenders();
91 
92 // Returns the maximum number of concurrent prerenders the local predictor
93 // may launch concurrently.
94 int GetLocalPredictorMaxLaunchPrerenders();
95 
96 // The following functions return whether certain LocalPredictor checks should
97 // be skipped, as indicated by the name.
98 bool SkipLocalPredictorFragment();
99 bool SkipLocalPredictorHTTPS();
100 bool SkipLocalPredictorWhitelist();
101 bool SkipLocalPredictorServiceWhitelist();
102 bool SkipLocalPredictorLoggedIn();
103 bool SkipLocalPredictorDefaultNoPrerender();
104 bool SkipLocalPredictorLocalCandidates();
105 bool SkipLocalPredictorServiceCandidates();
106 
107 // Indicates whether no prerender cookie stores should be used for prerendering.
108 bool IsPrerenderCookieStoreEnabled();
109 
110 }  // namespace prerender
111 
112 #endif  // CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_
113