| 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/system/ash_system_tray_delegate.h" | 5 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 base::Unretained(this))); | 854 base::Unretained(this))); |
| 855 user_pref_registrar_->Add( | 855 user_pref_registrar_->Add( |
| 856 prefs::kLanguageRemapSearchKeyTo, | 856 prefs::kLanguageRemapSearchKeyTo, |
| 857 base::Bind(&SystemTrayDelegate::OnLanguageRemapSearchKeyToChanged, | 857 base::Bind(&SystemTrayDelegate::OnLanguageRemapSearchKeyToChanged, |
| 858 base::Unretained(this))); | 858 base::Unretained(this))); |
| 859 user_pref_registrar_->Add( | 859 user_pref_registrar_->Add( |
| 860 prefs::kShowLogoutButtonInTray, | 860 prefs::kShowLogoutButtonInTray, |
| 861 base::Bind(&SystemTrayDelegate::UpdateShowLogoutButtonInTray, | 861 base::Bind(&SystemTrayDelegate::UpdateShowLogoutButtonInTray, |
| 862 base::Unretained(this))); | 862 base::Unretained(this))); |
| 863 user_pref_registrar_->Add( | 863 user_pref_registrar_->Add( |
| 864 prefs::kLogoutDialogDurationMs, |
| 865 base::Bind(&SystemTrayDelegate::UpdateLogoutDialogDuration, |
| 866 base::Unretained(this))); |
| 867 user_pref_registrar_->Add( |
| 864 prefs::kLargeCursorEnabled, | 868 prefs::kLargeCursorEnabled, |
| 865 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 869 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
| 866 base::Unretained(this), | 870 base::Unretained(this), |
| 867 ash::A11Y_NOTIFICATION_NONE)); | 871 ash::A11Y_NOTIFICATION_NONE)); |
| 868 user_pref_registrar_->Add( | 872 user_pref_registrar_->Add( |
| 869 prefs::kShouldAlwaysShowAccessibilityMenu, | 873 prefs::kShouldAlwaysShowAccessibilityMenu, |
| 870 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 874 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
| 871 base::Unretained(this), | 875 base::Unretained(this), |
| 872 ash::A11Y_NOTIFICATION_NONE)); | 876 ash::A11Y_NOTIFICATION_NONE)); |
| 873 user_pref_registrar_->Add( | 877 user_pref_registrar_->Add( |
| 874 prefs::kPerformanceTracingEnabled, | 878 prefs::kPerformanceTracingEnabled, |
| 875 base::Bind(&SystemTrayDelegate::UpdatePerformanceTracing, | 879 base::Bind(&SystemTrayDelegate::UpdatePerformanceTracing, |
| 876 base::Unretained(this))); | 880 base::Unretained(this))); |
| 877 | 881 |
| 878 UpdateClockType(); | 882 UpdateClockType(); |
| 879 UpdateShowLogoutButtonInTray(); | 883 UpdateShowLogoutButtonInTray(); |
| 884 UpdateLogoutDialogDuration(); |
| 880 UpdatePerformanceTracing(); | 885 UpdatePerformanceTracing(); |
| 881 search_key_mapped_to_ = | 886 search_key_mapped_to_ = |
| 882 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); | 887 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); |
| 883 } | 888 } |
| 884 | 889 |
| 885 bool UnsetProfile(Profile* profile) { | 890 bool UnsetProfile(Profile* profile) { |
| 886 if (profile != user_profile_) | 891 if (profile != user_profile_) |
| 887 return false; | 892 return false; |
| 888 user_pref_registrar_.reset(); | 893 user_pref_registrar_.reset(); |
| 889 return true; | 894 return true; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) | 946 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) |
| 942 CrosSettings::Get()->SetBoolean(kSystemUse24HourClock, use_24_hour_clock); | 947 CrosSettings::Get()->SetBoolean(kSystemUse24HourClock, use_24_hour_clock); |
| 943 } | 948 } |
| 944 | 949 |
| 945 void UpdateShowLogoutButtonInTray() { | 950 void UpdateShowLogoutButtonInTray() { |
| 946 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( | 951 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( |
| 947 user_pref_registrar_->prefs()->GetBoolean( | 952 user_pref_registrar_->prefs()->GetBoolean( |
| 948 prefs::kShowLogoutButtonInTray)); | 953 prefs::kShowLogoutButtonInTray)); |
| 949 } | 954 } |
| 950 | 955 |
| 956 void UpdateLogoutDialogDuration() { |
| 957 GetSystemTrayNotifier()->NotifyLogoutDialogDurationChanged( |
| 958 user_pref_registrar_->prefs()->GetInteger( |
| 959 prefs::kLogoutDialogDurationMs)); |
| 960 } |
| 961 |
| 951 void UpdateSessionStartTime() { | 962 void UpdateSessionStartTime() { |
| 952 const PrefService* local_state = local_state_registrar_->prefs(); | 963 const PrefService* local_state = local_state_registrar_->prefs(); |
| 953 if (local_state->HasPrefPath(prefs::kSessionStartTime)) { | 964 if (local_state->HasPrefPath(prefs::kSessionStartTime)) { |
| 954 have_session_start_time_ = true; | 965 have_session_start_time_ = true; |
| 955 session_start_time_ = base::TimeTicks::FromInternalValue( | 966 session_start_time_ = base::TimeTicks::FromInternalValue( |
| 956 local_state->GetInt64(prefs::kSessionStartTime)); | 967 local_state->GetInt64(prefs::kSessionStartTime)); |
| 957 } else { | 968 } else { |
| 958 have_session_start_time_ = false; | 969 have_session_start_time_ = false; |
| 959 session_start_time_ = base::TimeTicks(); | 970 session_start_time_ = base::TimeTicks(); |
| 960 } | 971 } |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1225 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
| 1215 }; | 1226 }; |
| 1216 | 1227 |
| 1217 } // namespace | 1228 } // namespace |
| 1218 | 1229 |
| 1219 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1230 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1220 return new chromeos::SystemTrayDelegate(); | 1231 return new chromeos::SystemTrayDelegate(); |
| 1221 } | 1232 } |
| 1222 | 1233 |
| 1223 } // namespace chromeos | 1234 } // namespace chromeos |
| OLD | NEW |