Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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_NET_PREDICTION_OPTIONS_H_ | |
| 6 #define CHROME_BROWSER_NET_PREDICTION_OPTIONS_H_ | |
| 7 | |
| 8 namespace user_prefs { | |
| 9 class PrefRegistrySyncable; | |
| 10 } // user_prefs | |
|
mmenke
2014/06/27 18:52:05
nit: Close namespace comments usually aren't used
Bence
2014/06/27 19:10:24
Done.
| |
| 11 | |
| 12 namespace content { | |
| 13 class ResourceContext; | |
| 14 } // namespace content | |
|
mmenke
2014/06/27 18:52:05
nit: Close namespace comments usually aren't used
Bence
2014/06/27 19:10:24
Done.
| |
| 15 | |
| 16 class PrefService; | |
| 17 | |
| 18 namespace { | |
| 19 | |
| 20 // Since looking up preferences and current network connection are presumably | |
| 21 // both cheap, we do not cache them here. | |
| 22 bool CanPredictNetworkActions(int NetworkPredictionOptions, | |
| 23 bool NetworkPredictionEnabled); | |
| 24 | |
| 25 } // namespace | |
|
mmenke
2014/06/27 18:52:05
Delete this block of code, it's not needed.
Bence
2014/06/27 19:10:24
Comment moved to prediction_options.cc.
Done.
| |
| 26 | |
| 27 namespace chrome_browser_net { | |
| 28 | |
| 29 // Enum describing when to allow network predictions based on connection type. | |
| 30 // The numerical value is stored in the prefs file, therefore the same enum | |
| 31 // with the same order must be used by the platform-dependent components. | |
| 32 // TODO(bnc): implement as per crbug.com/334602. | |
| 33 // NETWORK_PREDICTION_UNSET means that the old preferences, | |
| 34 // kNetworkPredictionEnabled and kAllowPrerender, should be observed. | |
| 35 enum NetworkPredictionOptions { | |
| 36 NETWORK_PREDICTION_ALWAYS, | |
| 37 NETWORK_PREDICTION_WIFI_ONLY, | |
| 38 NETWORK_PREDICTION_NEVER, | |
| 39 NETWORK_PREDICTION_UNSET, | |
| 40 }; | |
| 41 | |
| 42 void RegisterPredictionOptionsProfilePrefs( | |
| 43 user_prefs::PrefRegistrySyncable* registry); | |
| 44 | |
| 45 // The following two global functions determine whether predictive network | |
| 46 // actions are enabled, based on preferences and network type. | |
| 47 | |
| 48 // To be executed on the IO thread only. | |
| 49 bool CanPredictNetworkActionsIO(content::ResourceContext* resource_context); | |
| 50 | |
| 51 // To be executed on the UI thread only. | |
| 52 bool CanPredictNetworkActionsUI(PrefService* prefs); | |
| 53 | |
| 54 } // namespace chrome_browser_net | |
| 55 | |
| 56 #endif // CHROME_BROWSER_NET_PREDICTION_OPTIONS_H_ | |
| OLD | NEW |