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

Unified Diff: chrome/browser/chromeos/preferences.cc

Issue 11640032: Delay forcing natural scroll setting until after initial sync. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years 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
Index: chrome/browser/chromeos/preferences.cc
===================================================================
--- chrome/browser/chromeos/preferences.cc (revision 173817)
+++ chrome/browser/chromeos/preferences.cc (working copy)
@@ -387,6 +387,10 @@
void Preferences::Init(PrefService* prefs) {
InitUserPrefs(prefs);
+ // This causes OnIsSyncingChanged to be called when the value of
+ // PrefService::IsSyncing() changes.
+ prefs->AddObserver(this);
xiyuan 2012/12/20 01:44:28 Where do we RemoveObserver?
achuithb 2012/12/20 01:53:31 Done.
+
// Initialize preferences to currently saved state.
NotifyPrefChanged(NULL);
@@ -450,16 +454,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();
const bool enabled = natural_scroll_.GetValue();
DVLOG(1) << "Natural scroll set to " << enabled;
@@ -677,6 +674,24 @@
}
}
+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);
+ }
+
xiyuan 2012/12/20 01:44:28 nit: nuke this emptly line
achuithb 2012/12/20 01:53:31 Done.
+}
+
void Preferences::SetLanguageConfigBoolean(const char* section,
const char* name,
bool value) {
« chrome/browser/chromeos/preferences.h ('K') | « chrome/browser/chromeos/preferences.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698