| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 void SystemTrayDelegateChromeOS::AddCustodianInfoTrayObserver( | 582 void SystemTrayDelegateChromeOS::AddCustodianInfoTrayObserver( |
| 587 ash::CustodianInfoTrayObserver* observer) { | 583 ash::CustodianInfoTrayObserver* observer) { |
| 588 custodian_info_changed_observers_.AddObserver(observer); | 584 custodian_info_changed_observers_.AddObserver(observer); |
| 589 } | 585 } |
| 590 | 586 |
| 591 void SystemTrayDelegateChromeOS::RemoveCustodianInfoTrayObserver( | 587 void SystemTrayDelegateChromeOS::RemoveCustodianInfoTrayObserver( |
| 592 ash::CustodianInfoTrayObserver* observer) { | 588 ash::CustodianInfoTrayObserver* observer) { |
| 593 custodian_info_changed_observers_.RemoveObserver(observer); | 589 custodian_info_changed_observers_.RemoveObserver(observer); |
| 594 } | 590 } |
| 595 | 591 |
| 596 void SystemTrayDelegateChromeOS::AddShutdownPolicyObserver( | |
| 597 ash::ShutdownPolicyObserver* observer) { | |
| 598 shutdown_policy_observers_.AddObserver(observer); | |
| 599 } | |
| 600 | |
| 601 void SystemTrayDelegateChromeOS::RemoveShutdownPolicyObserver( | |
| 602 ash::ShutdownPolicyObserver* observer) { | |
| 603 shutdown_policy_observers_.RemoveObserver(observer); | |
| 604 } | |
| 605 | |
| 606 void SystemTrayDelegateChromeOS::ShouldRebootOnShutdown( | |
| 607 const ash::RebootOnShutdownCallback& callback) { | |
| 608 shutdown_policy_handler_->CheckIfRebootOnShutdown(callback); | |
| 609 } | |
| 610 | |
| 611 ash::VPNDelegate* SystemTrayDelegateChromeOS::GetVPNDelegate() const { | 592 ash::VPNDelegate* SystemTrayDelegateChromeOS::GetVPNDelegate() const { |
| 612 return vpn_delegate_.get(); | 593 return vpn_delegate_.get(); |
| 613 } | 594 } |
| 614 | 595 |
| 615 std::unique_ptr<ash::SystemTrayItem> | 596 std::unique_ptr<ash::SystemTrayItem> |
| 616 SystemTrayDelegateChromeOS::CreateRotationLockTrayItem(ash::SystemTray* tray) { | 597 SystemTrayDelegateChromeOS::CreateRotationLockTrayItem(ash::SystemTray* tray) { |
| 617 return base::MakeUnique<ash::TrayRotationLock>(tray); | 598 return base::MakeUnique<ash::TrayRotationLock>(tray); |
| 618 } | 599 } |
| 619 | 600 |
| 620 void SystemTrayDelegateChromeOS::UserAddedToSession( | 601 void SystemTrayDelegateChromeOS::UserAddedToSession( |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 } | 955 } |
| 975 | 956 |
| 976 void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged( | 957 void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged( |
| 977 const AccessibilityStatusEventDetails& details) { | 958 const AccessibilityStatusEventDetails& details) { |
| 978 if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN) | 959 if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN) |
| 979 accessibility_subscription_.reset(); | 960 accessibility_subscription_.reset(); |
| 980 else | 961 else |
| 981 OnAccessibilityModeChanged(details.notify); | 962 OnAccessibilityModeChanged(details.notify); |
| 982 } | 963 } |
| 983 | 964 |
| 984 void SystemTrayDelegateChromeOS::OnShutdownPolicyChanged( | |
| 985 bool reboot_on_shutdown) { | |
| 986 // Notify all observers. | |
| 987 for (ash::ShutdownPolicyObserver& observer : shutdown_policy_observers_) | |
| 988 observer.OnShutdownPolicyChanged(reboot_on_shutdown); | |
| 989 } | |
| 990 | |
| 991 void SystemTrayDelegateChromeOS::ImeMenuActivationChanged(bool is_active) { | 965 void SystemTrayDelegateChromeOS::ImeMenuActivationChanged(bool is_active) { |
| 992 GetSystemTrayNotifier()->NotifyRefreshIMEMenu(is_active); | 966 GetSystemTrayNotifier()->NotifyRefreshIMEMenu(is_active); |
| 993 } | 967 } |
| 994 | 968 |
| 995 void SystemTrayDelegateChromeOS::ImeMenuListChanged() {} | 969 void SystemTrayDelegateChromeOS::ImeMenuListChanged() {} |
| 996 | 970 |
| 997 void SystemTrayDelegateChromeOS::ImeMenuItemsChanged( | 971 void SystemTrayDelegateChromeOS::ImeMenuItemsChanged( |
| 998 const std::string& engine_id, | 972 const std::string& engine_id, |
| 999 const std::vector<input_method::InputMethodManager::MenuItem>& items) {} | 973 const std::vector<input_method::InputMethodManager::MenuItem>& items) {} |
| 1000 | 974 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1031 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1005 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 1032 << "ENABLE_SUPERVISED_USERS undefined."; | 1006 << "ENABLE_SUPERVISED_USERS undefined."; |
| 1033 return base::string16(); | 1007 return base::string16(); |
| 1034 } | 1008 } |
| 1035 | 1009 |
| 1036 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1010 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1037 return new SystemTrayDelegateChromeOS(); | 1011 return new SystemTrayDelegateChromeOS(); |
| 1038 } | 1012 } |
| 1039 | 1013 |
| 1040 } // namespace chromeos | 1014 } // namespace chromeos |
| OLD | NEW |