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 10class Profile; 11 12namespace base { 13class CommandLine; 14} 15 16namespace 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. 21void 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. 25bool IsOmniboxEnabled(Profile* profile); 26 27// Returns true if session storage namespace merging is not disabled. 28bool ShouldMergeSessionStorageNamespaces(); 29 30// Returns true iff the Prerender Local Predictor is enabled. 31bool IsLocalPredictorEnabled(); 32 33// Indicates whether to disable the local predictor due to unencrypted sync 34// settings and configuration. 35bool 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. 39bool ShouldDisableLocalPredictorDueToPreferencesAndNetwork(Profile* profile); 40 41// Returns true iff the LoggedIn Predictor is enabled. 42bool IsLoggedInPredictorEnabled(); 43 44// Returns true iff the side-effect free whitelist is enabled. 45bool IsSideEffectFreeWhitelistEnabled(); 46 47// Returns true if the local predictor should actually launch prerenders. 48bool 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. 53bool IsLocalPredictorPrerenderAlwaysControlEnabled(); 54 55// Returns true if the local predictor should prefetch rather than prerender. 56bool IsLocalPredictorPrerenderPrefetchEnabled(); 57 58// Returns true if we should query the prerender service for the profile 59// provided. 60bool ShouldQueryPrerenderService(Profile* profile); 61 62// Indicates whether we should query the prerender service for the current URL 63// and candidate URLs, respectively. 64bool ShouldQueryPrerenderServiceForCurrentURL(); 65bool 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. 69std::string GetPrerenderServiceURLPrefix(); 70 71// Returns the prerender service behavior ID that should be passed to the 72// to the prerender service in requests. 73int GetPrerenderServiceBehaviorID(); 74 75// Returns the fetch timeout to be used for the prerender service, in ms. 76int GetPrerenderServiceFetchTimeoutMs(); 77 78// Returns the timeout for entries in the prefetch list, in seconds. 79int GetPrerenderPrefetchListTimeoutSeconds(); 80 81// Returns the TTL to be used for the local predictor. 82int GetLocalPredictorTTLSeconds(); 83 84// Returns the half-life time to use to decay local predictor prerender 85// priorities. 86int GetLocalPredictorPrerenderPriorityHalfLifeTimeSeconds(); 87 88// Returns the maximum number of concurrent prerenders the local predictor 89// may maintain. 90int GetLocalPredictorMaxConcurrentPrerenders(); 91 92// Returns the maximum number of concurrent prerenders the local predictor 93// may launch concurrently. 94int GetLocalPredictorMaxLaunchPrerenders(); 95 96// The following functions return whether certain LocalPredictor checks should 97// be skipped, as indicated by the name. 98bool SkipLocalPredictorFragment(); 99bool SkipLocalPredictorHTTPS(); 100bool SkipLocalPredictorWhitelist(); 101bool SkipLocalPredictorServiceWhitelist(); 102bool SkipLocalPredictorLoggedIn(); 103bool SkipLocalPredictorDefaultNoPrerender(); 104bool SkipLocalPredictorLocalCandidates(); 105bool SkipLocalPredictorServiceCandidates(); 106 107// Indicates whether no prerender cookie stores should be used for prerendering. 108bool IsPrerenderCookieStoreEnabled(); 109 110} // namespace prerender 111 112#endif // CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_ 113