| 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> |
| 11 | 11 |
| 12 #include "ash/ash_switches.h" | 12 #include "ash/ash_switches.h" |
| 13 #include "ash/desktop_background/desktop_background_controller.h" | 13 #include "ash/desktop_background/desktop_background_controller.h" |
| 14 #include "ash/metrics/user_metrics_recorder.h" | 14 #include "ash/metrics/user_metrics_recorder.h" |
| 15 #include "ash/session/session_state_delegate.h" | 15 #include "ash/session/session_state_delegate.h" |
| 16 #include "ash/session/session_state_observer.h" | 16 #include "ash/session/session_state_observer.h" |
| 17 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 18 #include "ash/shell_delegate.h" | 18 #include "ash/shell_delegate.h" |
| 19 #include "ash/shell_window_ids.h" | 19 #include "ash/shell_window_ids.h" |
| 20 #include "ash/system/bluetooth/bluetooth_observer.h" | 20 #include "ash/system/bluetooth/bluetooth_observer.h" |
| 21 #include "ash/system/chromeos/session/logout_button_observer.h" | 21 #include "ash/system/chromeos/session/logout_button_observer.h" |
| 22 #include "ash/system/chromeos/shutdown_policy_observer.h" |
| 22 #include "ash/system/date/clock_observer.h" | 23 #include "ash/system/date/clock_observer.h" |
| 23 #include "ash/system/ime/ime_observer.h" | 24 #include "ash/system/ime/ime_observer.h" |
| 24 #include "ash/system/tray/system_tray.h" | 25 #include "ash/system/tray/system_tray.h" |
| 25 #include "ash/system/tray/system_tray_delegate.h" | 26 #include "ash/system/tray/system_tray_delegate.h" |
| 26 #include "ash/system/tray/system_tray_notifier.h" | 27 #include "ash/system/tray/system_tray_notifier.h" |
| 27 #include "ash/system/tray_accessibility.h" | 28 #include "ash/system/tray_accessibility.h" |
| 28 #include "ash/system/user/login_status.h" | 29 #include "ash/system/user/login_status.h" |
| 29 #include "ash/system/user/update_observer.h" | 30 #include "ash/system/user/update_observer.h" |
| 30 #include "ash/system/user/user_observer.h" | 31 #include "ash/system/user/user_observer.h" |
| 31 #include "ash/volume_control_delegate.h" | 32 #include "ash/volume_control_delegate.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 registrar_->Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 226 registrar_->Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 226 content::NotificationService::AllSources()); | 227 content::NotificationService::AllSources()); |
| 227 | 228 |
| 228 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); | 229 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); |
| 229 CHECK(accessibility_manager); | 230 CHECK(accessibility_manager); |
| 230 accessibility_subscription_ = accessibility_manager->RegisterCallback( | 231 accessibility_subscription_ = accessibility_manager->RegisterCallback( |
| 231 base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged, | 232 base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged, |
| 232 base::Unretained(this))); | 233 base::Unretained(this))); |
| 233 | 234 |
| 234 user_manager::UserManager::Get()->AddSessionStateObserver(this); | 235 user_manager::UserManager::Get()->AddSessionStateObserver(this); |
| 236 shutdown_policy_handler_.reset( |
| 237 new ShutdownPolicyHandler(CrosSettings::Get(), this)); |
| 235 } | 238 } |
| 236 | 239 |
| 237 void SystemTrayDelegateChromeOS::Initialize() { | 240 void SystemTrayDelegateChromeOS::Initialize() { |
| 238 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); | 241 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); |
| 239 | 242 |
| 240 input_method::InputMethodManager::Get()->AddObserver(this); | 243 input_method::InputMethodManager::Get()->AddObserver(this); |
| 241 ui::ime::InputMethodMenuManager::GetInstance()->AddObserver(this); | 244 ui::ime::InputMethodMenuManager::GetInstance()->AddObserver(this); |
| 242 UpdateClockType(); | 245 UpdateClockType(); |
| 243 | 246 |
| 244 device::BluetoothAdapterFactory::GetAdapter( | 247 device::BluetoothAdapterFactory::GetAdapter( |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 void SystemTrayDelegateChromeOS::AddCustodianInfoTrayObserver( | 833 void SystemTrayDelegateChromeOS::AddCustodianInfoTrayObserver( |
| 831 ash::CustodianInfoTrayObserver* observer) { | 834 ash::CustodianInfoTrayObserver* observer) { |
| 832 custodian_info_changed_observers_.AddObserver(observer); | 835 custodian_info_changed_observers_.AddObserver(observer); |
| 833 } | 836 } |
| 834 | 837 |
| 835 void SystemTrayDelegateChromeOS::RemoveCustodianInfoTrayObserver( | 838 void SystemTrayDelegateChromeOS::RemoveCustodianInfoTrayObserver( |
| 836 ash::CustodianInfoTrayObserver* observer) { | 839 ash::CustodianInfoTrayObserver* observer) { |
| 837 custodian_info_changed_observers_.RemoveObserver(observer); | 840 custodian_info_changed_observers_.RemoveObserver(observer); |
| 838 } | 841 } |
| 839 | 842 |
| 843 void SystemTrayDelegateChromeOS::AddShutdownPolicyObserver( |
| 844 ash::ShutdownPolicyObserver* observer) { |
| 845 shutdown_policy_observers_.AddObserver(observer); |
| 846 } |
| 847 |
| 848 void SystemTrayDelegateChromeOS::RemoveShutdownPolicyObserver( |
| 849 ash::ShutdownPolicyObserver* observer) { |
| 850 shutdown_policy_observers_.RemoveObserver(observer); |
| 851 } |
| 852 |
| 853 void SystemTrayDelegateChromeOS::ShouldRebootOnShutdown( |
| 854 const ash::RebootOnShutdownCallback& callback) { |
| 855 shutdown_policy_handler_->CheckIfRebootOnShutdown(callback); |
| 856 } |
| 857 |
| 840 void SystemTrayDelegateChromeOS::UserAddedToSession( | 858 void SystemTrayDelegateChromeOS::UserAddedToSession( |
| 841 const user_manager::User* active_user) { | 859 const user_manager::User* active_user) { |
| 842 } | 860 } |
| 843 | 861 |
| 844 void SystemTrayDelegateChromeOS::ActiveUserChanged( | 862 void SystemTrayDelegateChromeOS::ActiveUserChanged( |
| 845 const user_manager::User* /* active_user */) { | 863 const user_manager::User* /* active_user */) { |
| 846 } | 864 } |
| 847 | 865 |
| 848 void SystemTrayDelegateChromeOS::UserChangedChildStatus( | 866 void SystemTrayDelegateChromeOS::UserChangedChildStatus( |
| 849 user_manager::User* user) { | 867 user_manager::User* user) { |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 } | 1333 } |
| 1316 | 1334 |
| 1317 void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged( | 1335 void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged( |
| 1318 const AccessibilityStatusEventDetails& details) { | 1336 const AccessibilityStatusEventDetails& details) { |
| 1319 if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN) | 1337 if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN) |
| 1320 accessibility_subscription_.reset(); | 1338 accessibility_subscription_.reset(); |
| 1321 else | 1339 else |
| 1322 OnAccessibilityModeChanged(details.notify); | 1340 OnAccessibilityModeChanged(details.notify); |
| 1323 } | 1341 } |
| 1324 | 1342 |
| 1343 void SystemTrayDelegateChromeOS::OnShutdownPolicyChanged( |
| 1344 bool reboot_on_shutdown) { |
| 1345 // Notify all observers. |
| 1346 FOR_EACH_OBSERVER(ash::ShutdownPolicyObserver, shutdown_policy_observers_, |
| 1347 OnShutdownPolicyChanged(reboot_on_shutdown)); |
| 1348 } |
| 1349 |
| 1325 const base::string16 | 1350 const base::string16 |
| 1326 SystemTrayDelegateChromeOS::GetLegacySupervisedUserMessage() const { | 1351 SystemTrayDelegateChromeOS::GetLegacySupervisedUserMessage() const { |
| 1327 std::string user_manager_name = GetSupervisedUserManager(); | 1352 std::string user_manager_name = GetSupervisedUserManager(); |
| 1328 return l10n_util::GetStringFUTF16( | 1353 return l10n_util::GetStringFUTF16( |
| 1329 IDS_USER_IS_SUPERVISED_BY_NOTICE, | 1354 IDS_USER_IS_SUPERVISED_BY_NOTICE, |
| 1330 base::UTF8ToUTF16(user_manager_name)); | 1355 base::UTF8ToUTF16(user_manager_name)); |
| 1331 } | 1356 } |
| 1332 | 1357 |
| 1333 const base::string16 | 1358 const base::string16 |
| 1334 SystemTrayDelegateChromeOS::GetChildUserMessage() const { | 1359 SystemTrayDelegateChromeOS::GetChildUserMessage() const { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1355 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1380 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 1356 << "ENABLE_SUPERVISED_USERS undefined."; | 1381 << "ENABLE_SUPERVISED_USERS undefined."; |
| 1357 return base::string16(); | 1382 return base::string16(); |
| 1358 } | 1383 } |
| 1359 | 1384 |
| 1360 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1385 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1361 return new SystemTrayDelegateChromeOS(); | 1386 return new SystemTrayDelegateChromeOS(); |
| 1362 } | 1387 } |
| 1363 | 1388 |
| 1364 } // namespace chromeos | 1389 } // namespace chromeos |
| OLD | NEW |