| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <utility> | 12 #include <utility> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "ash/common/login_status.h" | 15 #include "ash/common/login_status.h" |
| 16 #include "ash/common/session/session_state_delegate.h" | 16 #include "ash/common/session/session_state_delegate.h" |
| 17 #include "ash/common/session/session_state_observer.h" | 17 #include "ash/common/session/session_state_observer.h" |
| 18 #include "ash/common/shell_delegate.h" | 18 #include "ash/common/shell_delegate.h" |
| 19 #include "ash/common/system/chromeos/bluetooth/bluetooth_observer.h" | 19 #include "ash/common/system/chromeos/bluetooth/bluetooth_observer.h" |
| 20 #include "ash/common/system/chromeos/power/power_status.h" | 20 #include "ash/common/system/chromeos/power/power_status.h" |
| 21 #include "ash/common/system/chromeos/session/logout_button_observer.h" | 21 #include "ash/common/system/chromeos/session/logout_button_observer.h" |
| 22 #include "ash/common/system/chromeos/shutdown_policy_observer.h" | |
| 23 #include "ash/common/system/date/clock_observer.h" | 22 #include "ash/common/system/date/clock_observer.h" |
| 24 #include "ash/common/system/ime/ime_observer.h" | 23 #include "ash/common/system/ime/ime_observer.h" |
| 25 #include "ash/common/system/tray/system_tray_notifier.h" | 24 #include "ash/common/system/tray/system_tray_notifier.h" |
| 26 #include "ash/common/system/tray_accessibility.h" | 25 #include "ash/common/system/tray_accessibility.h" |
| 27 #include "ash/common/system/update/update_observer.h" | 26 #include "ash/common/system/update/update_observer.h" |
| 28 #include "ash/common/system/user/user_observer.h" | 27 #include "ash/common/system/user/user_observer.h" |
| 29 #include "ash/common/wm_shell.h" | 28 #include "ash/common/wm_shell.h" |
| 30 #include "ash/system/chromeos/rotation/tray_rotation_lock.h" | 29 #include "ash/system/chromeos/rotation/tray_rotation_lock.h" |
| 31 #include "base/bind_helpers.h" | 30 #include "base/bind_helpers.h" |
| 32 #include "base/callback.h" | 31 #include "base/callback.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 48 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 47 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
| 49 #include "chrome/browser/chromeos/login/login_wizard.h" | 48 #include "chrome/browser/chromeos/login/login_wizard.h" |
| 50 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 49 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 51 #include "chrome/browser/chromeos/login/user_flow.h" | 50 #include "chrome/browser/chromeos/login/user_flow.h" |
| 52 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 51 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 53 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 52 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 54 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 53 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 55 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 54 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 56 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" | 55 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" |
| 57 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 56 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 58 #include "chrome/browser/chromeos/settings/cros_settings.h" | |
| 59 #include "chrome/browser/lifetime/application_lifetime.h" | 57 #include "chrome/browser/lifetime/application_lifetime.h" |
| 60 #include "chrome/browser/profiles/profile_manager.h" | 58 #include "chrome/browser/profiles/profile_manager.h" |
| 61 #include "chrome/browser/supervised_user/supervised_user_service.h" | 59 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 62 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 60 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 63 #include "chrome/browser/ui/ash/cast_config_delegate_media_router.h" | 61 #include "chrome/browser/ui/ash/cast_config_delegate_media_router.h" |
| 64 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 62 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 65 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" | 63 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" |
| 66 #include "chrome/browser/ui/ash/system_tray_client.h" | 64 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 67 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" | 65 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" |
| 68 #include "chrome/browser/ui/ash/vpn_delegate_chromeos.h" | 66 #include "chrome/browser/ui/ash/vpn_delegate_chromeos.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 chrome::NOTIFICATION_PROFILE_DESTROYED, | 166 chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 169 content::NotificationService::AllSources()); | 167 content::NotificationService::AllSources()); |
| 170 | 168 |
| 171 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); | 169 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); |
| 172 CHECK(accessibility_manager); | 170 CHECK(accessibility_manager); |
| 173 accessibility_subscription_ = accessibility_manager->RegisterCallback( | 171 accessibility_subscription_ = accessibility_manager->RegisterCallback( |
| 174 base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged, | 172 base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged, |
| 175 base::Unretained(this))); | 173 base::Unretained(this))); |
| 176 | 174 |
| 177 user_manager::UserManager::Get()->AddSessionStateObserver(this); | 175 user_manager::UserManager::Get()->AddSessionStateObserver(this); |
| 178 shutdown_policy_handler_.reset( | |
| 179 new ShutdownPolicyHandler(CrosSettings::Get(), this)); | |
| 180 } | 176 } |
| 181 | 177 |
| 182 void SystemTrayDelegateChromeOS::Initialize() { | 178 void SystemTrayDelegateChromeOS::Initialize() { |
| 183 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); | 179 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); |
| 184 | 180 |
| 185 input_method::InputMethodManager::Get()->AddObserver(this); | 181 input_method::InputMethodManager::Get()->AddObserver(this); |
| 186 input_method::InputMethodManager::Get()->AddImeMenuObserver(this); | 182 input_method::InputMethodManager::Get()->AddImeMenuObserver(this); |
| 187 ui::ime::InputMethodMenuManager::GetInstance()->AddObserver(this); | 183 ui::ime::InputMethodMenuManager::GetInstance()->AddObserver(this); |
| 188 | 184 |
| 189 device::BluetoothAdapterFactory::GetAdapter( | 185 device::BluetoothAdapterFactory::GetAdapter( |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 void SystemTrayDelegateChromeOS::AddCustodianInfoTrayObserver( | 588 void SystemTrayDelegateChromeOS::AddCustodianInfoTrayObserver( |
| 593 ash::CustodianInfoTrayObserver* observer) { | 589 ash::CustodianInfoTrayObserver* observer) { |
| 594 custodian_info_changed_observers_.AddObserver(observer); | 590 custodian_info_changed_observers_.AddObserver(observer); |
| 595 } | 591 } |
| 596 | 592 |
| 597 void SystemTrayDelegateChromeOS::RemoveCustodianInfoTrayObserver( | 593 void SystemTrayDelegateChromeOS::RemoveCustodianInfoTrayObserver( |
| 598 ash::CustodianInfoTrayObserver* observer) { | 594 ash::CustodianInfoTrayObserver* observer) { |
| 599 custodian_info_changed_observers_.RemoveObserver(observer); | 595 custodian_info_changed_observers_.RemoveObserver(observer); |
| 600 } | 596 } |
| 601 | 597 |
| 602 void SystemTrayDelegateChromeOS::AddShutdownPolicyObserver( | |
| 603 ash::ShutdownPolicyObserver* observer) { | |
| 604 shutdown_policy_observers_.AddObserver(observer); | |
| 605 } | |
| 606 | |
| 607 void SystemTrayDelegateChromeOS::RemoveShutdownPolicyObserver( | |
| 608 ash::ShutdownPolicyObserver* observer) { | |
| 609 shutdown_policy_observers_.RemoveObserver(observer); | |
| 610 } | |
| 611 | |
| 612 void SystemTrayDelegateChromeOS::ShouldRebootOnShutdown( | |
| 613 const ash::RebootOnShutdownCallback& callback) { | |
| 614 shutdown_policy_handler_->CheckIfRebootOnShutdown(callback); | |
| 615 } | |
| 616 | |
| 617 ash::VPNDelegate* SystemTrayDelegateChromeOS::GetVPNDelegate() const { | 598 ash::VPNDelegate* SystemTrayDelegateChromeOS::GetVPNDelegate() const { |
| 618 return vpn_delegate_.get(); | 599 return vpn_delegate_.get(); |
| 619 } | 600 } |
| 620 | 601 |
| 621 std::unique_ptr<ash::SystemTrayItem> | 602 std::unique_ptr<ash::SystemTrayItem> |
| 622 SystemTrayDelegateChromeOS::CreateRotationLockTrayItem(ash::SystemTray* tray) { | 603 SystemTrayDelegateChromeOS::CreateRotationLockTrayItem(ash::SystemTray* tray) { |
| 623 return base::MakeUnique<ash::TrayRotationLock>(tray); | 604 return base::MakeUnique<ash::TrayRotationLock>(tray); |
| 624 } | 605 } |
| 625 | 606 |
| 626 void SystemTrayDelegateChromeOS::UserAddedToSession( | 607 void SystemTrayDelegateChromeOS::UserAddedToSession( |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 } | 991 } |
| 1011 | 992 |
| 1012 void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged( | 993 void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged( |
| 1013 const AccessibilityStatusEventDetails& details) { | 994 const AccessibilityStatusEventDetails& details) { |
| 1014 if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN) | 995 if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN) |
| 1015 accessibility_subscription_.reset(); | 996 accessibility_subscription_.reset(); |
| 1016 else | 997 else |
| 1017 OnAccessibilityModeChanged(details.notify); | 998 OnAccessibilityModeChanged(details.notify); |
| 1018 } | 999 } |
| 1019 | 1000 |
| 1020 void SystemTrayDelegateChromeOS::OnShutdownPolicyChanged( | |
| 1021 bool reboot_on_shutdown) { | |
| 1022 // Notify all observers. | |
| 1023 for (ash::ShutdownPolicyObserver& observer : shutdown_policy_observers_) | |
| 1024 observer.OnShutdownPolicyChanged(reboot_on_shutdown); | |
| 1025 } | |
| 1026 | |
| 1027 void SystemTrayDelegateChromeOS::ImeMenuActivationChanged(bool is_active) { | 1001 void SystemTrayDelegateChromeOS::ImeMenuActivationChanged(bool is_active) { |
| 1028 GetSystemTrayNotifier()->NotifyRefreshIMEMenu(is_active); | 1002 GetSystemTrayNotifier()->NotifyRefreshIMEMenu(is_active); |
| 1029 } | 1003 } |
| 1030 | 1004 |
| 1031 void SystemTrayDelegateChromeOS::ImeMenuListChanged() {} | 1005 void SystemTrayDelegateChromeOS::ImeMenuListChanged() {} |
| 1032 | 1006 |
| 1033 void SystemTrayDelegateChromeOS::ImeMenuItemsChanged( | 1007 void SystemTrayDelegateChromeOS::ImeMenuItemsChanged( |
| 1034 const std::string& engine_id, | 1008 const std::string& engine_id, |
| 1035 const std::vector<input_method::InputMethodManager::MenuItem>& items) {} | 1009 const std::vector<input_method::InputMethodManager::MenuItem>& items) {} |
| 1036 | 1010 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1067 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1041 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 1068 << "ENABLE_SUPERVISED_USERS undefined."; | 1042 << "ENABLE_SUPERVISED_USERS undefined."; |
| 1069 return base::string16(); | 1043 return base::string16(); |
| 1070 } | 1044 } |
| 1071 | 1045 |
| 1072 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1046 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1073 return new SystemTrayDelegateChromeOS(); | 1047 return new SystemTrayDelegateChromeOS(); |
| 1074 } | 1048 } |
| 1075 | 1049 |
| 1076 } // namespace chromeos | 1050 } // namespace chromeos |
| OLD | NEW |