| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_win.h" | 5 #include "chrome/browser/ui/ash/system_tray_delegate_win.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
| 11 #include "ash/system/tray/system_tray.h" | 11 #include "ash/system/tray/system_tray.h" |
| 12 #include "ash/system/tray/system_tray_delegate.h" | 12 #include "ash/system/tray/system_tray_delegate.h" |
| 13 #include "ash/system/tray/system_tray_notifier.h" | 13 #include "ash/system/tray/system_tray_notifier.h" |
| 14 #include "ash/volume_control_delegate.h" | 14 #include "ash/volume_control_delegate.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
| 18 #include "chrome/browser/lifetime/application_lifetime.h" | 18 #include "chrome/browser/lifetime/application_lifetime.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" |
| 20 #include "chrome/browser/ui/chrome_pages.h" | 21 #include "chrome/browser/ui/chrome_pages.h" |
| 21 #include "chrome/browser/ui/host_desktop.h" | 22 #include "chrome/browser/ui/host_desktop.h" |
| 22 #include "chrome/browser/upgrade_detector.h" | 23 #include "chrome/browser/upgrade_detector.h" |
| 23 #include "chrome/grit/locale_settings.h" | 24 #include "chrome/grit/locale_settings.h" |
| 24 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
| 25 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 81 } |
| 81 | 82 |
| 82 virtual const base::string16 GetSupervisedUserMessage() const OVERRIDE { | 83 virtual const base::string16 GetSupervisedUserMessage() const OVERRIDE { |
| 83 return base::string16(); | 84 return base::string16(); |
| 84 } | 85 } |
| 85 | 86 |
| 86 virtual bool IsUserSupervised() const OVERRIDE { | 87 virtual bool IsUserSupervised() const OVERRIDE { |
| 87 return false; | 88 return false; |
| 88 } | 89 } |
| 89 | 90 |
| 90 virtual bool SystemShouldUpgrade() const OVERRIDE { | 91 virtual void GetSystemUpdateInfo(ash::UpdateInfo* info) const OVERRIDE { |
| 91 return UpgradeDetector::GetInstance()->notify_upgrade(); | 92 system_tray_delegate_utils::GetUpdateInfo(UpgradeDetector::GetInstance(), |
| 93 info); |
| 92 } | 94 } |
| 93 | 95 |
| 94 virtual base::HourClockType GetHourClockType() const OVERRIDE { | 96 virtual base::HourClockType GetHourClockType() const OVERRIDE { |
| 95 return clock_type_; | 97 return clock_type_; |
| 96 } | 98 } |
| 97 | 99 |
| 98 virtual void ShowSettings() OVERRIDE { | 100 virtual void ShowSettings() OVERRIDE { |
| 99 } | 101 } |
| 100 | 102 |
| 101 virtual bool ShouldShowSettings() OVERRIDE { | 103 virtual bool ShouldShowSettings() OVERRIDE { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 clock_type_ = (base::GetHourClockType() == base::k24HourClock) ? | 294 clock_type_ = (base::GetHourClockType() == base::k24HourClock) ? |
| 293 base::k24HourClock : base::k12HourClock; | 295 base::k24HourClock : base::k12HourClock; |
| 294 GetSystemTrayNotifier()->NotifyDateFormatChanged(); | 296 GetSystemTrayNotifier()->NotifyDateFormatChanged(); |
| 295 } | 297 } |
| 296 | 298 |
| 297 // content::NotificationObserver implementation. | 299 // content::NotificationObserver implementation. |
| 298 virtual void Observe(int type, | 300 virtual void Observe(int type, |
| 299 const content::NotificationSource& source, | 301 const content::NotificationSource& source, |
| 300 const content::NotificationDetails& details) OVERRIDE { | 302 const content::NotificationDetails& details) OVERRIDE { |
| 301 if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) { | 303 if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) { |
| 302 UpgradeDetector* detector = | 304 ash::UpdateInfo info; |
| 303 content::Source<UpgradeDetector>(source).ptr(); | 305 system_tray_delegate_utils::GetUpdateInfo( |
| 304 ash::UpdateObserver::UpdateSeverity severity = | 306 content::Source<UpgradeDetector>(source).ptr(), &info); |
| 305 ash::UpdateObserver::UPDATE_NORMAL; | 307 GetSystemTrayNotifier()->NotifyUpdateRecommended(info); |
| 306 switch (detector->upgrade_notification_stage()) { | |
| 307 case UpgradeDetector::UPGRADE_ANNOYANCE_CRITICAL: | |
| 308 case UpgradeDetector::UPGRADE_ANNOYANCE_SEVERE: | |
| 309 severity = ash::UpdateObserver::UPDATE_SEVERE_RED; | |
| 310 break; | |
| 311 case UpgradeDetector::UPGRADE_ANNOYANCE_HIGH: | |
| 312 severity = ash::UpdateObserver::UPDATE_HIGH_ORANGE; | |
| 313 break; | |
| 314 case UpgradeDetector::UPGRADE_ANNOYANCE_ELEVATED: | |
| 315 severity = ash::UpdateObserver::UPDATE_LOW_GREEN; | |
| 316 break; | |
| 317 case UpgradeDetector::UPGRADE_ANNOYANCE_LOW: | |
| 318 case UpgradeDetector::UPGRADE_ANNOYANCE_NONE: | |
| 319 severity = ash::UpdateObserver::UPDATE_NORMAL; | |
| 320 break; | |
| 321 } | |
| 322 GetSystemTrayNotifier()->NotifyUpdateRecommended(severity); | |
| 323 } else { | 308 } else { |
| 324 NOTREACHED(); | 309 NOTREACHED(); |
| 325 } | 310 } |
| 326 } | 311 } |
| 327 | 312 |
| 328 scoped_ptr<content::NotificationRegistrar> registrar_; | 313 scoped_ptr<content::NotificationRegistrar> registrar_; |
| 329 base::HourClockType clock_type_; | 314 base::HourClockType clock_type_; |
| 330 | 315 |
| 331 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateWin); | 316 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateWin); |
| 332 }; | 317 }; |
| 333 | 318 |
| 334 } // namespace | 319 } // namespace |
| 335 | 320 |
| 336 | 321 |
| 337 ash::SystemTrayDelegate* CreateWindowsSystemTrayDelegate() { | 322 ash::SystemTrayDelegate* CreateWindowsSystemTrayDelegate() { |
| 338 return new SystemTrayDelegateWin(); | 323 return new SystemTrayDelegateWin(); |
| 339 } | 324 } |
| OLD | NEW |