Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: chrome/browser/net/prediction_options.cc

Issue 421653006: Update "Predict network actions" UI setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/prediction_options.h ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/prediction_options.cc
diff --git a/chrome/browser/net/prediction_options.cc b/chrome/browser/net/prediction_options.cc
index 34fc98894e72e5c40f5ac2b8b2482c13378d0883..509d259235c96050ecd28dc94a15b9732a27d0b8 100644
--- a/chrome/browser/net/prediction_options.cc
+++ b/chrome/browser/net/prediction_options.cc
@@ -46,6 +46,27 @@ void RegisterPredictionOptionsProfilePrefs(
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
}
+void MigrateNetworkPredictionUserPrefs(PrefService* pref_service) {
+ // Nothing to do if the user or this migration code has already set the new
+ // preference.
+ if (pref_service->GetUserPrefValue(prefs::kNetworkPredictionOptions))
+ return;
+
+ // Nothing to do if the user has not set the old preference.
+ const base::Value* network_prediction_enabled =
+ pref_service->GetUserPrefValue(prefs::kNetworkPredictionEnabled);
+ if (!network_prediction_enabled)
+ return;
+
+ bool value = false;
+ if (network_prediction_enabled->GetAsBoolean(&value)) {
+ pref_service->SetInteger(
+ prefs::kNetworkPredictionOptions,
+ value ? chrome_browser_net::NETWORK_PREDICTION_WIFI_ONLY
+ : chrome_browser_net::NETWORK_PREDICTION_NEVER);
+ }
+}
+
bool CanPredictNetworkActionsIO(ProfileIOData* profile_io_data) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(profile_io_data);
« no previous file with comments | « chrome/browser/net/prediction_options.h ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698