| 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 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 NETWORK_PREDICTION_NEVER, | 25 NETWORK_PREDICTION_NEVER, |
| 26 NETWORK_PREDICTION_DEFAULT = NETWORK_PREDICTION_WIFI_ONLY, | 26 NETWORK_PREDICTION_DEFAULT = NETWORK_PREDICTION_WIFI_ONLY, |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 enum class NetworkPredictionStatus { | 29 enum class NetworkPredictionStatus { |
| 30 ENABLED, | 30 ENABLED, |
| 31 DISABLED_ALWAYS, | 31 DISABLED_ALWAYS, |
| 32 DISABLED_DUE_TO_NETWORK, | 32 DISABLED_DUE_TO_NETWORK, |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 enum class NetworkPredictionOptionsForServiceWorker { |
| 36 PRECONNECT_ONLY, |
| 37 START_SERVICE_WORKER_AND_PRECONNECT, |
| 38 START_SERVICE_WORKER_AND_DEFER_PRECONNECT, |
| 39 START_SERVICE_WORKER_ONLY |
| 40 }; |
| 41 |
| 42 extern const char kPreconnectOnly[]; |
| 43 extern const char kStartServiceWorkerAndPreconnect[]; |
| 44 extern const char kStartServiceWorkerAndDeferPreconnect[]; |
| 45 extern const char kStartServiceWorkerOnly[]; |
| 46 |
| 35 void RegisterPredictionOptionsProfilePrefs( | 47 void RegisterPredictionOptionsProfilePrefs( |
| 36 user_prefs::PrefRegistrySyncable* registry); | 48 user_prefs::PrefRegistrySyncable* registry); |
| 37 | 49 |
| 38 // The following two global functions determine whether prefetching | 50 // The following two global functions determine whether prefetching |
| 39 // and prerendering are enabled, based on preferences and network type. | 51 // and prerendering are enabled, based on preferences and network type. |
| 40 | 52 |
| 41 // To be executed on the IO thread only. | 53 // To be executed on the IO thread only. |
| 42 NetworkPredictionStatus CanPrefetchAndPrerenderIO( | 54 NetworkPredictionStatus CanPrefetchAndPrerenderIO( |
| 43 ProfileIOData* profile_io_data); | 55 ProfileIOData* profile_io_data); |
| 44 | 56 |
| 45 // To be executed on the UI thread only. | 57 // To be executed on the UI thread only. |
| 46 NetworkPredictionStatus CanPrefetchAndPrerenderUI(PrefService* prefs); | 58 NetworkPredictionStatus CanPrefetchAndPrerenderUI(PrefService* prefs); |
| 47 | 59 |
| 48 // The following two global functions determine whether TCP preconnect | 60 // The following two global functions determine whether TCP preconnect |
| 49 // and DNS preresolution are enabled, based on preferences. | 61 // and DNS preresolution are enabled, based on preferences. |
| 50 | 62 |
| 51 // To be executed on the IO thread only. | 63 // To be executed on the IO thread only. |
| 52 bool CanPreresolveAndPreconnectIO(ProfileIOData* profile_io_data); | 64 bool CanPreresolveAndPreconnectIO(ProfileIOData* profile_io_data); |
| 53 | 65 |
| 54 // To be executed on the UI thread only. | 66 // To be executed on the UI thread only. |
| 55 bool CanPreresolveAndPreconnectUI(PrefService* prefs); | 67 bool CanPreresolveAndPreconnectUI(PrefService* prefs); |
| 56 | 68 |
| 69 NetworkPredictionOptionsForServiceWorker |
| 70 GetNetworkPredictionOptionsForServiceWorker(); |
| 71 |
| 57 } // namespace chrome_browser_net | 72 } // namespace chrome_browser_net |
| 58 | 73 |
| 59 #endif // CHROME_BROWSER_NET_PREDICTION_OPTIONS_H_ | 74 #endif // CHROME_BROWSER_NET_PREDICTION_OPTIONS_H_ |
| OLD | NEW |