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/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 393 } |
394 | 394 |
395 void Preferences::OnPreferenceChanged(const std::string& pref_name) { | 395 void Preferences::OnPreferenceChanged(const std::string& pref_name) { |
396 ApplyPreferences(REASON_PREF_CHANGED, pref_name); | 396 ApplyPreferences(REASON_PREF_CHANGED, pref_name); |
397 } | 397 } |
398 | 398 |
399 void Preferences::ApplyPreferences(ApplyReason reason, | 399 void Preferences::ApplyPreferences(ApplyReason reason, |
400 const std::string& pref_name) { | 400 const std::string& pref_name) { |
401 DCHECK(reason != REASON_PREF_CHANGED || !pref_name.empty()); | 401 DCHECK(reason != REASON_PREF_CHANGED || !pref_name.empty()); |
402 const bool user_is_owner = | 402 const bool user_is_owner = |
403 user_manager::UserManager::Get()->GetOwnerAccountId() == | 403 user_manager::UserManager::Get()->GetOwnerEmail() == user_->email(); |
404 user_->GetAccountId(); | |
405 const bool user_is_active = user_->is_active(); | 404 const bool user_is_active = user_->is_active(); |
406 | 405 |
407 system::TouchpadSettings touchpad_settings; | 406 system::TouchpadSettings touchpad_settings; |
408 system::MouseSettings mouse_settings; | 407 system::MouseSettings mouse_settings; |
409 | 408 |
410 if (user_is_primary_ && (reason == REASON_INITIALIZATION || | 409 if (user_is_primary_ && (reason == REASON_INITIALIZATION || |
411 pref_name == prefs::kPerformanceTracingEnabled)) { | 410 pref_name == prefs::kPerformanceTracingEnabled)) { |
412 const bool enabled = performance_tracing_enabled_.GetValue(); | 411 const bool enabled = performance_tracing_enabled_.GetValue(); |
413 if (enabled) | 412 if (enabled) |
414 tracing_manager_ = TracingManager::Create(); | 413 tracing_manager_ = TracingManager::Create(); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 TimeZoneResolver::kLastTimeZoneRefreshTime); | 618 TimeZoneResolver::kLastTimeZoneRefreshTime); |
620 } | 619 } |
621 } | 620 } |
622 } | 621 } |
623 } | 622 } |
624 | 623 |
625 if (pref_name == prefs::kUse24HourClock || | 624 if (pref_name == prefs::kUse24HourClock || |
626 reason != REASON_ACTIVE_USER_CHANGED) { | 625 reason != REASON_ACTIVE_USER_CHANGED) { |
627 const bool value = prefs_->GetBoolean(prefs::kUse24HourClock); | 626 const bool value = prefs_->GetBoolean(prefs::kUse24HourClock); |
628 user_manager::UserManager::Get()->SetKnownUserBooleanPref( | 627 user_manager::UserManager::Get()->SetKnownUserBooleanPref( |
629 user_->GetAccountId(), prefs::kUse24HourClock, value); | 628 user_->GetUserID(), prefs::kUse24HourClock, value); |
630 } | 629 } |
631 } | 630 } |
632 | 631 |
633 void Preferences::OnIsSyncingChanged() { | 632 void Preferences::OnIsSyncingChanged() { |
634 DVLOG(1) << "OnIsSyncingChanged"; | 633 DVLOG(1) << "OnIsSyncingChanged"; |
635 ForceNaturalScrollDefault(); | 634 ForceNaturalScrollDefault(); |
636 } | 635 } |
637 | 636 |
638 void Preferences::ForceNaturalScrollDefault() { | 637 void Preferences::ForceNaturalScrollDefault() { |
639 DVLOG(1) << "ForceNaturalScrollDefault"; | 638 DVLOG(1) << "ForceNaturalScrollDefault"; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 touch_hud_projection_enabled_.SetValue(enabled); | 713 touch_hud_projection_enabled_.SetValue(enabled); |
715 } | 714 } |
716 | 715 |
717 void Preferences::ActiveUserChanged(const user_manager::User* active_user) { | 716 void Preferences::ActiveUserChanged(const user_manager::User* active_user) { |
718 if (active_user != user_) | 717 if (active_user != user_) |
719 return; | 718 return; |
720 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); | 719 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); |
721 } | 720 } |
722 | 721 |
723 } // namespace chromeos | 722 } // namespace chromeos |
OLD | NEW |