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" | |
13 #include "ash/system/status_area_widget_delegate.h" | 12 #include "ash/system/status_area_widget_delegate.h" |
14 #include "ash/system/tray/system_tray.h" | 13 #include "ash/system/tray/system_tray.h" |
15 #include "ash/system/tray/system_tray_delegate.h" | 14 #include "ash/system/tray/system_tray_delegate.h" |
16 #include "ash/system/web_notification/web_notification_tray.h" | 15 #include "ash/system/web_notification/web_notification_tray.h" |
17 #include "ash/volume_control_delegate.h" | 16 #include "ash/volume_control_delegate.h" |
18 #include "ash/wm/shelf_layout_manager.h" | 17 #include "ash/wm/shelf_layout_manager.h" |
19 #include "ash/wm/window_properties.h" | 18 #include "ash/wm/window_properties.h" |
20 #include "base/i18n/time_formatting.h" | 19 #include "base/i18n/time_formatting.h" |
21 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
22 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
53 virtual void SetVolumeLevel(float level) OVERRIDE { | 52 virtual void SetVolumeLevel(float level) OVERRIDE { |
54 } | 53 } |
55 | 54 |
56 private: | 55 private: |
57 DISALLOW_COPY_AND_ASSIGN(DummyVolumeControlDelegate); | 56 DISALLOW_COPY_AND_ASSIGN(DummyVolumeControlDelegate); |
58 }; | 57 }; |
59 | 58 |
60 class DummySystemTrayDelegate : public SystemTrayDelegate { | 59 class DummySystemTrayDelegate : public SystemTrayDelegate { |
61 public: | 60 public: |
62 DummySystemTrayDelegate() | 61 DummySystemTrayDelegate() |
63 : wifi_enabled_(true), | 62 : caps_lock_enabled_(false), |
64 cellular_enabled_(true), | |
65 bluetooth_enabled_(true), | |
66 caps_lock_enabled_(false), | |
67 volume_control_delegate_( | 63 volume_control_delegate_( |
68 ALLOW_THIS_IN_INITIALIZER_LIST(new DummyVolumeControlDelegate)) { | 64 ALLOW_THIS_IN_INITIALIZER_LIST(new DummyVolumeControlDelegate)) { |
69 } | 65 } |
70 | 66 |
71 virtual ~DummySystemTrayDelegate() {} | 67 virtual ~DummySystemTrayDelegate() {} |
72 | 68 |
73 private: | 69 private: |
74 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { return true; } | 70 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { return true; } |
75 | 71 |
76 // Overridden from SystemTrayDelegate: | 72 // Overridden from SystemTrayDelegate: |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 virtual void RequestNetworkScan() OVERRIDE { | 188 virtual void RequestNetworkScan() OVERRIDE { |
193 } | 189 } |
194 | 190 |
195 virtual void AddBluetoothDevice() OVERRIDE { | 191 virtual void AddBluetoothDevice() OVERRIDE { |
196 } | 192 } |
197 | 193 |
198 virtual void ToggleAirplaneMode() OVERRIDE { | 194 virtual void ToggleAirplaneMode() OVERRIDE { |
199 } | 195 } |
200 | 196 |
201 virtual void ToggleWifi() OVERRIDE { | 197 virtual void ToggleWifi() OVERRIDE { |
202 wifi_enabled_ = !wifi_enabled_; | |
203 ash::NetworkObserver* observer = | |
204 ash::Shell::GetInstance()->system_tray()->network_observer(); | |
205 if (observer) { | |
206 ash::NetworkIconInfo info; | |
207 observer->OnNetworkRefresh(info); | |
208 } | |
209 } | 198 } |
210 | 199 |
211 virtual void ToggleMobile() OVERRIDE { | 200 virtual void ToggleMobile() OVERRIDE { |
212 cellular_enabled_ = !cellular_enabled_; | |
213 ash::NetworkObserver* observer = | |
214 ash::Shell::GetInstance()->system_tray()->network_observer(); | |
215 if (observer) { | |
216 ash::NetworkIconInfo info; | |
217 observer->OnNetworkRefresh(info); | |
218 } | |
219 } | 201 } |
220 | 202 |
221 virtual void ToggleBluetooth() OVERRIDE { | 203 virtual void ToggleBluetooth() OVERRIDE { |
222 bluetooth_enabled_ = !bluetooth_enabled_; | |
223 ash::BluetoothObserver* observer = | |
224 ash::Shell::GetInstance()->system_tray()->bluetooth_observer(); | |
225 if (observer) | |
226 observer->OnBluetoothRefresh(); | |
227 } | 204 } |
228 | 205 |
229 virtual void ShowOtherWifi() OVERRIDE { | 206 virtual void ShowOtherWifi() OVERRIDE { |
230 } | 207 } |
231 | 208 |
232 virtual void ShowOtherCellular() OVERRIDE { | 209 virtual void ShowOtherCellular() OVERRIDE { |
233 } | 210 } |
234 | 211 |
235 virtual bool IsNetworkConnected() OVERRIDE { | 212 virtual bool IsNetworkConnected() OVERRIDE { |
236 return true; | 213 return true; |
237 } | 214 } |
238 | 215 |
239 virtual bool GetWifiAvailable() OVERRIDE { | 216 virtual bool GetWifiAvailable() OVERRIDE { |
240 return true; | 217 return true; |
241 } | 218 } |
242 | 219 |
243 virtual bool GetMobileAvailable() OVERRIDE { | 220 virtual bool GetMobileAvailable() OVERRIDE { |
244 return true; | 221 return true; |
245 } | 222 } |
246 | 223 |
247 virtual bool GetBluetoothAvailable() OVERRIDE { | 224 virtual bool GetBluetoothAvailable() OVERRIDE { |
248 return true; | 225 return true; |
249 } | 226 } |
250 | 227 |
251 virtual bool GetWifiEnabled() OVERRIDE { | 228 virtual bool GetWifiEnabled() OVERRIDE { |
252 return wifi_enabled_; | 229 return false; |
253 } | 230 } |
254 | 231 |
255 virtual bool GetMobileEnabled() OVERRIDE { | 232 virtual bool GetMobileEnabled() OVERRIDE { |
256 return cellular_enabled_; | 233 return false; |
257 } | 234 } |
258 | 235 |
259 virtual bool GetBluetoothEnabled() OVERRIDE { | 236 virtual bool GetBluetoothEnabled() OVERRIDE { |
260 return bluetooth_enabled_; | 237 return false; |
261 } | 238 } |
262 | 239 |
263 virtual bool GetMobileScanSupported() OVERRIDE { | 240 virtual bool GetMobileScanSupported() OVERRIDE { |
264 return true; | 241 return true; |
265 } | 242 } |
266 | 243 |
267 virtual bool GetCellularCarrierInfo(std::string* carrier_id, | 244 virtual bool GetCellularCarrierInfo(std::string* carrier_id, |
268 std::string* topup_url, | 245 std::string* topup_url, |
269 std::string* setup_url) OVERRIDE { | 246 std::string* setup_url) OVERRIDE { |
270 return false; | 247 return false; |
271 } | 248 } |
272 | 249 |
273 virtual void ShowCellularURL(const std::string& url) OVERRIDE { | 250 virtual void ShowCellularURL(const std::string& url) OVERRIDE { |
274 } | 251 } |
275 | 252 |
276 virtual void ChangeProxySettings() OVERRIDE { | 253 virtual void ChangeProxySettings() OVERRIDE { |
277 } | 254 } |
278 | 255 |
279 virtual VolumeControlDelegate* GetVolumeControlDelegate() const OVERRIDE { | 256 virtual VolumeControlDelegate* GetVolumeControlDelegate() const OVERRIDE { |
280 return volume_control_delegate_.get(); | 257 return volume_control_delegate_.get(); |
281 } | 258 } |
282 | 259 |
283 virtual void SetVolumeControlDelegate( | 260 virtual void SetVolumeControlDelegate( |
284 scoped_ptr<VolumeControlDelegate> delegate) OVERRIDE { | 261 scoped_ptr<VolumeControlDelegate> delegate) OVERRIDE { |
285 volume_control_delegate_.swap(delegate); | 262 volume_control_delegate_.swap(delegate); |
286 } | 263 } |
287 | 264 |
288 | 265 |
289 bool wifi_enabled_; | |
290 bool cellular_enabled_; | |
291 bool bluetooth_enabled_; | |
sadrul
2012/10/09 14:40:58
Why are these removed?
stevenjb
2012/10/09 19:04:14
Restored.
| |
292 bool caps_lock_enabled_; | 266 bool caps_lock_enabled_; |
293 gfx::ImageSkia null_image_; | 267 gfx::ImageSkia null_image_; |
294 scoped_ptr<VolumeControlDelegate> volume_control_delegate_; | 268 scoped_ptr<VolumeControlDelegate> volume_control_delegate_; |
295 | 269 |
296 DISALLOW_COPY_AND_ASSIGN(DummySystemTrayDelegate); | 270 DISALLOW_COPY_AND_ASSIGN(DummySystemTrayDelegate); |
297 }; | 271 }; |
298 | 272 |
299 } // namespace | 273 } // namespace |
300 | 274 |
301 namespace internal { | 275 namespace internal { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 return; | 395 return; |
422 login_status_ = login_status; | 396 login_status_ = login_status; |
423 if (system_tray_) | 397 if (system_tray_) |
424 system_tray_->UpdateAfterLoginStatusChange(login_status); | 398 system_tray_->UpdateAfterLoginStatusChange(login_status); |
425 if (web_notification_tray_) | 399 if (web_notification_tray_) |
426 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); | 400 web_notification_tray_->UpdateAfterLoginStatusChange(login_status); |
427 } | 401 } |
428 | 402 |
429 } // namespace internal | 403 } // namespace internal |
430 } // namespace ash | 404 } // namespace ash |
OLD | NEW |