Chromium Code Reviews| 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..8afc04809ce6541d6bd9440f3f82318aa674f02a 100644 |
| --- a/chrome/browser/net/prediction_options.cc |
| +++ b/chrome/browser/net/prediction_options.cc |
| @@ -46,6 +46,33 @@ void RegisterPredictionOptionsProfilePrefs( |
| user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| } |
| +void MigrateNetworkPredictionUserPrefs(PrefService* pref_service) { |
| + const PrefService::Preference* network_prediction_options = |
| + pref_service->FindPreference(prefs::kNetworkPredictionOptions); |
| + DCHECK(network_prediction_options); |
| + |
| + // Nothing to do if the user or this migration code has already set the new |
| + // preference. |
| + if (network_prediction_options->HasUserSetting()) |
|
Bernhard Bauer
2014/08/07 08:32:17
You could directly use pref_service->IsUserModifia
bartfab (slow)
2014/08/07 12:17:06
HasUserSetting() and IsUserModifiablePreference()
Bernhard Bauer
2014/08/07 12:24:12
Urr, I meant pref_service->GetUserPrefValue().
Bence
2014/08/07 13:50:01
Done.
|
| + return; |
| + |
| + const PrefService::Preference* network_prediction_enabled = |
| + pref_service->FindPreference(prefs::kNetworkPredictionEnabled); |
| + DCHECK(network_prediction_enabled); |
| + |
| + // Nothing to do if the user has not set the old preference. |
| + if (!network_prediction_enabled->HasUserSetting()) |
| + return; |
| + |
| + bool value; |
|
battre
2014/08/07 07:56:52
please initialize.
Bence
2014/08/07 13:50:01
Done.
|
| + if (network_prediction_enabled->GetUserValue()->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); |