OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_NET_PREDICTION_OPTIONS_H_ | 5 #ifndef CHROME_BROWSER_NET_PREDICTION_OPTIONS_H_ |
6 #define CHROME_BROWSER_NET_PREDICTION_OPTIONS_H_ | 6 #define CHROME_BROWSER_NET_PREDICTION_OPTIONS_H_ |
7 | 7 |
8 namespace user_prefs { | 8 namespace user_prefs { |
9 class PrefRegistrySyncable; | 9 class PrefRegistrySyncable; |
10 } | 10 } |
11 | 11 |
12 namespace content { | |
13 class ResourceContext; | |
14 } | |
15 | |
16 class PrefService; | 12 class PrefService; |
| 13 class ProfileIOData; |
17 | 14 |
18 namespace chrome_browser_net { | 15 namespace chrome_browser_net { |
19 | 16 |
20 // Enum describing when to allow network predictions based on connection type. | 17 // Enum describing when to allow network predictions based on connection type. |
21 // The numerical value is stored in the prefs file, therefore the same enum | 18 // The numerical value is stored in the prefs file, therefore the same enum |
22 // with the same order must be used by the platform-dependent components. | 19 // with the same order must be used by the platform-dependent components. |
23 // TODO(bnc): implement as per crbug.com/334602. | 20 // TODO(bnc): implement as per crbug.com/334602. |
24 // NETWORK_PREDICTION_UNSET means that the old preferences, | 21 // NETWORK_PREDICTION_UNSET means that the old preferences, |
25 // kNetworkPredictionEnabled and kAllowPrerender, should be observed. | 22 // kNetworkPredictionEnabled and kAllowPrerender, should be observed. |
26 enum NetworkPredictionOptions { | 23 enum NetworkPredictionOptions { |
27 NETWORK_PREDICTION_ALWAYS, | 24 NETWORK_PREDICTION_ALWAYS, |
28 NETWORK_PREDICTION_WIFI_ONLY, | 25 NETWORK_PREDICTION_WIFI_ONLY, |
29 NETWORK_PREDICTION_NEVER, | 26 NETWORK_PREDICTION_NEVER, |
30 NETWORK_PREDICTION_UNSET, | 27 NETWORK_PREDICTION_UNSET, |
31 }; | 28 }; |
32 | 29 |
33 void RegisterPredictionOptionsProfilePrefs( | 30 void RegisterPredictionOptionsProfilePrefs( |
34 user_prefs::PrefRegistrySyncable* registry); | 31 user_prefs::PrefRegistrySyncable* registry); |
35 | 32 |
36 // The following two global functions determine whether predictive network | 33 // The following two global functions determine whether predictive network |
37 // actions are enabled, based on preferences and network type. | 34 // actions are enabled, based on preferences and network type. |
38 | 35 |
39 // To be executed on the IO thread only. | 36 // To be executed on the IO thread only. |
40 bool CanPredictNetworkActionsIO(content::ResourceContext* resource_context); | 37 bool CanPredictNetworkActionsIO(ProfileIOData* profile_io_data); |
41 | 38 |
42 // To be executed on the UI thread only. | 39 // To be executed on the UI thread only. |
43 bool CanPredictNetworkActionsUI(PrefService* prefs); | 40 bool CanPredictNetworkActionsUI(PrefService* prefs); |
44 | 41 |
45 } // namespace chrome_browser_net | 42 } // namespace chrome_browser_net |
46 | 43 |
47 #endif // CHROME_BROWSER_NET_PREDICTION_OPTIONS_H_ | 44 #endif // CHROME_BROWSER_NET_PREDICTION_OPTIONS_H_ |
OLD | NEW |