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

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
« no previous file with comments | « chrome/browser/chromeos/preferences.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « chrome/browser/chromeos/preferences.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698