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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 } | 607 } |
608 | 608 |
609 virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE { | 609 virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE { |
610 device::BluetoothDevice* device = bluetooth_adapter_->GetDevice(address); | 610 device::BluetoothDevice* device = bluetooth_adapter_->GetDevice(address); |
611 if (!device || device->IsConnecting()) | 611 if (!device || device->IsConnecting()) |
612 return; | 612 return; |
613 if (device->IsConnected()) { | 613 if (device->IsConnected()) { |
614 device->Disconnect( | 614 device->Disconnect( |
615 base::Bind(&base::DoNothing), | 615 base::Bind(&base::DoNothing), |
616 base::Bind(&BluetoothDeviceDisconnectError)); | 616 base::Bind(&BluetoothDeviceDisconnectError)); |
617 } else if (device->IsPaired()) { | 617 } else if (device->IsPaired() || !device->IsPairable()) { |
618 device->Connect( | 618 device->Connect( |
619 NULL, | 619 NULL, |
620 base::Bind(&base::DoNothing), | 620 base::Bind(&base::DoNothing), |
621 base::Bind(&BluetoothDeviceConnectError)); | 621 base::Bind(&BluetoothDeviceConnectError)); |
622 } else { // Show paring dialog for the unpaired device. | 622 } else { // Show paring dialog for the unpaired device. |
623 BluetoothPairingDialog* dialog = | 623 BluetoothPairingDialog* dialog = |
624 new BluetoothPairingDialog(GetNativeWindow(), device); | 624 new BluetoothPairingDialog(GetNativeWindow(), device); |
625 // The dialog deletes itself on close. | 625 // The dialog deletes itself on close. |
626 dialog->Show(); | 626 dialog->Show(); |
627 } | 627 } |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1583 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1584 }; | 1584 }; |
1585 | 1585 |
1586 } // namespace | 1586 } // namespace |
1587 | 1587 |
1588 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1588 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1589 return new chromeos::SystemTrayDelegate(); | 1589 return new chromeos::SystemTrayDelegate(); |
1590 } | 1590 } |
1591 | 1591 |
1592 } // namespace chromeos | 1592 } // namespace chromeos |
OLD | NEW |