Chromium Code Reviews| Index: chrome/browser/ui/browser_instant_controller.cc |
| diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc |
| index 582ae88a9009ee2429c033d94ebfc861278d625f..d3651a67c455eb038c00dc5438545ecc6b739aaa 100644 |
| --- a/chrome/browser/ui/browser_instant_controller.cc |
| +++ b/chrome/browser/ui/browser_instant_controller.cc |
| @@ -46,7 +46,16 @@ BrowserInstantController::BrowserInstantController(Browser* browser) |
| chrome::search::IsInstantExtendedAPIEnabled(profile())), |
| instant_unload_handler_(browser), |
| initialized_theme_info_(false) { |
| - profile_pref_registrar_.Init(profile()->GetPrefs()); |
| + PrefService* prefs = profile()->GetPrefs(); |
| + |
| + if (search::GetInstantExtendedDefaultSetting() == |
| + search::INSTANT_USE_EXISTING) { |
| + prefs->SetDefaultPrefValue(prefs::kInstantExtendedEnabled, |
| + Value::CreateBooleanValue( |
| + prefs->GetBoolean(prefs::kInstantEnabled))); |
| + } |
| + |
| + profile_pref_registrar_.Init(prefs); |
| profile_pref_registrar_.Add( |
| GetInstantPrefName(profile()), |
| base::Bind(&BrowserInstantController::ResetInstant, |
| @@ -76,9 +85,7 @@ bool BrowserInstantController::IsInstantEnabled(Profile* profile) { |
| } |
| void BrowserInstantController::RegisterUserPrefs( |
| - PrefService* prefs, |
| PrefRegistrySyncable* registry) { |
| - // TODO(joi): Get rid of the need for PrefService param above. |
| registry->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false, |
| PrefRegistrySyncable::SYNCABLE_PREF); |
| registry->RegisterBooleanPref(prefs::kInstantEnabled, false, |
| @@ -90,8 +97,8 @@ void BrowserInstantController::RegisterUserPrefs( |
| instant_extended_default = true; |
| break; |
| case search::INSTANT_USE_EXISTING: |
| - instant_extended_default = prefs->GetBoolean(prefs::kInstantEnabled); |
| - break; |
| + // Fall-through to false; the default gets reset in the |
| + // BrowserInstantController constructor in this case. |
|
Mattias Nissler (ping if slow)
2013/02/27 10:50:52
Maybe we can move all default setting to the ctor
Jói
2013/02/27 16:30:56
Done.
|
| case search::INSTANT_DEFAULT_OFF: |
| instant_extended_default = false; |
| break; |