Index: chrome/browser/ui/ash/system_tray_delegate_win.cc |
diff --git a/chrome/browser/ui/ash/system_tray_delegate_win.cc b/chrome/browser/ui/ash/system_tray_delegate_win.cc |
index 47e7621615f6dde6deb33d1bce189af28bf909e0..753796dd54e581bab54dd7da81bba5a2a79cc6a4 100644 |
--- a/chrome/browser/ui/ash/system_tray_delegate_win.cc |
+++ b/chrome/browser/ui/ash/system_tray_delegate_win.cc |
@@ -27,6 +27,31 @@ |
namespace { |
+void GetUpdateInfo(const UpgradeDetector* detector, ash::UpdateInfo* info) { |
+ if (!detector || !info) |
+ return; |
+ ash::UpdateInfo::UpdateSeverity severity = |
+ ash::UpdateInfo::UPDATE_NORMAL; |
+ switch (detector->upgrade_notification_stage()) { |
+ case UpgradeDetector::UPGRADE_ANNOYANCE_CRITICAL: |
+ 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: |
+ case UpgradeDetector::UPGRADE_ANNOYANCE_NONE: |
+ severity = ash::UpdateInfo::UPDATE_NORMAL; |
+ break; |
+ } |
+ info->severity = severity; |
+ info->is_factory_reset_required = detector->is_factory_reset_required(); |
+} |
+ |
class SystemTrayDelegateWin : public ash::SystemTrayDelegate, |
public content::NotificationObserver { |
public: |
@@ -87,8 +112,10 @@ class SystemTrayDelegateWin : public ash::SystemTrayDelegate, |
return false; |
} |
- virtual bool SystemShouldUpgrade() const OVERRIDE { |
- return UpgradeDetector::GetInstance()->notify_upgrade(); |
+ virtual bool SystemShouldUpgrade(ash::UpdateInfo* info) const OVERRIDE { |
+ UpgradeDetector* detector = UpgradeDetector::GetInstance(); |
+ GetUpdateInfo(detector, info); |
+ return detector->notify_upgrade(); |
} |
virtual base::HourClockType GetHourClockType() const OVERRIDE { |
@@ -299,27 +326,9 @@ class SystemTrayDelegateWin : public ash::SystemTrayDelegate, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) OVERRIDE { |
if (type == 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_CRITICAL: |
- 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: |
- case UpgradeDetector::UPGRADE_ANNOYANCE_NONE: |
- severity = ash::UpdateObserver::UPDATE_NORMAL; |
- break; |
- } |
- GetSystemTrayNotifier()->NotifyUpdateRecommended(severity); |
+ ash::UpdateInfo info; |
+ GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info); |
+ GetSystemTrayNotifier()->NotifyUpdateRecommended(info); |
} else { |
NOTREACHED(); |
} |