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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 64 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
65 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" | 65 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" |
66 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 66 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
67 #include "chrome/browser/chromeos/set_time_dialog.h" | 67 #include "chrome/browser/chromeos/set_time_dialog.h" |
68 #include "chrome/browser/chromeos/settings/cros_settings.h" | 68 #include "chrome/browser/chromeos/settings/cros_settings.h" |
69 #include "chrome/browser/chromeos/sim_dialog_delegate.h" | 69 #include "chrome/browser/chromeos/sim_dialog_delegate.h" |
70 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" | 70 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" |
71 #include "chrome/browser/lifetime/application_lifetime.h" | 71 #include "chrome/browser/lifetime/application_lifetime.h" |
72 #include "chrome/browser/profiles/profile_manager.h" | 72 #include "chrome/browser/profiles/profile_manager.h" |
73 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 73 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 74 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" |
74 #include "chrome/browser/ui/ash/user_accounts_delegate_chromeos.h" | 75 #include "chrome/browser/ui/ash/user_accounts_delegate_chromeos.h" |
75 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" | 76 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" |
76 #include "chrome/browser/ui/browser.h" | 77 #include "chrome/browser/ui/browser.h" |
77 #include "chrome/browser/ui/browser_finder.h" | 78 #include "chrome/browser/ui/browser_finder.h" |
78 #include "chrome/browser/ui/browser_list.h" | 79 #include "chrome/browser/ui/browser_list.h" |
79 #include "chrome/browser/ui/chrome_pages.h" | 80 #include "chrome/browser/ui/chrome_pages.h" |
80 #include "chrome/browser/ui/host_desktop.h" | 81 #include "chrome/browser/ui/host_desktop.h" |
81 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 82 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
82 #include "chrome/browser/ui/singleton_tabs.h" | 83 #include "chrome/browser/ui/singleton_tabs.h" |
83 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 84 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 return l10n_util::GetStringFUTF16( | 400 return l10n_util::GetStringFUTF16( |
400 IDS_USER_IS_SUPERVISED_BY_NOTICE, | 401 IDS_USER_IS_SUPERVISED_BY_NOTICE, |
401 base::UTF8ToUTF16(GetSupervisedUserManager())); | 402 base::UTF8ToUTF16(GetSupervisedUserManager())); |
402 } | 403 } |
403 | 404 |
404 bool SystemTrayDelegateChromeOS::IsUserSupervised() const { | 405 bool SystemTrayDelegateChromeOS::IsUserSupervised() const { |
405 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); | 406 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); |
406 return user && user->IsSupervised(); | 407 return user && user->IsSupervised(); |
407 } | 408 } |
408 | 409 |
409 bool SystemTrayDelegateChromeOS::SystemShouldUpgrade() const { | 410 void SystemTrayDelegateChromeOS::GetSystemUpdateInfo( |
410 return UpgradeDetector::GetInstance()->notify_upgrade(); | 411 ash::UpdateInfo* info) const { |
| 412 GetUpdateInfo(UpgradeDetector::GetInstance(), info); |
411 } | 413 } |
412 | 414 |
413 base::HourClockType SystemTrayDelegateChromeOS::GetHourClockType() const { | 415 base::HourClockType SystemTrayDelegateChromeOS::GetHourClockType() const { |
414 return clock_type_; | 416 return clock_type_; |
415 } | 417 } |
416 | 418 |
417 void SystemTrayDelegateChromeOS::ShowSettings() { | 419 void SystemTrayDelegateChromeOS::ShowSettings() { |
418 ShowSettingsSubPageForActiveUser(""); | 420 ShowSettingsSubPageForActiveUser(""); |
419 } | 421 } |
420 | 422 |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 return GetNativeWindowByStatus(GetUserLoginStatus(), session_started); | 1082 return GetNativeWindowByStatus(GetUserLoginStatus(), session_started); |
1081 } | 1083 } |
1082 | 1084 |
1083 // content::NotificationObserver implementation. | 1085 // content::NotificationObserver implementation. |
1084 void SystemTrayDelegateChromeOS::Observe( | 1086 void SystemTrayDelegateChromeOS::Observe( |
1085 int type, | 1087 int type, |
1086 const content::NotificationSource& source, | 1088 const content::NotificationSource& source, |
1087 const content::NotificationDetails& details) { | 1089 const content::NotificationDetails& details) { |
1088 switch (type) { | 1090 switch (type) { |
1089 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { | 1091 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { |
1090 UpgradeDetector* detector = | 1092 ash::UpdateInfo info; |
1091 content::Source<UpgradeDetector>(source).ptr(); | 1093 GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info); |
1092 ash::UpdateObserver::UpdateSeverity severity = | 1094 GetSystemTrayNotifier()->NotifyUpdateRecommended(info); |
1093 ash::UpdateObserver::UPDATE_NORMAL; | |
1094 switch (detector->upgrade_notification_stage()) { | |
1095 case UpgradeDetector::UPGRADE_ANNOYANCE_SEVERE: | |
1096 severity = ash::UpdateObserver::UPDATE_SEVERE_RED; | |
1097 break; | |
1098 | |
1099 case UpgradeDetector::UPGRADE_ANNOYANCE_HIGH: | |
1100 severity = ash::UpdateObserver::UPDATE_HIGH_ORANGE; | |
1101 break; | |
1102 | |
1103 case UpgradeDetector::UPGRADE_ANNOYANCE_ELEVATED: | |
1104 severity = ash::UpdateObserver::UPDATE_LOW_GREEN; | |
1105 break; | |
1106 | |
1107 case UpgradeDetector::UPGRADE_ANNOYANCE_LOW: | |
1108 default: | |
1109 severity = ash::UpdateObserver::UPDATE_NORMAL; | |
1110 break; | |
1111 } | |
1112 GetSystemTrayNotifier()->NotifyUpdateRecommended(severity); | |
1113 break; | 1095 break; |
1114 } | 1096 } |
1115 case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: { | 1097 case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: { |
1116 // This notification is also sent on login screen when user avatar | 1098 // This notification is also sent on login screen when user avatar |
1117 // is loaded from file. | 1099 // is loaded from file. |
1118 if (GetUserLoginStatus() != ash::user::LOGGED_IN_NONE) { | 1100 if (GetUserLoginStatus() != ash::user::LOGGED_IN_NONE) { |
1119 GetSystemTrayNotifier()->NotifyUserUpdate(); | 1101 GetSystemTrayNotifier()->NotifyUserUpdate(); |
1120 } | 1102 } |
1121 break; | 1103 break; |
1122 } | 1104 } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 accessibility_subscription_.reset(); | 1277 accessibility_subscription_.reset(); |
1296 else | 1278 else |
1297 OnAccessibilityModeChanged(details.notify); | 1279 OnAccessibilityModeChanged(details.notify); |
1298 } | 1280 } |
1299 | 1281 |
1300 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1282 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1301 return new SystemTrayDelegateChromeOS(); | 1283 return new SystemTrayDelegateChromeOS(); |
1302 } | 1284 } |
1303 | 1285 |
1304 } // namespace chromeos | 1286 } // namespace chromeos |
OLD | NEW |