Index: chrome/browser/chromeos/preferences.cc |
=================================================================== |
--- chrome/browser/chromeos/preferences.cc (revision 173817) |
+++ chrome/browser/chromeos/preferences.cc (working copy) |
@@ -48,7 +48,9 @@ |
: input_method_manager_(input_method_manager) { |
} |
-Preferences::~Preferences() {} |
+Preferences::~Preferences() { |
+ prefs_->RemoveObserver(this); |
+} |
// static |
void Preferences::RegisterUserPrefs(PrefService* prefs) { |
@@ -387,6 +389,10 @@ |
void Preferences::Init(PrefService* prefs) { |
InitUserPrefs(prefs); |
+ // This causes OnIsSyncingChanged to be called when the value of |
sky
2012/12/20 16:29:17
OnIsSyncingChanged()
|
+ // PrefService::IsSyncing() changes. |
+ prefs->AddObserver(this); |
+ |
// Initialize preferences to currently saved state. |
NotifyPrefChanged(NULL); |
@@ -450,16 +456,9 @@ |
UMA_HISTOGRAM_BOOLEAN("Touchpad.ThreeFingerSwipe.Started", enabled); |
} |
if (!pref_name || *pref_name == prefs::kNaturalScroll) { |
- // Force natural scroll to on if kNaturalScrollDefault is specified on the |
- // cmd line. |
- if (CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kNaturalScrollDefault) && |
- !pref_name && |
- !prefs_->GetUserPrefValue(prefs::kNaturalScroll)) { |
- natural_scroll_.SetValue(true); |
- DVLOG(1) << "Natural scroll forced to true"; |
- UMA_HISTOGRAM_BOOLEAN("Touchpad.NaturalScroll.Forced", true); |
- } |
+ // Force natural scroll default if we've sync'd and if the cmd line arg is |
+ // set. |
+ ForceNaturalScrollDefault(); |
sky
2012/12/20 16:29:17
If you invoke ForceNaturalScrollDefault() here and
xiyuan
2012/12/20 17:07:49
ForceNaturalScrollDefault just attempts to provide
|
const bool enabled = natural_scroll_.GetValue(); |
DVLOG(1) << "Natural scroll set to " << enabled; |
@@ -677,6 +676,23 @@ |
} |
} |
+void Preferences::OnIsSyncingChanged() { |
+ DVLOG(1) << "OnIsSyncingChanged"; |
+ ForceNaturalScrollDefault(); |
+} |
+ |
+void Preferences::ForceNaturalScrollDefault() { |
+ DVLOG(1) << "ForceNaturalScrollDefault"; |
+ if (CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kNaturalScrollDefault) && |
+ prefs_->IsSyncing() && |
+ !prefs_->GetUserPrefValue(prefs::kNaturalScroll)) { |
+ DVLOG(1) << "Natural scroll forced to true"; |
+ natural_scroll_.SetValue(true); |
+ UMA_HISTOGRAM_BOOLEAN("Touchpad.NaturalScroll.Forced", true); |
+ } |
+} |
+ |
void Preferences::SetLanguageConfigBoolean(const char* section, |
const char* name, |
bool value) { |