Index: chrome/browser/ui/ash/system_tray_delegate_utils.cc |
diff --git a/chrome/browser/ui/ash/system_tray_delegate_utils.cc b/chrome/browser/ui/ash/system_tray_delegate_utils.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..04205de0b52749d12bc44af3142d38a11b4317a9 |
--- /dev/null |
+++ b/chrome/browser/ui/ash/system_tray_delegate_utils.cc |
@@ -0,0 +1,36 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ui/ash/system_tray_delegate_utils.h" |
+ |
+#include "ash/system/tray/system_tray_delegate.h" |
+#include "base/logging.h" |
+#include "chrome/browser/upgrade_detector.h" |
+ |
+namespace system_tray_delegate_utils { |
+ |
+void GetUpdateInfo(const UpgradeDetector* detector, ash::UpdateInfo* info) { |
+ DCHECK(detector); |
+ DCHECK(info); |
+ switch (detector->upgrade_notification_stage()) { |
+ case UpgradeDetector::UPGRADE_ANNOYANCE_CRITICAL: |
+ case UpgradeDetector::UPGRADE_ANNOYANCE_SEVERE: |
+ info->severity = ash::UpdateInfo::UPDATE_SEVERE_RED; |
+ break; |
+ case UpgradeDetector::UPGRADE_ANNOYANCE_HIGH: |
+ info->severity = ash::UpdateInfo::UPDATE_HIGH_ORANGE; |
+ break; |
+ case UpgradeDetector::UPGRADE_ANNOYANCE_ELEVATED: |
+ info->severity = ash::UpdateInfo::UPDATE_LOW_GREEN; |
+ break; |
+ case UpgradeDetector::UPGRADE_ANNOYANCE_LOW: |
+ case UpgradeDetector::UPGRADE_ANNOYANCE_NONE: |
+ info->severity = ash::UpdateInfo::UPDATE_NORMAL; |
+ break; |
+ } |
+ info->update_required = detector->notify_upgrade(); |
+ info->factory_reset_required = detector->is_factory_reset_required(); |
+} |
+ |
+} // namespace system_tray_delegate_utils |