| 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 "ash/system/status_area_widget.h" | 5 #include "ash/system/status_area_widget.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| 11 #include "ash/system/bluetooth/bluetooth_observer.h" | 11 #include "ash/system/bluetooth/bluetooth_observer.h" |
| 12 #include "ash/system/network/network_observer.h" | 12 #include "ash/system/network/network_observer.h" |
| 13 #include "ash/system/status_area_widget_delegate.h" | 13 #include "ash/system/status_area_widget_delegate.h" |
| 14 #include "ash/system/tray/system_tray.h" | 14 #include "ash/system/tray/system_tray.h" |
| 15 #include "ash/system/tray/system_tray_delegate.h" | 15 #include "ash/system/tray/system_tray_delegate.h" |
| 16 #include "ash/system/web_notification/web_notification_tray.h" | 16 #include "ash/system/web_notification/web_notification_tray.h" |
| 17 #include "ash/volume_control_delegate.h" |
| 17 #include "base/i18n/time_formatting.h" | 18 #include "base/i18n/time_formatting.h" |
| 18 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 19 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 20 | 21 |
| 21 namespace ash { | 22 namespace ash { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 26 class DummyVolumeControlDelegate : public VolumeControlDelegate { |
| 27 public: |
| 28 DummyVolumeControlDelegate() {} |
| 29 virtual ~DummyVolumeControlDelegate() {} |
| 30 |
| 31 virtual bool HandleVolumeMute(const ui::Accelerator& accelerator) OVERRIDE { |
| 32 return true; |
| 33 } |
| 34 virtual bool HandleVolumeDown(const ui::Accelerator& accelerator) OVERRIDE { |
| 35 return true; |
| 36 } |
| 37 virtual bool HandleVolumeUp(const ui::Accelerator& accelerator) OVERRIDE { |
| 38 return true; |
| 39 } |
| 40 virtual void SetVolumePercent(double percent) OVERRIDE { |
| 41 } |
| 42 virtual bool IsAudioMuted() const OVERRIDE { |
| 43 return true; |
| 44 } |
| 45 virtual void SetAudioMuted(bool muted) OVERRIDE { |
| 46 } |
| 47 virtual float GetVolumeLevel() const OVERRIDE { |
| 48 return 0.0; |
| 49 } |
| 50 virtual void SetVolumeLevel(float level) OVERRIDE { |
| 51 } |
| 52 |
| 53 private: |
| 54 DISALLOW_COPY_AND_ASSIGN(DummyVolumeControlDelegate); |
| 55 }; |
| 56 |
| 25 class DummySystemTrayDelegate : public SystemTrayDelegate { | 57 class DummySystemTrayDelegate : public SystemTrayDelegate { |
| 26 public: | 58 public: |
| 27 DummySystemTrayDelegate() | 59 DummySystemTrayDelegate() |
| 28 : muted_(false), | 60 : wifi_enabled_(true), |
| 29 wifi_enabled_(true), | |
| 30 cellular_enabled_(true), | 61 cellular_enabled_(true), |
| 31 bluetooth_enabled_(true), | 62 bluetooth_enabled_(true), |
| 32 volume_(0.5), | 63 caps_lock_enabled_(false), |
| 33 caps_lock_enabled_(false) { | 64 volume_control_delegate_( |
| 65 ALLOW_THIS_IN_INITIALIZER_LIST(new DummyVolumeControlDelegate)) { |
| 34 } | 66 } |
| 35 | 67 |
| 36 virtual ~DummySystemTrayDelegate() {} | 68 virtual ~DummySystemTrayDelegate() {} |
| 37 | 69 |
| 38 private: | 70 private: |
| 39 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { return true; } | 71 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { return true; } |
| 40 | 72 |
| 41 // Overridden from SystemTrayDelegate: | 73 // Overridden from SystemTrayDelegate: |
| 42 virtual const string16 GetUserDisplayName() const OVERRIDE { | 74 virtual const string16 GetUserDisplayName() const OVERRIDE { |
| 43 return UTF8ToUTF16("Über tray Über tray Über tray Über tray"); | 75 return UTF8ToUTF16("Über tray Über tray Über tray Über tray"); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 116 |
| 85 virtual void ShowDriveSettings() OVERRIDE { | 117 virtual void ShowDriveSettings() OVERRIDE { |
| 86 } | 118 } |
| 87 | 119 |
| 88 virtual void ShowIMESettings() OVERRIDE { | 120 virtual void ShowIMESettings() OVERRIDE { |
| 89 } | 121 } |
| 90 | 122 |
| 91 virtual void ShowHelp() OVERRIDE { | 123 virtual void ShowHelp() OVERRIDE { |
| 92 } | 124 } |
| 93 | 125 |
| 94 virtual bool IsAudioMuted() const OVERRIDE { | |
| 95 return muted_; | |
| 96 } | |
| 97 | |
| 98 virtual void SetAudioMuted(bool muted) OVERRIDE { | |
| 99 muted_ = muted; | |
| 100 } | |
| 101 | |
| 102 virtual float GetVolumeLevel() const OVERRIDE { | |
| 103 return volume_; | |
| 104 } | |
| 105 | |
| 106 virtual void SetVolumeLevel(float volume) OVERRIDE { | |
| 107 volume_ = volume; | |
| 108 } | |
| 109 | |
| 110 virtual bool IsCapsLockOn() const OVERRIDE { | 126 virtual bool IsCapsLockOn() const OVERRIDE { |
| 111 return caps_lock_enabled_; | 127 return caps_lock_enabled_; |
| 112 } | 128 } |
| 113 | 129 |
| 114 virtual void SetCapsLockEnabled(bool enabled) OVERRIDE { | 130 virtual void SetCapsLockEnabled(bool enabled) OVERRIDE { |
| 115 caps_lock_enabled_ = enabled; | 131 caps_lock_enabled_ = enabled; |
| 116 } | 132 } |
| 117 | 133 |
| 118 virtual void ShutDown() OVERRIDE {} | 134 virtual void ShutDown() OVERRIDE {} |
| 119 | 135 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 std::string* setup_url) OVERRIDE { | 269 std::string* setup_url) OVERRIDE { |
| 254 return false; | 270 return false; |
| 255 } | 271 } |
| 256 | 272 |
| 257 virtual void ShowCellularURL(const std::string& url) OVERRIDE { | 273 virtual void ShowCellularURL(const std::string& url) OVERRIDE { |
| 258 } | 274 } |
| 259 | 275 |
| 260 virtual void ChangeProxySettings() OVERRIDE { | 276 virtual void ChangeProxySettings() OVERRIDE { |
| 261 } | 277 } |
| 262 | 278 |
| 263 bool muted_; | 279 virtual VolumeControlDelegate* GetVolumeControlDelegate() const OVERRIDE { |
| 280 return volume_control_delegate_.get(); |
| 281 } |
| 282 |
| 283 virtual void SetVolumeControlDelegate( |
| 284 scoped_ptr<VolumeControlDelegate> delegate) OVERRIDE { |
| 285 volume_control_delegate_.swap(delegate); |
| 286 } |
| 287 |
| 288 |
| 264 bool wifi_enabled_; | 289 bool wifi_enabled_; |
| 265 bool cellular_enabled_; | 290 bool cellular_enabled_; |
| 266 bool bluetooth_enabled_; | 291 bool bluetooth_enabled_; |
| 267 float volume_; | |
| 268 bool caps_lock_enabled_; | 292 bool caps_lock_enabled_; |
| 269 gfx::ImageSkia null_image_; | 293 gfx::ImageSkia null_image_; |
| 294 scoped_ptr<VolumeControlDelegate> volume_control_delegate_; |
| 270 | 295 |
| 271 DISALLOW_COPY_AND_ASSIGN(DummySystemTrayDelegate); | 296 DISALLOW_COPY_AND_ASSIGN(DummySystemTrayDelegate); |
| 272 }; | 297 }; |
| 273 | 298 |
| 274 } // namespace | 299 } // namespace |
| 275 | 300 |
| 276 namespace internal { | 301 namespace internal { |
| 277 | 302 |
| 278 StatusAreaWidget::StatusAreaWidget() | 303 StatusAreaWidget::StatusAreaWidget() |
| 279 : status_area_widget_delegate_(new internal::StatusAreaWidgetDelegate), | 304 : status_area_widget_delegate_(new internal::StatusAreaWidgetDelegate), |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 return; | 399 return; |
| 375 login_status_ = login_status; | 400 login_status_ = login_status; |
| 376 if (system_tray_) | 401 if (system_tray_) |
| 377 system_tray_->UpdateAfterLoginStatusChange(login_status); | 402 system_tray_->UpdateAfterLoginStatusChange(login_status); |
| 378 if (web_notification_tray_) | 403 if (web_notification_tray_) |
| 379 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); | 404 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); |
| 380 } | 405 } |
| 381 | 406 |
| 382 } // namespace internal | 407 } // namespace internal |
| 383 } // namespace ash | 408 } // namespace ash |
| OLD | NEW |