| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_linux.h" | 5 #include "chrome/browser/ui/ash/system_tray_delegate_linux.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/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/lifetime/application_lifetime.h" | 17 #include "chrome/browser/lifetime/application_lifetime.h" |
| 18 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 19 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" |
| 19 #include "chrome/browser/ui/chrome_pages.h" | 20 #include "chrome/browser/ui/chrome_pages.h" |
| 20 #include "chrome/browser/ui/host_desktop.h" | 21 #include "chrome/browser/ui/host_desktop.h" |
| 21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 22 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.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 { |
| (...skipping 51 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 GetUpdateInfo(UpgradeDetector::GetInstance(), info); |
| 92 } | 93 } |
| 93 | 94 |
| 94 virtual base::HourClockType GetHourClockType() const override { | 95 virtual base::HourClockType GetHourClockType() const override { |
| 95 return clock_type_; | 96 return clock_type_; |
| 96 } | 97 } |
| 97 | 98 |
| 98 virtual void ShowSettings() override { | 99 virtual void ShowSettings() override { |
| 99 } | 100 } |
| 100 | 101 |
| 101 virtual bool ShouldShowSettings() override { | 102 virtual bool ShouldShowSettings() override { |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 clock_type_ = (base::GetHourClockType() == base::k24HourClock) ? | 296 clock_type_ = (base::GetHourClockType() == base::k24HourClock) ? |
| 296 base::k24HourClock : base::k12HourClock; | 297 base::k24HourClock : base::k12HourClock; |
| 297 GetSystemTrayNotifier()->NotifyDateFormatChanged(); | 298 GetSystemTrayNotifier()->NotifyDateFormatChanged(); |
| 298 } | 299 } |
| 299 | 300 |
| 300 // content::NotificationObserver implementation. | 301 // content::NotificationObserver implementation. |
| 301 virtual void Observe(int type, | 302 virtual void Observe(int type, |
| 302 const content::NotificationSource& source, | 303 const content::NotificationSource& source, |
| 303 const content::NotificationDetails& details) override { | 304 const content::NotificationDetails& details) override { |
| 304 if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) { | 305 if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) { |
| 305 UpgradeDetector* detector = | 306 ash::UpdateInfo info; |
| 306 content::Source<UpgradeDetector>(source).ptr(); | 307 GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info); |
| 307 ash::UpdateObserver::UpdateSeverity severity = | 308 GetSystemTrayNotifier()->NotifyUpdateRecommended(info); |
| 308 ash::UpdateObserver::UPDATE_NORMAL; | |
| 309 switch (detector->upgrade_notification_stage()) { | |
| 310 case UpgradeDetector::UPGRADE_ANNOYANCE_CRITICAL: | |
| 311 case UpgradeDetector::UPGRADE_ANNOYANCE_SEVERE: | |
| 312 severity = ash::UpdateObserver::UPDATE_SEVERE_RED; | |
| 313 break; | |
| 314 case UpgradeDetector::UPGRADE_ANNOYANCE_HIGH: | |
| 315 severity = ash::UpdateObserver::UPDATE_HIGH_ORANGE; | |
| 316 break; | |
| 317 case UpgradeDetector::UPGRADE_ANNOYANCE_ELEVATED: | |
| 318 severity = ash::UpdateObserver::UPDATE_LOW_GREEN; | |
| 319 break; | |
| 320 case UpgradeDetector::UPGRADE_ANNOYANCE_LOW: | |
| 321 case UpgradeDetector::UPGRADE_ANNOYANCE_NONE: | |
| 322 severity = ash::UpdateObserver::UPDATE_NORMAL; | |
| 323 break; | |
| 324 } | |
| 325 GetSystemTrayNotifier()->NotifyUpdateRecommended(severity); | |
| 326 } else { | 309 } else { |
| 327 NOTREACHED(); | 310 NOTREACHED(); |
| 328 } | 311 } |
| 329 } | 312 } |
| 330 | 313 |
| 331 scoped_ptr<content::NotificationRegistrar> registrar_; | 314 scoped_ptr<content::NotificationRegistrar> registrar_; |
| 332 base::HourClockType clock_type_; | 315 base::HourClockType clock_type_; |
| 333 | 316 |
| 334 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateLinux); | 317 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateLinux); |
| 335 }; | 318 }; |
| 336 | 319 |
| 337 } // namespace | 320 } // namespace |
| 338 | 321 |
| 339 | 322 |
| 340 ash::SystemTrayDelegate* CreateLinuxSystemTrayDelegate() { | 323 ash::SystemTrayDelegate* CreateLinuxSystemTrayDelegate() { |
| 341 return new SystemTrayDelegateLinux(); | 324 return new SystemTrayDelegateLinux(); |
| 342 } | 325 } |
| OLD | NEW |