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 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 virtual void GetAvailableBluetoothDevices( | 581 virtual void GetAvailableBluetoothDevices( |
582 ash::BluetoothDeviceList* list) OVERRIDE { | 582 ash::BluetoothDeviceList* list) OVERRIDE { |
583 device::BluetoothAdapter::DeviceList devices = | 583 device::BluetoothAdapter::DeviceList devices = |
584 bluetooth_adapter_->GetDevices(); | 584 bluetooth_adapter_->GetDevices(); |
585 for (size_t i = 0; i < devices.size(); ++i) { | 585 for (size_t i = 0; i < devices.size(); ++i) { |
586 device::BluetoothDevice* device = devices[i]; | 586 device::BluetoothDevice* device = devices[i]; |
587 ash::BluetoothDeviceInfo info; | 587 ash::BluetoothDeviceInfo info; |
588 info.address = device->GetAddress(); | 588 info.address = device->GetAddress(); |
589 info.display_name = device->GetName(); | 589 info.display_name = device->GetName(); |
590 info.connected = device->IsConnected(); | 590 info.connected = device->IsConnected(); |
| 591 info.connecting = device->IsConnecting(); |
591 info.paired = device->IsPaired(); | 592 info.paired = device->IsPaired(); |
592 list->push_back(info); | 593 list->push_back(info); |
593 } | 594 } |
594 } | 595 } |
595 | 596 |
596 virtual void BluetoothStartDiscovering() OVERRIDE { | 597 virtual void BluetoothStartDiscovering() OVERRIDE { |
597 bluetooth_adapter_->StartDiscovering( | 598 bluetooth_adapter_->StartDiscovering( |
598 base::Bind(&base::DoNothing), | 599 base::Bind(&base::DoNothing), |
599 base::Bind(&BluetoothSetDiscoveringError)); | 600 base::Bind(&BluetoothSetDiscoveringError)); |
600 } | 601 } |
601 | 602 |
602 virtual void BluetoothStopDiscovering() OVERRIDE { | 603 virtual void BluetoothStopDiscovering() OVERRIDE { |
603 bluetooth_adapter_->StopDiscovering( | 604 bluetooth_adapter_->StopDiscovering( |
604 base::Bind(&base::DoNothing), | 605 base::Bind(&base::DoNothing), |
605 base::Bind(&BluetoothSetDiscoveringError)); | 606 base::Bind(&BluetoothSetDiscoveringError)); |
606 } | 607 } |
607 | 608 |
608 virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE { | 609 virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE { |
609 device::BluetoothDevice* device = bluetooth_adapter_->GetDevice(address); | 610 device::BluetoothDevice* device = bluetooth_adapter_->GetDevice(address); |
610 if (!device) | 611 if (!device || device->IsConnecting()) |
611 return; | 612 return; |
612 if (device->IsConnected()) { | 613 if (device->IsConnected()) { |
613 device->Disconnect( | 614 device->Disconnect( |
614 base::Bind(&base::DoNothing), | 615 base::Bind(&base::DoNothing), |
615 base::Bind(&BluetoothDeviceDisconnectError)); | 616 base::Bind(&BluetoothDeviceDisconnectError)); |
616 } else if (device->IsPaired()) { | 617 } else if (device->IsPaired()) { |
617 device->Connect( | 618 device->Connect( |
618 NULL, | 619 NULL, |
619 base::Bind(&base::DoNothing), | 620 base::Bind(&base::DoNothing), |
620 base::Bind(&BluetoothDeviceConnectError)); | 621 base::Bind(&BluetoothDeviceConnectError)); |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1583 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1583 }; | 1584 }; |
1584 | 1585 |
1585 } // namespace | 1586 } // namespace |
1586 | 1587 |
1587 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1588 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1588 return new chromeos::SystemTrayDelegate(); | 1589 return new chromeos::SystemTrayDelegate(); |
1589 } | 1590 } |
1590 | 1591 |
1591 } // namespace chromeos | 1592 } // namespace chromeos |
OLD | NEW |