| 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 #include "chrome/browser/net/prediction_options.h" | 5 #include "chrome/browser/net/prediction_options.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/profiles/profile_io_data.h" | 9 #include "chrome/browser/profiles/profile_io_data.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 bool value = false; | 62 bool value = false; |
| 63 if (network_prediction_enabled->GetAsBoolean(&value)) { | 63 if (network_prediction_enabled->GetAsBoolean(&value)) { |
| 64 pref_service->SetInteger( | 64 pref_service->SetInteger( |
| 65 prefs::kNetworkPredictionOptions, | 65 prefs::kNetworkPredictionOptions, |
| 66 value ? NETWORK_PREDICTION_WIFI_ONLY : NETWORK_PREDICTION_NEVER); | 66 value ? NETWORK_PREDICTION_WIFI_ONLY : NETWORK_PREDICTION_NEVER); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool CanPrefetchAndPrerenderIO(ProfileIOData* profile_io_data) { | 70 bool CanPrefetchAndPrerenderIO(ProfileIOData* profile_io_data) { |
| 71 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 71 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 72 DCHECK(profile_io_data); | 72 DCHECK(profile_io_data); |
| 73 return CanPrefetchAndPrerender( | 73 return CanPrefetchAndPrerender( |
| 74 profile_io_data->network_prediction_options()->GetValue()); | 74 profile_io_data->network_prediction_options()->GetValue()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 bool CanPrefetchAndPrerenderUI(PrefService* prefs) { | 77 bool CanPrefetchAndPrerenderUI(PrefService* prefs) { |
| 78 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 78 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 79 DCHECK(prefs); | 79 DCHECK(prefs); |
| 80 return CanPrefetchAndPrerender( | 80 return CanPrefetchAndPrerender( |
| 81 prefs->GetInteger(prefs::kNetworkPredictionOptions)); | 81 prefs->GetInteger(prefs::kNetworkPredictionOptions)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool CanPreresolveAndPreconnectIO(ProfileIOData* profile_io_data) { | 84 bool CanPreresolveAndPreconnectIO(ProfileIOData* profile_io_data) { |
| 85 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 85 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 86 DCHECK(profile_io_data); | 86 DCHECK(profile_io_data); |
| 87 return CanPreresolveAndPreconnect( | 87 return CanPreresolveAndPreconnect( |
| 88 profile_io_data->network_prediction_options()->GetValue()); | 88 profile_io_data->network_prediction_options()->GetValue()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool CanPreresolveAndPreconnectUI(PrefService* prefs) { | 91 bool CanPreresolveAndPreconnectUI(PrefService* prefs) { |
| 92 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 92 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 93 DCHECK(prefs); | 93 DCHECK(prefs); |
| 94 return CanPreresolveAndPreconnect( | 94 return CanPreresolveAndPreconnect( |
| 95 prefs->GetInteger(prefs::kNetworkPredictionOptions)); | 95 prefs->GetInteger(prefs::kNetworkPredictionOptions)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace chrome_browser_net | 98 } // namespace chrome_browser_net |
| OLD | NEW |