Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(890)

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_linux.cc

Issue 292123014: Ash system tray delegate for Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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/logging.h" 15 #include "base/logging.h"
James Cook 2014/05/29 21:49:11 Is this include required?
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"
James Cook 2014/05/29 21:49:11 Is this include required?
Elliot Glaysher 2014/05/30 19:43:17 Yes, for AttemptRestart.
19 #include "chrome/browser/profiles/profile_manager.h" 19 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/ui/chrome_pages.h" 20 #include "chrome/browser/ui/chrome_pages.h"
21 #include "chrome/browser/ui/host_desktop.h" 21 #include "chrome/browser/ui/host_desktop.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 "content/public/browser/notification_observer.h" 24 #include "content/public/browser/notification_observer.h"
24 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
25
26 #include "grit/locale_settings.h" 26 #include "grit/locale_settings.h"
27 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
28 28
29 namespace { 29 namespace {
30 30
31 class SystemTrayDelegateWin : public ash::SystemTrayDelegate, 31 class SystemTrayDelegateLinux : public ash::SystemTrayDelegate,
32 public content::NotificationObserver { 32 public content::NotificationObserver {
33 public: 33 public:
34 SystemTrayDelegateWin() 34 SystemTrayDelegateLinux()
35 : clock_type_(base::GetHourClockType()) { 35 : clock_type_(base::GetHourClockType()) {
36 // Register notifications on construction so that events such as 36 // Register notifications on construction so that events such as
37 // PROFILE_CREATED do not get missed if they happen before Initialize(). 37 // PROFILE_CREATED do not get missed if they happen before Initialize().
38 registrar_.reset(new content::NotificationRegistrar); 38 registrar_.reset(new content::NotificationRegistrar);
39 registrar_->Add(this, 39 registrar_->Add(this,
40 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, 40 chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
41 content::NotificationService::AllSources()); 41 content::NotificationService::AllSources());
42 } 42 }
43 43
44 virtual ~SystemTrayDelegateWin() { 44 virtual ~SystemTrayDelegateLinux() {
45 registrar_.reset(); 45 registrar_.reset();
46 } 46 }
47 47
48 // Overridden from ash::SystemTrayDelegate: 48 // Overridden from ash::SystemTrayDelegate:
49 virtual void Initialize() OVERRIDE { 49 virtual void Initialize() OVERRIDE {
50 UpdateClockType(); 50 UpdateClockType();
51 } 51 }
52 52
53 virtual void Shutdown() OVERRIDE { 53 virtual void Shutdown() OVERRIDE {
54 } 54 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 virtual void ShowNetworkSettings(const std::string& service_path) OVERRIDE { 109 virtual void ShowNetworkSettings(const std::string& service_path) OVERRIDE {
110 } 110 }
111 111
112 virtual void ShowBluetoothSettings() OVERRIDE { 112 virtual void ShowBluetoothSettings() OVERRIDE {
113 } 113 }
114 114
115 virtual void ShowDisplaySettings() OVERRIDE { 115 virtual void ShowDisplaySettings() OVERRIDE {
116 } 116 }
117 117
118 virtual void ShowChromeSlow() OVERRIDE { 118 virtual void ShowChromeSlow() OVERRIDE {
119 chrome::ScopedTabbedBrowserDisplayer displayer(
120 ProfileManager::GetPrimaryUserProfile(), chrome::HOST_DESKTOP_TYPE_ASH);
121 chrome::ShowSlow(displayer.browser());
119 } 122 }
120 123
121 virtual bool ShouldShowDisplayNotification() OVERRIDE { 124 virtual bool ShouldShowDisplayNotification() OVERRIDE {
122 return false; 125 return false;
123 } 126 }
124 127
125 virtual void ShowDriveSettings() OVERRIDE { 128 virtual void ShowDriveSettings() OVERRIDE {
126 } 129 }
127 130
128 virtual void ShowIMESettings() OVERRIDE { 131 virtual void ShowIMESettings() OVERRIDE {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // content::NotificationObserver implementation. 315 // content::NotificationObserver implementation.
313 virtual void Observe(int type, 316 virtual void Observe(int type,
314 const content::NotificationSource& source, 317 const content::NotificationSource& source,
315 const content::NotificationDetails& details) OVERRIDE { 318 const content::NotificationDetails& details) OVERRIDE {
316 if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) { 319 if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) {
317 UpgradeDetector* detector = 320 UpgradeDetector* detector =
318 content::Source<UpgradeDetector>(source).ptr(); 321 content::Source<UpgradeDetector>(source).ptr();
319 ash::UpdateObserver::UpdateSeverity severity = 322 ash::UpdateObserver::UpdateSeverity severity =
320 ash::UpdateObserver::UPDATE_NORMAL; 323 ash::UpdateObserver::UPDATE_NORMAL;
321 switch (detector->upgrade_notification_stage()) { 324 switch (detector->upgrade_notification_stage()) {
325 case UpgradeDetector::UPGRADE_ANNOYANCE_CRITICAL:
James Cook 2014/05/29 21:49:11 I love that we have an UPGRADE_ANNOYANCE enum.
322 case UpgradeDetector::UPGRADE_ANNOYANCE_SEVERE: 326 case UpgradeDetector::UPGRADE_ANNOYANCE_SEVERE:
323 severity = ash::UpdateObserver::UPDATE_SEVERE_RED; 327 severity = ash::UpdateObserver::UPDATE_SEVERE_RED;
324 break; 328 break;
325 case UpgradeDetector::UPGRADE_ANNOYANCE_HIGH: 329 case UpgradeDetector::UPGRADE_ANNOYANCE_HIGH:
326 severity = ash::UpdateObserver::UPDATE_HIGH_ORANGE; 330 severity = ash::UpdateObserver::UPDATE_HIGH_ORANGE;
327 break; 331 break;
328 case UpgradeDetector::UPGRADE_ANNOYANCE_ELEVATED: 332 case UpgradeDetector::UPGRADE_ANNOYANCE_ELEVATED:
329 severity = ash::UpdateObserver::UPDATE_LOW_GREEN; 333 severity = ash::UpdateObserver::UPDATE_LOW_GREEN;
330 break; 334 break;
331 case UpgradeDetector::UPGRADE_ANNOYANCE_LOW: 335 case UpgradeDetector::UPGRADE_ANNOYANCE_LOW:
336 case UpgradeDetector::UPGRADE_ANNOYANCE_NONE:
James Cook 2014/05/29 21:49:11 Does the Windows version need these changes?
Elliot Glaysher 2014/05/30 19:43:17 Done.
332 severity = ash::UpdateObserver::UPDATE_NORMAL; 337 severity = ash::UpdateObserver::UPDATE_NORMAL;
333 break; 338 break;
334 } 339 }
335 GetSystemTrayNotifier()->NotifyUpdateRecommended(severity); 340 GetSystemTrayNotifier()->NotifyUpdateRecommended(severity);
336 } else { 341 } else {
337 NOTREACHED(); 342 NOTREACHED();
338 } 343 }
339 } 344 }
340 345
341 scoped_ptr<content::NotificationRegistrar> registrar_; 346 scoped_ptr<content::NotificationRegistrar> registrar_;
342 base::HourClockType clock_type_; 347 base::HourClockType clock_type_;
343 348
344 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateWin); 349 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateLinux);
345 }; 350 };
346 351
347 } // namespace 352 } // namespace
348 353
349 354
350 ash::SystemTrayDelegate* CreateWindowsSystemTrayDelegate() { 355 ash::SystemTrayDelegate* CreateLinuxSystemTrayDelegate() {
351 return new SystemTrayDelegateWin(); 356 return new SystemTrayDelegateLinux();
352 } 357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698