Chromium Code Reviews| 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 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 866 base::Unretained(this))); | 866 base::Unretained(this))); |
| 867 user_pref_registrar_->Add( | 867 user_pref_registrar_->Add( |
| 868 prefs::kLanguageRemapSearchKeyTo, | 868 prefs::kLanguageRemapSearchKeyTo, |
| 869 base::Bind(&SystemTrayDelegate::OnLanguageRemapSearchKeyToChanged, | 869 base::Bind(&SystemTrayDelegate::OnLanguageRemapSearchKeyToChanged, |
| 870 base::Unretained(this))); | 870 base::Unretained(this))); |
| 871 user_pref_registrar_->Add( | 871 user_pref_registrar_->Add( |
| 872 prefs::kShowLogoutButtonInTray, | 872 prefs::kShowLogoutButtonInTray, |
| 873 base::Bind(&SystemTrayDelegate::UpdateShowLogoutButtonInTray, | 873 base::Bind(&SystemTrayDelegate::UpdateShowLogoutButtonInTray, |
| 874 base::Unretained(this))); | 874 base::Unretained(this))); |
| 875 user_pref_registrar_->Add( | 875 user_pref_registrar_->Add( |
| 876 prefs::kLogoutDialogDurationMs, | |
| 877 base::Bind(&SystemTrayDelegate::UpdateLogoutDialogDuration, | |
| 878 base::Unretained(this))); | |
| 879 user_pref_registrar_->Add( | |
| 876 prefs::kLargeCursorEnabled, | 880 prefs::kLargeCursorEnabled, |
| 877 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 881 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
| 878 base::Unretained(this), | 882 base::Unretained(this), |
| 879 ash::A11Y_NOTIFICATION_NONE)); | 883 ash::A11Y_NOTIFICATION_NONE)); |
| 880 user_pref_registrar_->Add( | 884 user_pref_registrar_->Add( |
| 881 prefs::kAutoclickEnabled, | 885 prefs::kAutoclickEnabled, |
| 882 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 886 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
| 883 base::Unretained(this), | 887 base::Unretained(this), |
| 884 ash::A11Y_NOTIFICATION_NONE)); | 888 ash::A11Y_NOTIFICATION_NONE)); |
| 885 user_pref_registrar_->Add( | 889 user_pref_registrar_->Add( |
| 886 prefs::kShouldAlwaysShowAccessibilityMenu, | 890 prefs::kShouldAlwaysShowAccessibilityMenu, |
| 887 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 891 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
| 888 base::Unretained(this), | 892 base::Unretained(this), |
| 889 ash::A11Y_NOTIFICATION_NONE)); | 893 ash::A11Y_NOTIFICATION_NONE)); |
| 890 user_pref_registrar_->Add( | 894 user_pref_registrar_->Add( |
| 891 prefs::kPerformanceTracingEnabled, | 895 prefs::kPerformanceTracingEnabled, |
| 892 base::Bind(&SystemTrayDelegate::UpdatePerformanceTracing, | 896 base::Bind(&SystemTrayDelegate::UpdatePerformanceTracing, |
| 893 base::Unretained(this))); | 897 base::Unretained(this))); |
| 894 | 898 |
| 895 UpdateClockType(); | 899 UpdateClockType(); |
| 896 UpdateShowLogoutButtonInTray(); | 900 UpdateShowLogoutButtonInTray(); |
| 901 UpdateLogoutDialogDuration(); | |
| 897 UpdatePerformanceTracing(); | 902 UpdatePerformanceTracing(); |
| 898 search_key_mapped_to_ = | 903 search_key_mapped_to_ = |
| 899 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); | 904 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); |
| 900 } | 905 } |
| 901 | 906 |
| 902 bool UnsetProfile(Profile* profile) { | 907 bool UnsetProfile(Profile* profile) { |
| 903 if (profile != user_profile_) | 908 if (profile != user_profile_) |
| 904 return false; | 909 return false; |
| 905 user_pref_registrar_.reset(); | 910 user_pref_registrar_.reset(); |
| 906 return true; | 911 return true; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 958 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) | 963 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) |
| 959 CrosSettings::Get()->SetBoolean(kSystemUse24HourClock, use_24_hour_clock); | 964 CrosSettings::Get()->SetBoolean(kSystemUse24HourClock, use_24_hour_clock); |
| 960 } | 965 } |
| 961 | 966 |
| 962 void UpdateShowLogoutButtonInTray() { | 967 void UpdateShowLogoutButtonInTray() { |
| 963 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( | 968 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( |
| 964 user_pref_registrar_->prefs()->GetBoolean( | 969 user_pref_registrar_->prefs()->GetBoolean( |
| 965 prefs::kShowLogoutButtonInTray)); | 970 prefs::kShowLogoutButtonInTray)); |
| 966 } | 971 } |
| 967 | 972 |
| 973 void UpdateLogoutDialogDuration() { | |
| 974 int duration_ms = user_pref_registrar_->prefs()->GetInteger( | |
|
bartfab (slow)
2013/12/10 12:41:16
Nit: const.
binjin
2013/12/12 13:56:55
Done.
| |
| 975 prefs::kLogoutDialogDurationMs); | |
| 976 GetSystemTrayNotifier()->NotifyLogoutDialogDurationChanged( | |
| 977 base::TimeDelta::FromMilliseconds(duration_ms)); | |
| 978 } | |
| 979 | |
| 968 void UpdateSessionStartTime() { | 980 void UpdateSessionStartTime() { |
| 969 const PrefService* local_state = local_state_registrar_->prefs(); | 981 const PrefService* local_state = local_state_registrar_->prefs(); |
| 970 if (local_state->HasPrefPath(prefs::kSessionStartTime)) { | 982 if (local_state->HasPrefPath(prefs::kSessionStartTime)) { |
| 971 have_session_start_time_ = true; | 983 have_session_start_time_ = true; |
| 972 session_start_time_ = base::TimeTicks::FromInternalValue( | 984 session_start_time_ = base::TimeTicks::FromInternalValue( |
| 973 local_state->GetInt64(prefs::kSessionStartTime)); | 985 local_state->GetInt64(prefs::kSessionStartTime)); |
| 974 } else { | 986 } else { |
| 975 have_session_start_time_ = false; | 987 have_session_start_time_ = false; |
| 976 session_start_time_ = base::TimeTicks(); | 988 session_start_time_ = base::TimeTicks(); |
| 977 } | 989 } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1238 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1250 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
| 1239 }; | 1251 }; |
| 1240 | 1252 |
| 1241 } // namespace | 1253 } // namespace |
| 1242 | 1254 |
| 1243 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1255 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1244 return new chromeos::SystemTrayDelegate(); | 1256 return new chromeos::SystemTrayDelegate(); |
| 1245 } | 1257 } |
| 1246 | 1258 |
| 1247 } // namespace chromeos | 1259 } // namespace chromeos |
| OLD | NEW |