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..9d410a4e7ca7eca932d3ca863ee2bf9dcda322e4 100644 |
| --- a/chrome/browser/ui/browser_instant_controller.cc |
| +++ b/chrome/browser/ui/browser_instant_controller.cc |
| @@ -46,7 +46,20 @@ 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 kInstantExtendedEnabled still has a default value, and the |
| + // intent is for it to have the same starting value as whatever |
| + // kInstantEnabled has, then we set it to the value of |
| + // kInstantEnabled. |
| + if (search::GetInstantExtendedDefaultSetting() == |
| + search::INSTANT_USE_EXISTING && |
| + prefs->FindPref(prefs::kInstantExtendedEnabled)->IsDefaultValue()) { |
| + prefs->SetBoolean(prefs::kInstantExtendedEnabled, |
| + prefs->GetBoolean(prefs::kInstantEnabled)); |
|
Mattias Nissler (ping if slow)
2013/02/22 17:07:56
After all the discussion, I don't think copying th
|
| + } |
| + |
| + profile_pref_registrar_.Init(prefs); |
| profile_pref_registrar_.Add( |
| GetInstantPrefName(profile()), |
| base::Bind(&BrowserInstantController::ResetInstant, |
| @@ -76,9 +89,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, |
| @@ -89,9 +100,10 @@ void BrowserInstantController::RegisterUserPrefs( |
| case search::INSTANT_DEFAULT_ON: |
| instant_extended_default = true; |
| break; |
| + // In the INSTANT_USE_EXISTING case, the kInstantExtendedEnabled |
| + // preference, if it still has a default value, is set to the |
| + // value of kInstantEnabled in the constructor of this class. |
| case search::INSTANT_USE_EXISTING: |
| - instant_extended_default = prefs->GetBoolean(prefs::kInstantEnabled); |
| - break; |
| case search::INSTANT_DEFAULT_OFF: |
| instant_extended_default = false; |
| break; |