| 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/ash_switches.h" | 15 #include "ash/ash_switches.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_window_ids.h" | 18 #include "ash/common/shell_window_ids.h" |
| 19 #include "ash/common/system/tray/system_tray_delegate.h" | 19 #include "ash/common/system/tray/system_tray_delegate.h" |
| 20 #include "ash/common/system/tray/wm_system_tray_notifier.h" |
| 20 #include "ash/common/system/update/update_observer.h" | 21 #include "ash/common/system/update/update_observer.h" |
| 21 #include "ash/common/system/volume_control_delegate.h" | 22 #include "ash/common/system/volume_control_delegate.h" |
| 23 #include "ash/common/wm_shell.h" |
| 22 #include "ash/desktop_background/desktop_background_controller.h" | 24 #include "ash/desktop_background/desktop_background_controller.h" |
| 23 #include "ash/metrics/user_metrics_recorder.h" | 25 #include "ash/metrics/user_metrics_recorder.h" |
| 24 #include "ash/shell.h" | 26 #include "ash/shell.h" |
| 25 #include "ash/shell_delegate.h" | 27 #include "ash/shell_delegate.h" |
| 26 #include "ash/system/chromeos/bluetooth/bluetooth_observer.h" | 28 #include "ash/system/chromeos/bluetooth/bluetooth_observer.h" |
| 27 #include "ash/system/chromeos/power/power_status.h" | 29 #include "ash/system/chromeos/power/power_status.h" |
| 28 #include "ash/system/chromeos/session/logout_button_observer.h" | 30 #include "ash/system/chromeos/session/logout_button_observer.h" |
| 29 #include "ash/system/chromeos/shutdown_policy_observer.h" | 31 #include "ash/system/chromeos/shutdown_policy_observer.h" |
| 30 #include "ash/system/date/clock_observer.h" | 32 #include "ash/system/date/clock_observer.h" |
| 31 #include "ash/system/ime/ime_observer.h" | 33 #include "ash/system/ime/ime_observer.h" |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 } | 880 } |
| 879 | 881 |
| 880 ash::SystemTray* SystemTrayDelegateChromeOS::GetPrimarySystemTray() { | 882 ash::SystemTray* SystemTrayDelegateChromeOS::GetPrimarySystemTray() { |
| 881 return ash::Shell::GetInstance()->GetPrimarySystemTray(); | 883 return ash::Shell::GetInstance()->GetPrimarySystemTray(); |
| 882 } | 884 } |
| 883 | 885 |
| 884 ash::SystemTrayNotifier* SystemTrayDelegateChromeOS::GetSystemTrayNotifier() { | 886 ash::SystemTrayNotifier* SystemTrayDelegateChromeOS::GetSystemTrayNotifier() { |
| 885 return ash::Shell::GetInstance()->system_tray_notifier(); | 887 return ash::Shell::GetInstance()->system_tray_notifier(); |
| 886 } | 888 } |
| 887 | 889 |
| 890 ash::WmSystemTrayNotifier* |
| 891 SystemTrayDelegateChromeOS::GetWmSystemTrayNotifier() { |
| 892 return ash::WmShell::Get()->system_tray_notifier(); |
| 893 } |
| 894 |
| 888 void SystemTrayDelegateChromeOS::SetProfile(Profile* profile) { | 895 void SystemTrayDelegateChromeOS::SetProfile(Profile* profile) { |
| 889 // Stop observing the AppWindowRegistry of the current |user_profile_|. | 896 // Stop observing the AppWindowRegistry of the current |user_profile_|. |
| 890 StopObservingAppWindowRegistry(); | 897 StopObservingAppWindowRegistry(); |
| 891 | 898 |
| 892 // Stop observing custodian info changes of the current |user_profile_|. | 899 // Stop observing custodian info changes of the current |user_profile_|. |
| 893 StopObservingCustodianInfoChanges(); | 900 StopObservingCustodianInfoChanges(); |
| 894 | 901 |
| 895 user_profile_ = profile; | 902 user_profile_ = profile; |
| 896 | 903 |
| 897 // Start observing the AppWindowRegistry of the newly set |user_profile_|. | 904 // Start observing the AppWindowRegistry of the newly set |user_profile_|. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 | 1076 |
| 1070 // content::NotificationObserver implementation. | 1077 // content::NotificationObserver implementation. |
| 1071 void SystemTrayDelegateChromeOS::Observe( | 1078 void SystemTrayDelegateChromeOS::Observe( |
| 1072 int type, | 1079 int type, |
| 1073 const content::NotificationSource& source, | 1080 const content::NotificationSource& source, |
| 1074 const content::NotificationDetails& details) { | 1081 const content::NotificationDetails& details) { |
| 1075 switch (type) { | 1082 switch (type) { |
| 1076 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { | 1083 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { |
| 1077 ash::UpdateInfo info; | 1084 ash::UpdateInfo info; |
| 1078 GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info); | 1085 GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info); |
| 1079 GetSystemTrayNotifier()->NotifyUpdateRecommended(info); | 1086 GetWmSystemTrayNotifier()->NotifyUpdateRecommended(info); |
| 1080 break; | 1087 break; |
| 1081 } | 1088 } |
| 1082 case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: { | 1089 case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: { |
| 1083 // This notification is also sent on login screen when user avatar | 1090 // This notification is also sent on login screen when user avatar |
| 1084 // is loaded from file. | 1091 // is loaded from file. |
| 1085 if (GetUserLoginStatus() != ash::LoginStatus::NOT_LOGGED_IN) { | 1092 if (GetUserLoginStatus() != ash::LoginStatus::NOT_LOGGED_IN) { |
| 1086 GetSystemTrayNotifier()->NotifyUserUpdate(); | 1093 GetSystemTrayNotifier()->NotifyUserUpdate(); |
| 1087 } | 1094 } |
| 1088 break; | 1095 break; |
| 1089 } | 1096 } |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1336 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 1330 << "ENABLE_SUPERVISED_USERS undefined."; | 1337 << "ENABLE_SUPERVISED_USERS undefined."; |
| 1331 return base::string16(); | 1338 return base::string16(); |
| 1332 } | 1339 } |
| 1333 | 1340 |
| 1334 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1341 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1335 return new SystemTrayDelegateChromeOS(); | 1342 return new SystemTrayDelegateChromeOS(); |
| 1336 } | 1343 } |
| 1337 | 1344 |
| 1338 } // namespace chromeos | 1345 } // namespace chromeos |
| OLD | NEW |