Index: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc |
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc |
index 2d5e39f57bd3c8e410f65eadc322c8e86da473f5..c1046be58ee4db89864529710c21939224575ea0 100644 |
--- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc |
+++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc |
@@ -182,6 +182,33 @@ void OnAcceptMultiprofilesIntro(bool no_show_again) { |
UserAddingScreen::Get()->Start(); |
} |
+void GetUpdateInfo(const UpgradeDetector* detector, ash::UpdateInfo* info) { |
sky
2014/10/02 17:23:06
Isn't this code the same as the _win and _linux co
ygorshenin1
2014/10/03 14:55:36
Yes, this code is the same for all platforms. I've
|
+ if (!detector || !info) |
sky
2014/10/02 17:23:06
Do we really allow either of these to be NULL? Sho
ygorshenin1
2014/10/03 14:55:37
Done.
|
+ return; |
+ ash::UpdateInfo::UpdateSeverity severity = ash::UpdateInfo::UPDATE_NORMAL; |
sky
2014/10/02 17:23:06
Why bother with the local and not set info->severi
ygorshenin1
2014/10/03 14:55:36
Done.
|
+ switch (detector->upgrade_notification_stage()) { |
+ case UpgradeDetector::UPGRADE_ANNOYANCE_SEVERE: |
+ severity = ash::UpdateInfo::UPDATE_SEVERE_RED; |
+ break; |
+ |
+ case UpgradeDetector::UPGRADE_ANNOYANCE_HIGH: |
+ severity = ash::UpdateInfo::UPDATE_HIGH_ORANGE; |
+ break; |
+ |
+ case UpgradeDetector::UPGRADE_ANNOYANCE_ELEVATED: |
+ severity = ash::UpdateInfo::UPDATE_LOW_GREEN; |
+ break; |
+ |
+ case UpgradeDetector::UPGRADE_ANNOYANCE_LOW: |
+ default: |
+ severity = ash::UpdateInfo::UPDATE_NORMAL; |
sky
2014/10/02 17:23:06
Isn't this covered by 188? I recommend nuking 188
ygorshenin1
2014/10/03 14:55:36
Done.
|
+ break; |
+ } |
+ info->severity = severity; |
+ info->update_required = detector->notify_upgrade(); |
+ info->factory_reset_required = detector->is_factory_reset_required(); |
+} |
+ |
} // namespace |
SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() |
@@ -406,8 +433,9 @@ bool SystemTrayDelegateChromeOS::IsUserSupervised() const { |
return user && user->IsSupervised(); |
} |
-bool SystemTrayDelegateChromeOS::SystemShouldUpgrade() const { |
- return UpgradeDetector::GetInstance()->notify_upgrade(); |
+void SystemTrayDelegateChromeOS::GetSystemUpdateInfo( |
+ ash::UpdateInfo* info) const { |
+ GetUpdateInfo(UpgradeDetector::GetInstance(), info); |
} |
base::HourClockType SystemTrayDelegateChromeOS::GetHourClockType() const { |
@@ -1087,29 +1115,9 @@ void SystemTrayDelegateChromeOS::Observe( |
const content::NotificationDetails& details) { |
switch (type) { |
case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { |
- UpgradeDetector* detector = |
- content::Source<UpgradeDetector>(source).ptr(); |
- ash::UpdateObserver::UpdateSeverity severity = |
- ash::UpdateObserver::UPDATE_NORMAL; |
- switch (detector->upgrade_notification_stage()) { |
- case UpgradeDetector::UPGRADE_ANNOYANCE_SEVERE: |
- severity = ash::UpdateObserver::UPDATE_SEVERE_RED; |
- break; |
- |
- case UpgradeDetector::UPGRADE_ANNOYANCE_HIGH: |
- severity = ash::UpdateObserver::UPDATE_HIGH_ORANGE; |
- break; |
- |
- case UpgradeDetector::UPGRADE_ANNOYANCE_ELEVATED: |
- severity = ash::UpdateObserver::UPDATE_LOW_GREEN; |
- break; |
- |
- case UpgradeDetector::UPGRADE_ANNOYANCE_LOW: |
- default: |
- severity = ash::UpdateObserver::UPDATE_NORMAL; |
- break; |
- } |
- GetSystemTrayNotifier()->NotifyUpdateRecommended(severity); |
+ ash::UpdateInfo info; |
+ GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info); |
+ GetSystemTrayNotifier()->NotifyUpdateRecommended(info); |
break; |
} |
case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: { |