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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 | 169 |
170 void BluetoothDiscoveryFailure() { | 170 void BluetoothDiscoveryFailure() { |
171 // TODO(sad): Show an error bubble? | 171 // TODO(sad): Show an error bubble? |
172 } | 172 } |
173 | 173 |
174 void BluetoothDeviceDisconnectError() { | 174 void BluetoothDeviceDisconnectError() { |
175 // TODO(sad): Do something? | 175 // TODO(sad): Do something? |
176 } | 176 } |
177 | 177 |
| 178 void BluetoothSetDiscoveringError() { |
| 179 LOG(ERROR) << "BluetoothSetDiscovering failed."; |
| 180 } |
| 181 |
178 void BluetoothDeviceConnectError( | 182 void BluetoothDeviceConnectError( |
179 device::BluetoothDevice::ConnectErrorCode error_code) { | 183 device::BluetoothDevice::ConnectErrorCode error_code) { |
180 // TODO(sad): Do something? | 184 // TODO(sad): Do something? |
181 } | 185 } |
182 | 186 |
183 class SystemTrayDelegate : public ash::SystemTrayDelegate, | 187 class SystemTrayDelegate : public ash::SystemTrayDelegate, |
184 public AudioHandler::VolumeObserver, | 188 public AudioHandler::VolumeObserver, |
185 public PowerManagerClient::Observer, | 189 public PowerManagerClient::Observer, |
186 public RootPowerManagerObserver, | 190 public RootPowerManagerObserver, |
187 public SessionManagerClient::Observer, | 191 public SessionManagerClient::Observer, |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 virtual void RequestRestart() OVERRIDE { | 474 virtual void RequestRestart() OVERRIDE { |
471 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 475 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
472 } | 476 } |
473 | 477 |
474 virtual void GetAvailableBluetoothDevices( | 478 virtual void GetAvailableBluetoothDevices( |
475 ash::BluetoothDeviceList* list) OVERRIDE { | 479 ash::BluetoothDeviceList* list) OVERRIDE { |
476 device::BluetoothAdapter::DeviceList devices = | 480 device::BluetoothAdapter::DeviceList devices = |
477 bluetooth_adapter_->GetDevices(); | 481 bluetooth_adapter_->GetDevices(); |
478 for (size_t i = 0; i < devices.size(); ++i) { | 482 for (size_t i = 0; i < devices.size(); ++i) { |
479 device::BluetoothDevice* device = devices[i]; | 483 device::BluetoothDevice* device = devices[i]; |
480 if (!device->IsPaired()) | |
481 continue; | |
482 ash::BluetoothDeviceInfo info; | 484 ash::BluetoothDeviceInfo info; |
483 info.address = device->address(); | 485 info.address = device->address(); |
484 info.display_name = device->GetName(); | 486 info.display_name = device->GetName(); |
485 info.connected = device->IsConnected(); | 487 info.connected = device->IsConnected(); |
| 488 info.paired = device->IsPaired(); |
| 489 info.visible = device->IsVisible(); |
486 list->push_back(info); | 490 list->push_back(info); |
487 } | 491 } |
488 } | 492 } |
489 | 493 |
| 494 virtual void BluetoothSetDiscovering(bool value) OVERRIDE { |
| 495 bluetooth_adapter_->SetDiscovering(value, |
| 496 base::Bind(&base::DoNothing), |
| 497 base::Bind(&BluetoothSetDiscoveringError)); |
| 498 } |
| 499 |
490 virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE { | 500 virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE { |
491 device::BluetoothDevice* device = bluetooth_adapter_->GetDevice(address); | 501 device::BluetoothDevice* device = bluetooth_adapter_->GetDevice(address); |
492 if (!device) | 502 if (!device) |
493 return; | 503 return; |
494 if (device->IsConnected()) { | 504 if (device->IsConnected()) { |
495 device->Disconnect( | 505 device->Disconnect( |
496 base::Bind(&base::DoNothing), | 506 base::Bind(&base::DoNothing), |
497 base::Bind(&BluetoothDeviceDisconnectError)); | 507 base::Bind(&BluetoothDeviceDisconnectError)); |
498 } else if (device->IsPaired()) { | 508 } else if (device->IsPaired()) { |
499 device->Connect( | 509 device->Connect( |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1399 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1390 }; | 1400 }; |
1391 | 1401 |
1392 } // namespace | 1402 } // namespace |
1393 | 1403 |
1394 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1404 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1395 return new chromeos::SystemTrayDelegate(); | 1405 return new chromeos::SystemTrayDelegate(); |
1396 } | 1406 } |
1397 | 1407 |
1398 } // namespace chromeos | 1408 } // namespace chromeos |
OLD | NEW |