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

Unified Diff: chrome/browser/ui/browser_instant_controller.cc

Issue 12328054: Fix prefs registration for BrowserInstantController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Preserve previous semantics. Created 7 years, 10 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/ui/browser_instant_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « chrome/browser/ui/browser_instant_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698