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/chromeos/system/ash_system_tray_delegate.h" | 5 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/system/audio/audio_observer.h" | 9 #include "ash/system/audio/audio_observer.h" |
| 10 #include "ash/system/bluetooth/bluetooth_observer.h" |
10 #include "ash/system/brightness/brightness_observer.h" | 11 #include "ash/system/brightness/brightness_observer.h" |
11 #include "ash/system/ime/ime_observer.h" | 12 #include "ash/system/ime/ime_observer.h" |
12 #include "ash/system/network/network_observer.h" | 13 #include "ash/system/network/network_observer.h" |
13 #include "ash/system/power/clock_observer.h" | 14 #include "ash/system/power/clock_observer.h" |
14 #include "ash/system/power/power_status_observer.h" | 15 #include "ash/system/power/power_status_observer.h" |
15 #include "ash/system/tray/system_tray.h" | 16 #include "ash/system/tray/system_tray.h" |
16 #include "ash/system/tray/system_tray_delegate.h" | 17 #include "ash/system/tray/system_tray_delegate.h" |
17 #include "ash/system/tray_accessibility.h" | 18 #include "ash/system/tray_accessibility.h" |
18 #include "ash/system/tray_caps_lock.h" | 19 #include "ash/system/tray_caps_lock.h" |
19 #include "ash/system/user/update_observer.h" | 20 #include "ash/system/user/update_observer.h" |
20 #include "ash/system/user/user_observer.h" | 21 #include "ash/system/user/user_observer.h" |
21 #include "base/logging.h" | 22 #include "base/logging.h" |
22 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
23 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
24 #include "chrome/browser/chromeos/audio/audio_handler.h" | 25 #include "chrome/browser/chromeos/audio/audio_handler.h" |
| 26 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" |
| 27 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" |
25 #include "chrome/browser/chromeos/cros/cros_library.h" | 28 #include "chrome/browser/chromeos/cros/cros_library.h" |
26 #include "chrome/browser/chromeos/cros/network_library.h" | 29 #include "chrome/browser/chromeos/cros/network_library.h" |
27 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 30 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
28 #include "chrome/browser/chromeos/dbus/power_manager_client.h" | 31 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
29 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 32 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
30 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 33 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
31 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" | 34 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" |
32 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 35 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
33 #include "chrome/browser/chromeos/login/base_login_display_host.h" | 36 #include "chrome/browser/chromeos/login/base_login_display_host.h" |
34 #include "chrome/browser/chromeos/login/login_display_host.h" | 37 #include "chrome/browser/chromeos/login/login_display_host.h" |
(...skipping 23 matching lines...) Expand all Loading... |
58 NetworkMenuIcon* network_icon, | 61 NetworkMenuIcon* network_icon, |
59 NetworkMenu* network_menu) { | 62 NetworkMenu* network_menu) { |
60 ash::NetworkIconInfo info; | 63 ash::NetworkIconInfo info; |
61 info.name = UTF8ToUTF16(network->name()); | 64 info.name = UTF8ToUTF16(network->name()); |
62 info.image = network_icon->GetBitmap(network, NetworkMenuIcon::SIZE_SMALL); | 65 info.image = network_icon->GetBitmap(network, NetworkMenuIcon::SIZE_SMALL); |
63 info.service_path = network->service_path(); | 66 info.service_path = network->service_path(); |
64 info.highlight = network_menu->ShouldHighlightNetwork(network); | 67 info.highlight = network_menu->ShouldHighlightNetwork(network); |
65 return info; | 68 return info; |
66 } | 69 } |
67 | 70 |
| 71 void BluetoothPowerFailure() { |
| 72 // TODO(sad): Show an error bubble? |
| 73 } |
| 74 |
| 75 void BluetoothDiscoveryFailure() { |
| 76 // TODO(sad): Show an error bubble? |
| 77 } |
| 78 |
68 class SystemTrayDelegate : public ash::SystemTrayDelegate, | 79 class SystemTrayDelegate : public ash::SystemTrayDelegate, |
69 public AudioHandler::VolumeObserver, | 80 public AudioHandler::VolumeObserver, |
70 public PowerManagerClient::Observer, | 81 public PowerManagerClient::Observer, |
71 public NetworkMenuIcon::Delegate, | 82 public NetworkMenuIcon::Delegate, |
72 public NetworkMenu::Delegate, | 83 public NetworkMenu::Delegate, |
73 public NetworkLibrary::NetworkManagerObserver, | 84 public NetworkLibrary::NetworkManagerObserver, |
74 public NetworkLibrary::NetworkObserver, | 85 public NetworkLibrary::NetworkObserver, |
75 public NetworkLibrary::CellularDataPlanObserver, | 86 public NetworkLibrary::CellularDataPlanObserver, |
76 public content::NotificationObserver, | 87 public content::NotificationObserver, |
77 public input_method::InputMethodManager::Observer, | 88 public input_method::InputMethodManager::Observer, |
78 public system::TimezoneSettings::Observer, | 89 public system::TimezoneSettings::Observer, |
| 90 public BluetoothAdapter::Observer, |
79 public SystemKeyEventListener::CapsLockObserver { | 91 public SystemKeyEventListener::CapsLockObserver { |
80 public: | 92 public: |
81 explicit SystemTrayDelegate(ash::SystemTray* tray) | 93 explicit SystemTrayDelegate(ash::SystemTray* tray) |
82 : tray_(tray), | 94 : tray_(tray), |
83 network_icon_(ALLOW_THIS_IN_INITIALIZER_LIST( | 95 network_icon_(ALLOW_THIS_IN_INITIALIZER_LIST( |
84 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), | 96 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), |
85 network_icon_large_(ALLOW_THIS_IN_INITIALIZER_LIST( | 97 network_icon_large_(ALLOW_THIS_IN_INITIALIZER_LIST( |
86 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), | 98 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), |
87 network_menu_(ALLOW_THIS_IN_INITIALIZER_LIST(new NetworkMenu(this))), | 99 network_menu_(ALLOW_THIS_IN_INITIALIZER_LIST(new NetworkMenu(this))), |
88 clock_type_(base::k24HourClock) { | 100 clock_type_(base::k24HourClock) { |
(...skipping 26 matching lines...) Expand all Loading... |
115 registrar_.Add(this, | 127 registrar_.Add(this, |
116 chrome::NOTIFICATION_SESSION_STARTED, | 128 chrome::NOTIFICATION_SESSION_STARTED, |
117 content::NotificationService::AllSources()); | 129 content::NotificationService::AllSources()); |
118 | 130 |
119 SetProfile(ProfileManager::GetDefaultProfile()); | 131 SetProfile(ProfileManager::GetDefaultProfile()); |
120 | 132 |
121 network_icon_large_->SetResourceSize(NetworkMenuIcon::SIZE_LARGE); | 133 network_icon_large_->SetResourceSize(NetworkMenuIcon::SIZE_LARGE); |
122 | 134 |
123 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, | 135 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, |
124 g_browser_process->local_state(), this); | 136 g_browser_process->local_state(), this); |
| 137 |
| 138 bluetooth_adapter_.reset(BluetoothAdapter::CreateDefaultAdapter()); |
| 139 bluetooth_adapter_->AddObserver(this); |
125 } | 140 } |
126 | 141 |
127 virtual ~SystemTrayDelegate() { | 142 virtual ~SystemTrayDelegate() { |
128 AudioHandler* audiohandler = AudioHandler::GetInstance(); | 143 AudioHandler* audiohandler = AudioHandler::GetInstance(); |
129 if (audiohandler) | 144 if (audiohandler) |
130 audiohandler->RemoveVolumeObserver(this); | 145 audiohandler->RemoveVolumeObserver(this); |
131 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 146 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
132 input_method::InputMethodManager::GetInstance()->RemoveObserver(this); | 147 input_method::InputMethodManager::GetInstance()->RemoveObserver(this); |
133 system::TimezoneSettings::GetInstance()->RemoveObserver(this); | 148 system::TimezoneSettings::GetInstance()->RemoveObserver(this); |
134 if (SystemKeyEventListener::GetInstance()) | 149 if (SystemKeyEventListener::GetInstance()) |
135 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); | 150 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); |
| 151 bluetooth_adapter_->RemoveObserver(this); |
136 } | 152 } |
137 | 153 |
138 // Overridden from ash::SystemTrayDelegate: | 154 // Overridden from ash::SystemTrayDelegate: |
139 virtual const std::string GetUserDisplayName() const OVERRIDE { | 155 virtual const std::string GetUserDisplayName() const OVERRIDE { |
140 return UserManager::Get()->GetLoggedInUser().GetDisplayName(); | 156 return UserManager::Get()->GetLoggedInUser().GetDisplayName(); |
141 } | 157 } |
142 | 158 |
143 virtual const std::string GetUserEmail() const OVERRIDE { | 159 virtual const std::string GetUserEmail() const OVERRIDE { |
144 return UserManager::Get()->GetLoggedInUser().email(); | 160 return UserManager::Get()->GetLoggedInUser().email(); |
145 } | 161 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 202 } |
187 | 203 |
188 virtual void ShowDateSettings() OVERRIDE { | 204 virtual void ShowDateSettings() OVERRIDE { |
189 GetAppropriateBrowser()->OpenAdvancedOptionsDialog(); | 205 GetAppropriateBrowser()->OpenAdvancedOptionsDialog(); |
190 } | 206 } |
191 | 207 |
192 virtual void ShowNetworkSettings() OVERRIDE { | 208 virtual void ShowNetworkSettings() OVERRIDE { |
193 GetAppropriateBrowser()->OpenInternetOptionsDialog(); | 209 GetAppropriateBrowser()->OpenInternetOptionsDialog(); |
194 } | 210 } |
195 | 211 |
| 212 virtual void ShowBluetoothSettings() OVERRIDE { |
| 213 // TODO(sad): Make this work. |
| 214 } |
| 215 |
196 virtual void ShowHelp() OVERRIDE { | 216 virtual void ShowHelp() OVERRIDE { |
197 GetAppropriateBrowser()->ShowHelpTab(); | 217 GetAppropriateBrowser()->ShowHelpTab(); |
198 } | 218 } |
199 | 219 |
200 virtual bool IsAudioMuted() const OVERRIDE { | 220 virtual bool IsAudioMuted() const OVERRIDE { |
201 return AudioHandler::GetInstance()->IsMuted(); | 221 return AudioHandler::GetInstance()->IsMuted(); |
202 } | 222 } |
203 | 223 |
204 virtual void SetAudioMuted(bool muted) OVERRIDE { | 224 virtual void SetAudioMuted(bool muted) OVERRIDE { |
205 return AudioHandler::GetInstance()->SetMuted(muted); | 225 return AudioHandler::GetInstance()->SetMuted(muted); |
(...skipping 23 matching lines...) Expand all Loading... |
229 | 249 |
230 virtual void SignOut() OVERRIDE { | 250 virtual void SignOut() OVERRIDE { |
231 BrowserList::AttemptUserExit(); | 251 BrowserList::AttemptUserExit(); |
232 } | 252 } |
233 | 253 |
234 virtual void RequestLockScreen() OVERRIDE { | 254 virtual void RequestLockScreen() OVERRIDE { |
235 DBusThreadManager::Get()->GetPowerManagerClient()-> | 255 DBusThreadManager::Get()->GetPowerManagerClient()-> |
236 NotifyScreenLockRequested(); | 256 NotifyScreenLockRequested(); |
237 } | 257 } |
238 | 258 |
239 virtual ash::IMEInfoList GetAvailableIMEList() OVERRIDE { | 259 virtual void GetAvailableBluetoothDevices( |
240 ash::IMEInfoList list; | 260 ash::BluetoothDeviceList* list) OVERRIDE { |
| 261 BluetoothAdapter::DeviceList devices = bluetooth_adapter_->GetDevices(); |
| 262 for (size_t i = 0; i < devices.size(); ++i) { |
| 263 BluetoothDevice* device = devices[i]; |
| 264 ash::BluetoothDeviceInfo info; |
| 265 info.address = device->address(); |
| 266 info.display_name = device->GetName(); |
| 267 info.connected = device->IsConnected(); |
| 268 list->push_back(info); |
| 269 } |
| 270 } |
| 271 |
| 272 virtual void GetAvailableIMEList(ash::IMEInfoList* list) OVERRIDE { |
241 input_method::InputMethodManager* manager = | 273 input_method::InputMethodManager* manager = |
242 input_method::InputMethodManager::GetInstance(); | 274 input_method::InputMethodManager::GetInstance(); |
243 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); | 275 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); |
244 scoped_ptr<input_method::InputMethodDescriptors> ime_descriptors( | 276 scoped_ptr<input_method::InputMethodDescriptors> ime_descriptors( |
245 manager->GetActiveInputMethods()); | 277 manager->GetActiveInputMethods()); |
246 std::string current = manager->GetCurrentInputMethod().id(); | 278 std::string current = manager->GetCurrentInputMethod().id(); |
247 for (size_t i = 0; i < ime_descriptors->size(); i++) { | 279 for (size_t i = 0; i < ime_descriptors->size(); i++) { |
248 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i); | 280 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i); |
249 ash::IMEInfo info; | 281 ash::IMEInfo info; |
250 info.id = ime.id(); | 282 info.id = ime.id(); |
251 info.name = UTF8ToUTF16(util->GetInputMethodDisplayNameFromId(info.id)); | 283 info.name = UTF8ToUTF16(util->GetInputMethodDisplayNameFromId(info.id)); |
252 info.short_name = util->GetInputMethodShortName(ime); | 284 info.short_name = util->GetInputMethodShortName(ime); |
253 info.selected = ime.id() == current; | 285 info.selected = ime.id() == current; |
254 list.push_back(info); | 286 list->push_back(info); |
255 } | 287 } |
256 return list; | |
257 } | 288 } |
258 | 289 |
259 virtual ash::NetworkIconInfo GetMostRelevantNetworkIcon(bool large) OVERRIDE { | 290 virtual ash::NetworkIconInfo GetMostRelevantNetworkIcon(bool large) OVERRIDE { |
260 ash::NetworkIconInfo info; | 291 ash::NetworkIconInfo info; |
261 info.image = !large ? network_icon_->GetIconAndText(&info.description) : | 292 info.image = !large ? network_icon_->GetIconAndText(&info.description) : |
262 network_icon_large_->GetIconAndText(&info.description); | 293 network_icon_large_->GetIconAndText(&info.description); |
263 return info; | 294 return info; |
264 } | 295 } |
265 | 296 |
266 virtual void GetAvailableNetworks( | 297 virtual void GetAvailableNetworks( |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 } | 351 } |
321 } | 352 } |
322 | 353 |
323 virtual void ConnectToNetwork(const std::string& network_id) OVERRIDE { | 354 virtual void ConnectToNetwork(const std::string& network_id) OVERRIDE { |
324 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 355 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
325 Network* network = crosnet->FindNetworkByPath(network_id); | 356 Network* network = crosnet->FindNetworkByPath(network_id); |
326 if (network) | 357 if (network) |
327 network_menu_->ConnectToNetwork(network); | 358 network_menu_->ConnectToNetwork(network); |
328 } | 359 } |
329 | 360 |
| 361 virtual void AddBluetoothDevice() OVERRIDE { |
| 362 // Opening the device dialog does not actually start the discovery process. |
| 363 // So make an explicit call to start it. |
| 364 GetAppropriateBrowser()->OpenAddBluetoothDeviceDialog(); |
| 365 bluetooth_adapter_->SetDiscovering(true, |
| 366 base::Bind(&BluetoothDiscoveryFailure)); |
| 367 } |
| 368 |
330 virtual void ToggleAirplaneMode() OVERRIDE { | 369 virtual void ToggleAirplaneMode() OVERRIDE { |
331 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 370 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
332 crosnet->EnableOfflineMode(!crosnet->offline_mode()); | 371 crosnet->EnableOfflineMode(!crosnet->offline_mode()); |
333 } | 372 } |
334 | 373 |
335 virtual void ToggleWifi() OVERRIDE { | 374 virtual void ToggleWifi() OVERRIDE { |
336 network_menu_->ToggleWifi(); | 375 network_menu_->ToggleWifi(); |
337 } | 376 } |
338 | 377 |
339 virtual void ToggleCellular() OVERRIDE { | 378 virtual void ToggleCellular() OVERRIDE { |
340 network_menu_->ToggleCellular(); | 379 network_menu_->ToggleCellular(); |
341 } | 380 } |
342 | 381 |
| 382 virtual void ToggleBluetooth() OVERRIDE { |
| 383 bluetooth_adapter_->SetPowered(!bluetooth_adapter_->IsPowered(), |
| 384 base::Bind(&BluetoothPowerFailure)); |
| 385 } |
| 386 |
343 virtual bool GetWifiAvailable() OVERRIDE { | 387 virtual bool GetWifiAvailable() OVERRIDE { |
344 return CrosLibrary::Get()->GetNetworkLibrary()->wifi_available(); | 388 return CrosLibrary::Get()->GetNetworkLibrary()->wifi_available(); |
345 } | 389 } |
346 | 390 |
347 virtual bool GetCellularAvailable() OVERRIDE { | 391 virtual bool GetCellularAvailable() OVERRIDE { |
348 return CrosLibrary::Get()->GetNetworkLibrary()->cellular_available(); | 392 return CrosLibrary::Get()->GetNetworkLibrary()->cellular_available(); |
349 } | 393 } |
350 | 394 |
| 395 virtual bool GetBluetoothAvailable() OVERRIDE { |
| 396 return bluetooth_adapter_->IsPresent(); |
| 397 } |
| 398 |
351 virtual bool GetWifiEnabled() OVERRIDE { | 399 virtual bool GetWifiEnabled() OVERRIDE { |
352 return CrosLibrary::Get()->GetNetworkLibrary()->wifi_enabled(); | 400 return CrosLibrary::Get()->GetNetworkLibrary()->wifi_enabled(); |
353 } | 401 } |
354 | 402 |
355 virtual bool GetCellularEnabled() OVERRIDE { | 403 virtual bool GetCellularEnabled() OVERRIDE { |
356 return CrosLibrary::Get()->GetNetworkLibrary()->cellular_enabled(); | 404 return CrosLibrary::Get()->GetNetworkLibrary()->cellular_enabled(); |
357 } | 405 } |
358 | 406 |
| 407 virtual bool GetBluetoothEnabled() OVERRIDE { |
| 408 return bluetooth_adapter_->IsPowered(); |
| 409 } |
| 410 |
359 virtual void ChangeProxySettings() OVERRIDE { | 411 virtual void ChangeProxySettings() OVERRIDE { |
360 CHECK(GetUserLoginStatus() == ash::user::LOGGED_IN_NONE); | 412 CHECK(GetUserLoginStatus() == ash::user::LOGGED_IN_NONE); |
361 BaseLoginDisplayHost::default_host()->OpenProxySettings(); | 413 BaseLoginDisplayHost::default_host()->OpenProxySettings(); |
362 } | 414 } |
363 | 415 |
364 private: | 416 private: |
365 // Returns the last active browser. If there is no such browser, creates a new | 417 // Returns the last active browser. If there is no such browser, creates a new |
366 // browser window with an empty tab and returns it. | 418 // browser window with an empty tab and returns it. |
367 Browser* GetAppropriateBrowser() { | 419 Browser* GetAppropriateBrowser() { |
368 Browser* browser = BrowserList::GetLastActive(); | 420 Browser* browser = BrowserList::GetLastActive(); |
(...skipping 30 matching lines...) Expand all Loading... |
399 void NotifyRefreshNetwork() { | 451 void NotifyRefreshNetwork() { |
400 ash::NetworkObserver* observer = | 452 ash::NetworkObserver* observer = |
401 ash::Shell::GetInstance()->tray()->network_observer(); | 453 ash::Shell::GetInstance()->tray()->network_observer(); |
402 if (observer) { | 454 if (observer) { |
403 ash::NetworkIconInfo info; | 455 ash::NetworkIconInfo info; |
404 info.image = network_icon_->GetIconAndText(&info.description); | 456 info.image = network_icon_->GetIconAndText(&info.description); |
405 observer->OnNetworkRefresh(info); | 457 observer->OnNetworkRefresh(info); |
406 } | 458 } |
407 } | 459 } |
408 | 460 |
| 461 void NotifyRefreshBluetooth() { |
| 462 ash::BluetoothObserver* observer = |
| 463 ash::Shell::GetInstance()->tray()->bluetooth_observer(); |
| 464 if (observer) |
| 465 observer->OnBluetoothRefresh(); |
| 466 } |
| 467 |
409 void NotifyRefreshIME() { | 468 void NotifyRefreshIME() { |
410 ash::IMEObserver* observer = | 469 ash::IMEObserver* observer = |
411 ash::Shell::GetInstance()->tray()->ime_observer(); | 470 ash::Shell::GetInstance()->tray()->ime_observer(); |
412 if (observer) | 471 if (observer) |
413 observer->OnIMERefresh(); | 472 observer->OnIMERefresh(); |
414 } | 473 } |
415 | 474 |
416 void RefreshNetworkObserver(NetworkLibrary* crosnet) { | 475 void RefreshNetworkObserver(NetworkLibrary* crosnet) { |
417 const Network* network = crosnet->active_network(); | 476 const Network* network = crosnet->active_network(); |
418 std::string new_path = network ? network->service_path() : std::string(); | 477 std::string new_path = network ? network->service_path() : std::string(); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 input_method::InputMethodManager* manager, | 642 input_method::InputMethodManager* manager, |
584 const input_method::InputMethodPropertyList& properties) OVERRIDE { | 643 const input_method::InputMethodPropertyList& properties) OVERRIDE { |
585 NotifyRefreshIME(); | 644 NotifyRefreshIME(); |
586 } | 645 } |
587 | 646 |
588 // Overridden from system::TimezoneSettings::Observer. | 647 // Overridden from system::TimezoneSettings::Observer. |
589 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE { | 648 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE { |
590 NotifyRefreshClock(); | 649 NotifyRefreshClock(); |
591 } | 650 } |
592 | 651 |
| 652 // Overridden from BluetoothAdapter::Observer. |
| 653 virtual void AdapterPresentChanged(BluetoothAdapter* adapter, |
| 654 bool present) OVERRIDE { |
| 655 NotifyRefreshBluetooth(); |
| 656 } |
| 657 |
| 658 virtual void AdapterPoweredChanged(BluetoothAdapter* adapter, |
| 659 bool powered) OVERRIDE { |
| 660 NotifyRefreshBluetooth(); |
| 661 } |
| 662 |
| 663 virtual void AdapterDiscoveringChanged(BluetoothAdapter* adapter, |
| 664 bool discovering) OVERRIDE { |
| 665 // TODO: Perhaps start/stop throbbing the icon, or some other visual |
| 666 // effects? |
| 667 } |
| 668 |
| 669 virtual void DeviceAdded(BluetoothAdapter* adapter, |
| 670 BluetoothDevice* device) OVERRIDE { |
| 671 NotifyRefreshBluetooth(); |
| 672 } |
| 673 |
| 674 virtual void DeviceChanged(BluetoothAdapter* adapter, |
| 675 BluetoothDevice* device) OVERRIDE { |
| 676 NotifyRefreshBluetooth(); |
| 677 } |
| 678 |
| 679 virtual void DeviceRemoved(BluetoothAdapter* adapter, |
| 680 BluetoothDevice* device) OVERRIDE { |
| 681 NotifyRefreshBluetooth(); |
| 682 } |
| 683 |
593 // Overridden from SystemKeyEventListener::CapsLockObserver. | 684 // Overridden from SystemKeyEventListener::CapsLockObserver. |
594 virtual void OnCapsLockChange(bool enabled) OVERRIDE { | 685 virtual void OnCapsLockChange(bool enabled) OVERRIDE { |
595 ash::CapsLockObserver* observer = | 686 ash::CapsLockObserver* observer = |
596 ash::Shell::GetInstance()->tray()->caps_lock_observer(); | 687 ash::Shell::GetInstance()->tray()->caps_lock_observer(); |
597 if (observer) | 688 if (observer) |
598 observer->OnCapsLockChanged(enabled); | 689 observer->OnCapsLockChanged(enabled); |
599 } | 690 } |
600 | 691 |
601 ash::SystemTray* tray_; | 692 ash::SystemTray* tray_; |
602 scoped_ptr<NetworkMenuIcon> network_icon_; | 693 scoped_ptr<NetworkMenuIcon> network_icon_; |
603 scoped_ptr<NetworkMenuIcon> network_icon_large_; | 694 scoped_ptr<NetworkMenuIcon> network_icon_large_; |
604 scoped_ptr<NetworkMenu> network_menu_; | 695 scoped_ptr<NetworkMenu> network_menu_; |
605 content::NotificationRegistrar registrar_; | 696 content::NotificationRegistrar registrar_; |
606 scoped_ptr<PrefChangeRegistrar> pref_registrar_; | 697 scoped_ptr<PrefChangeRegistrar> pref_registrar_; |
607 std::string cellular_device_path_; | 698 std::string cellular_device_path_; |
608 std::string active_network_path_; | 699 std::string active_network_path_; |
609 scoped_ptr<LoginHtmlDialog> proxy_settings_dialog_; | 700 scoped_ptr<LoginHtmlDialog> proxy_settings_dialog_; |
610 PowerSupplyStatus power_supply_status_; | 701 PowerSupplyStatus power_supply_status_; |
611 base::HourClockType clock_type_; | 702 base::HourClockType clock_type_; |
612 | 703 |
| 704 scoped_ptr<BluetoothAdapter> bluetooth_adapter_; |
| 705 |
613 BooleanPrefMember accessibility_enabled_; | 706 BooleanPrefMember accessibility_enabled_; |
614 | 707 |
615 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 708 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
616 }; | 709 }; |
617 | 710 |
618 } // namespace | 711 } // namespace |
619 | 712 |
620 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { | 713 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { |
621 return new chromeos::SystemTrayDelegate(tray); | 714 return new chromeos::SystemTrayDelegate(tray); |
622 } | 715 } |
623 | 716 |
624 } // namespace chromeos | 717 } // namespace chromeos |
OLD | NEW |