OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/ash/system_tray_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.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 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 base::Unretained(this))); | 902 base::Unretained(this))); |
903 user_pref_registrar_->Add( | 903 user_pref_registrar_->Add( |
904 prefs::kLanguageRemapSearchKeyTo, | 904 prefs::kLanguageRemapSearchKeyTo, |
905 base::Bind(&SystemTrayDelegate::OnLanguageRemapSearchKeyToChanged, | 905 base::Bind(&SystemTrayDelegate::OnLanguageRemapSearchKeyToChanged, |
906 base::Unretained(this))); | 906 base::Unretained(this))); |
907 user_pref_registrar_->Add( | 907 user_pref_registrar_->Add( |
908 prefs::kShowLogoutButtonInTray, | 908 prefs::kShowLogoutButtonInTray, |
909 base::Bind(&SystemTrayDelegate::UpdateShowLogoutButtonInTray, | 909 base::Bind(&SystemTrayDelegate::UpdateShowLogoutButtonInTray, |
910 base::Unretained(this))); | 910 base::Unretained(this))); |
911 user_pref_registrar_->Add( | 911 user_pref_registrar_->Add( |
| 912 prefs::kLogoutDialogDurationMs, |
| 913 base::Bind(&SystemTrayDelegate::UpdateLogoutDialogDuration, |
| 914 base::Unretained(this))); |
| 915 user_pref_registrar_->Add( |
912 prefs::kLargeCursorEnabled, | 916 prefs::kLargeCursorEnabled, |
913 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 917 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
914 base::Unretained(this), | 918 base::Unretained(this), |
915 ash::A11Y_NOTIFICATION_NONE)); | 919 ash::A11Y_NOTIFICATION_NONE)); |
916 user_pref_registrar_->Add( | 920 user_pref_registrar_->Add( |
917 prefs::kAutoclickEnabled, | 921 prefs::kAutoclickEnabled, |
918 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 922 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
919 base::Unretained(this), | 923 base::Unretained(this), |
920 ash::A11Y_NOTIFICATION_NONE)); | 924 ash::A11Y_NOTIFICATION_NONE)); |
921 user_pref_registrar_->Add( | 925 user_pref_registrar_->Add( |
922 prefs::kShouldAlwaysShowAccessibilityMenu, | 926 prefs::kShouldAlwaysShowAccessibilityMenu, |
923 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, | 927 base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged, |
924 base::Unretained(this), | 928 base::Unretained(this), |
925 ash::A11Y_NOTIFICATION_NONE)); | 929 ash::A11Y_NOTIFICATION_NONE)); |
926 user_pref_registrar_->Add( | 930 user_pref_registrar_->Add( |
927 prefs::kPerformanceTracingEnabled, | 931 prefs::kPerformanceTracingEnabled, |
928 base::Bind(&SystemTrayDelegate::UpdatePerformanceTracing, | 932 base::Bind(&SystemTrayDelegate::UpdatePerformanceTracing, |
929 base::Unretained(this))); | 933 base::Unretained(this))); |
930 | 934 |
931 UpdateClockType(); | 935 UpdateClockType(); |
932 UpdateShowLogoutButtonInTray(); | 936 UpdateShowLogoutButtonInTray(); |
| 937 UpdateLogoutDialogDuration(); |
933 UpdatePerformanceTracing(); | 938 UpdatePerformanceTracing(); |
934 search_key_mapped_to_ = | 939 search_key_mapped_to_ = |
935 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); | 940 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); |
936 } | 941 } |
937 | 942 |
938 bool UnsetProfile(Profile* profile) { | 943 bool UnsetProfile(Profile* profile) { |
939 if (profile != user_profile_) | 944 if (profile != user_profile_) |
940 return false; | 945 return false; |
941 user_pref_registrar_.reset(); | 946 user_pref_registrar_.reset(); |
942 return true; | 947 return true; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) | 999 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) |
995 CrosSettings::Get()->SetBoolean(kSystemUse24HourClock, use_24_hour_clock); | 1000 CrosSettings::Get()->SetBoolean(kSystemUse24HourClock, use_24_hour_clock); |
996 } | 1001 } |
997 | 1002 |
998 void UpdateShowLogoutButtonInTray() { | 1003 void UpdateShowLogoutButtonInTray() { |
999 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( | 1004 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( |
1000 user_pref_registrar_->prefs()->GetBoolean( | 1005 user_pref_registrar_->prefs()->GetBoolean( |
1001 prefs::kShowLogoutButtonInTray)); | 1006 prefs::kShowLogoutButtonInTray)); |
1002 } | 1007 } |
1003 | 1008 |
| 1009 void UpdateLogoutDialogDuration() { |
| 1010 const int duration_ms = user_pref_registrar_->prefs()->GetInteger( |
| 1011 prefs::kLogoutDialogDurationMs); |
| 1012 GetSystemTrayNotifier()->NotifyLogoutDialogDurationChanged( |
| 1013 base::TimeDelta::FromMilliseconds(duration_ms)); |
| 1014 } |
| 1015 |
1004 void UpdateSessionStartTime() { | 1016 void UpdateSessionStartTime() { |
1005 const PrefService* local_state = local_state_registrar_->prefs(); | 1017 const PrefService* local_state = local_state_registrar_->prefs(); |
1006 if (local_state->HasPrefPath(prefs::kSessionStartTime)) { | 1018 if (local_state->HasPrefPath(prefs::kSessionStartTime)) { |
1007 have_session_start_time_ = true; | 1019 have_session_start_time_ = true; |
1008 session_start_time_ = base::TimeTicks::FromInternalValue( | 1020 session_start_time_ = base::TimeTicks::FromInternalValue( |
1009 local_state->GetInt64(prefs::kSessionStartTime)); | 1021 local_state->GetInt64(prefs::kSessionStartTime)); |
1010 } else { | 1022 } else { |
1011 have_session_start_time_ = false; | 1023 have_session_start_time_ = false; |
1012 session_start_time_ = base::TimeTicks(); | 1024 session_start_time_ = base::TimeTicks(); |
1013 } | 1025 } |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1298 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1287 }; | 1299 }; |
1288 | 1300 |
1289 } // namespace | 1301 } // namespace |
1290 | 1302 |
1291 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1303 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1292 return new chromeos::SystemTrayDelegate(); | 1304 return new chromeos::SystemTrayDelegate(); |
1293 } | 1305 } |
1294 | 1306 |
1295 } // namespace chromeos | 1307 } // namespace chromeos |
OLD | NEW |