| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/preferences.h" | 5 #include "chrome/browser/chromeos/preferences.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/autoclick/autoclick_controller.h" | 9 #include "ash/autoclick/autoclick_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF); | 115 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF); |
| 116 registry->RegisterBooleanPref( | 116 registry->RegisterBooleanPref( |
| 117 prefs::kTapDraggingEnabled, | 117 prefs::kTapDraggingEnabled, |
| 118 false, | 118 false, |
| 119 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF); | 119 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF); |
| 120 registry->RegisterBooleanPref( | 120 registry->RegisterBooleanPref( |
| 121 prefs::kEnableTouchpadThreeFingerClick, | 121 prefs::kEnableTouchpadThreeFingerClick, |
| 122 false, | 122 false, |
| 123 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 123 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 124 registry->RegisterBooleanPref( | 124 registry->RegisterBooleanPref( |
| 125 prefs::kNaturalScroll, | 125 prefs::kNaturalScroll, base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 126 CommandLine::ForCurrentProcess()->HasSwitch( | 126 switches::kNaturalScrollDefault), |
| 127 switches::kNaturalScrollDefault), | |
| 128 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF); | 127 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF); |
| 129 registry->RegisterBooleanPref( | 128 registry->RegisterBooleanPref( |
| 130 prefs::kPrimaryMouseButtonRight, | 129 prefs::kPrimaryMouseButtonRight, |
| 131 false, | 130 false, |
| 132 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF); | 131 user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF); |
| 133 registry->RegisterBooleanPref( | 132 registry->RegisterBooleanPref( |
| 134 prefs::kLabsMediaplayerEnabled, | 133 prefs::kLabsMediaplayerEnabled, |
| 135 false, | 134 false, |
| 136 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 135 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 137 registry->RegisterBooleanPref( | 136 registry->RegisterBooleanPref( |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 382 |
| 384 // Initialize preferences to currently saved state. | 383 // Initialize preferences to currently saved state. |
| 385 ApplyPreferences(REASON_INITIALIZATION, ""); | 384 ApplyPreferences(REASON_INITIALIZATION, ""); |
| 386 input_method_syncer_.reset( | 385 input_method_syncer_.reset( |
| 387 new input_method::InputMethodSyncer(prefs, ime_state_)); | 386 new input_method::InputMethodSyncer(prefs, ime_state_)); |
| 388 input_method_syncer_->Initialize(); | 387 input_method_syncer_->Initialize(); |
| 389 | 388 |
| 390 // If a guest is logged in, initialize the prefs as if this is the first | 389 // If a guest is logged in, initialize the prefs as if this is the first |
| 391 // login. For a regular user this is done in | 390 // login. For a regular user this is done in |
| 392 // UserSessionManager::InitProfilePreferences(). | 391 // UserSessionManager::InitProfilePreferences(). |
| 393 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) | 392 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 393 switches::kGuestSession)) |
| 394 session_manager->SetFirstLoginPrefs(profile, std::string(), std::string()); | 394 session_manager->SetFirstLoginPrefs(profile, std::string(), std::string()); |
| 395 } | 395 } |
| 396 | 396 |
| 397 void Preferences::InitUserPrefsForTesting( | 397 void Preferences::InitUserPrefsForTesting( |
| 398 PrefServiceSyncable* prefs, | 398 PrefServiceSyncable* prefs, |
| 399 const user_manager::User* user, | 399 const user_manager::User* user, |
| 400 scoped_refptr<input_method::InputMethodManager::State> ime_state) { | 400 scoped_refptr<input_method::InputMethodManager::State> ime_state) { |
| 401 user_ = user; | 401 user_ = user; |
| 402 ime_state_ = ime_state; | 402 ime_state_ = ime_state; |
| 403 | 403 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } | 609 } |
| 610 } | 610 } |
| 611 | 611 |
| 612 void Preferences::OnIsSyncingChanged() { | 612 void Preferences::OnIsSyncingChanged() { |
| 613 DVLOG(1) << "OnIsSyncingChanged"; | 613 DVLOG(1) << "OnIsSyncingChanged"; |
| 614 ForceNaturalScrollDefault(); | 614 ForceNaturalScrollDefault(); |
| 615 } | 615 } |
| 616 | 616 |
| 617 void Preferences::ForceNaturalScrollDefault() { | 617 void Preferences::ForceNaturalScrollDefault() { |
| 618 DVLOG(1) << "ForceNaturalScrollDefault"; | 618 DVLOG(1) << "ForceNaturalScrollDefault"; |
| 619 if (CommandLine::ForCurrentProcess()->HasSwitch( | 619 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 620 switches::kNaturalScrollDefault) && | 620 switches::kNaturalScrollDefault) && |
| 621 prefs_->IsSyncing() && | 621 prefs_->IsSyncing() && !prefs_->GetUserPrefValue(prefs::kNaturalScroll)) { |
| 622 !prefs_->GetUserPrefValue(prefs::kNaturalScroll)) { | |
| 623 DVLOG(1) << "Natural scroll forced to true"; | 622 DVLOG(1) << "Natural scroll forced to true"; |
| 624 natural_scroll_.SetValue(true); | 623 natural_scroll_.SetValue(true); |
| 625 UMA_HISTOGRAM_BOOLEAN("Touchpad.NaturalScroll.Forced", true); | 624 UMA_HISTOGRAM_BOOLEAN("Touchpad.NaturalScroll.Forced", true); |
| 626 } | 625 } |
| 627 } | 626 } |
| 628 | 627 |
| 629 void Preferences::SetLanguageConfigStringListAsCSV(const char* section, | 628 void Preferences::SetLanguageConfigStringListAsCSV(const char* section, |
| 630 const char* name, | 629 const char* name, |
| 631 const std::string& value) { | 630 const std::string& value) { |
| 632 VLOG(1) << "Setting " << name << " to '" << value << "'"; | 631 VLOG(1) << "Setting " << name << " to '" << value << "'"; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 touch_hud_projection_enabled_.SetValue(enabled); | 691 touch_hud_projection_enabled_.SetValue(enabled); |
| 693 } | 692 } |
| 694 | 693 |
| 695 void Preferences::ActiveUserChanged(const user_manager::User* active_user) { | 694 void Preferences::ActiveUserChanged(const user_manager::User* active_user) { |
| 696 if (active_user != user_) | 695 if (active_user != user_) |
| 697 return; | 696 return; |
| 698 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); | 697 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); |
| 699 } | 698 } |
| 700 | 699 |
| 701 } // namespace chromeos | 700 } // namespace chromeos |
| OLD | NEW |