Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/arc/bluetooth/arc_bluetooth_bridge.h" | 5 #include "components/arc/bluetooth/arc_bluetooth_bridge.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <iomanip> | 10 #include <iomanip> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 mojom::BluetoothInstance* bluetooth_instance = | 95 mojom::BluetoothInstance* bluetooth_instance = |
| 96 arc_bridge_service()->bluetooth()->instance(); | 96 arc_bridge_service()->bluetooth()->instance(); |
| 97 if (!bluetooth_instance) { | 97 if (!bluetooth_instance) { |
| 98 LOG(ERROR) << "OnBluetoothInstanceReady called, " | 98 LOG(ERROR) << "OnBluetoothInstanceReady called, " |
| 99 << "but no bluetooth instance found"; | 99 << "but no bluetooth instance found"; |
| 100 return; | 100 return; |
| 101 } | 101 } |
| 102 bluetooth_instance->Init(binding_.CreateInterfacePtrAndBind()); | 102 bluetooth_instance->Init(binding_.CreateInterfacePtrAndBind()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void ArcBluetoothBridge::AdapterPresentChanged(BluetoothAdapter* adapter, | 105 void ArcBluetoothBridge::AdapterPresentChanged(BluetoothAdapter* adapter, |
|
rkc
2016/07/22 19:59:48
Why is this override necessary at all?
If the adap
puthik_chromium
2016/07/22 22:46:13
Done.
| |
| 106 bool present) { | 106 bool present) { |
| 107 // If the adapter goes away, remove ourselves as an observer. | 107 // If the adapter goes away, remove ourselves as an observer. |
| 108 if (!present && adapter == bluetooth_adapter_) { | 108 if (!present && adapter == bluetooth_adapter_) { |
| 109 adapter->RemoveObserver(this); | 109 adapter->RemoveObserver(this); |
| 110 bluetooth_adapter_ = nullptr; | |
|
Luis Héctor Chávez
2016/07/22 01:53:24
is it guaranteed that the adapter (reference) will
| |
| 111 } | 110 } |
| 112 } | 111 } |
| 113 | 112 |
| 114 void ArcBluetoothBridge::AdapterPoweredChanged(BluetoothAdapter* adapter, | 113 void ArcBluetoothBridge::AdapterPoweredChanged(BluetoothAdapter* adapter, |
| 115 bool powered) { | 114 bool powered) { |
| 116 if (!HasBluetoothInstance()) | 115 if (!HasBluetoothInstance()) |
| 117 return; | 116 return; |
| 118 | 117 |
| 119 // TODO(smbarber): Invoke EnableAdapter or DisableAdapter via ARC bridge | 118 // TODO(smbarber): Invoke EnableAdapter or DisableAdapter via ARC bridge |
| 120 // service. | 119 // service. |
| (...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1354 uint32_t version_need) const { | 1353 uint32_t version_need) const { |
| 1355 uint32_t version = arc_bridge_service()->bluetooth()->version(); | 1354 uint32_t version = arc_bridge_service()->bluetooth()->version(); |
| 1356 if (version >= version_need) | 1355 if (version >= version_need) |
| 1357 return true; | 1356 return true; |
| 1358 LOG(WARNING) << "Bluetooth instance is too old (version " << version | 1357 LOG(WARNING) << "Bluetooth instance is too old (version " << version |
| 1359 << ") need version " << version_need; | 1358 << ") need version " << version_need; |
| 1360 return false; | 1359 return false; |
| 1361 } | 1360 } |
| 1362 | 1361 |
| 1363 } // namespace arc | 1362 } // namespace arc |
| OLD | NEW |