Home | History | Annotate | Download | only in net
      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 }
     11 
     12 class PrefService;
     13 class ProfileIOData;
     14 
     15 namespace chrome_browser_net {
     16 
     17 // Enum describing when to allow network predictions based on connection type.
     18 // The numerical value is stored in the prefs file, therefore the same enum
     19 // with the same order must be used by the platform-dependent components.
     20 enum NetworkPredictionOptions {
     21   NETWORK_PREDICTION_ALWAYS,
     22   NETWORK_PREDICTION_WIFI_ONLY,
     23   NETWORK_PREDICTION_NEVER,
     24   NETWORK_PREDICTION_DEFAULT = NETWORK_PREDICTION_WIFI_ONLY,
     25 };
     26 
     27 void RegisterPredictionOptionsProfilePrefs(
     28     user_prefs::PrefRegistrySyncable* registry);
     29 
     30 // Migrate prefs::kNetworkPredictionEnabled user setting (if exists) to
     31 // prefs::kNetworkPredictionOptions (if does not have user setting).
     32 void MigrateNetworkPredictionUserPrefs(PrefService* pref_service);
     33 
     34 // The following two global functions determine whether prefetching
     35 // and prerendering are enabled, based on preferences and network type.
     36 
     37 // To be executed on the IO thread only.
     38 bool CanPrefetchAndPrerenderIO(ProfileIOData* profile_io_data);
     39 
     40 // To be executed on the UI thread only.
     41 bool CanPrefetchAndPrerenderUI(PrefService* prefs);
     42 
     43 // The following two global functions determine whether TCP preconnect
     44 // and DNS preresolution are enabled, based on preferences.
     45 
     46 // To be executed on the IO thread only.
     47 bool CanPreresolveAndPreconnectIO(ProfileIOData* profile_io_data);
     48 
     49 // To be executed on the UI thread only.
     50 bool CanPreresolveAndPreconnectUI(PrefService* prefs);
     51 
     52 }  // namespace chrome_browser_net
     53 
     54 #endif  // CHROME_BROWSER_NET_PREDICTION_OPTIONS_H_
     55