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