Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(796)

Side by Side Diff: components/arc/bluetooth/arc_bluetooth_bridge.cc

Issue 2172063002: arc: bluetooth: Don't unset bluetooth_adapter_ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/arc/bluetooth/arc_bluetooth_bridge.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <bluetooth/bluetooth.h> 7 #include <bluetooth/bluetooth.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 mojom::BluetoothInstance* bluetooth_instance = 183 mojom::BluetoothInstance* bluetooth_instance =
184 arc_bridge_service()->bluetooth()->instance(); 184 arc_bridge_service()->bluetooth()->instance();
185 if (!bluetooth_instance) { 185 if (!bluetooth_instance) {
186 LOG(ERROR) << "OnBluetoothInstanceReady called, " 186 LOG(ERROR) << "OnBluetoothInstanceReady called, "
187 << "but no bluetooth instance found"; 187 << "but no bluetooth instance found";
188 return; 188 return;
189 } 189 }
190 bluetooth_instance->Init(binding_.CreateInterfacePtrAndBind()); 190 bluetooth_instance->Init(binding_.CreateInterfacePtrAndBind());
191 } 191 }
192 192
193 void ArcBluetoothBridge::AdapterPresentChanged(BluetoothAdapter* adapter,
194 bool present) {
195 DCHECK(CalledOnValidThread());
196
197 // If the adapter goes away, remove ourselves as an observer.
198 if (!present && adapter == bluetooth_adapter_) {
199 adapter->RemoveObserver(this);
200 bluetooth_adapter_ = nullptr;
201 }
202 }
203
204 void ArcBluetoothBridge::AdapterPoweredChanged(BluetoothAdapter* adapter, 193 void ArcBluetoothBridge::AdapterPoweredChanged(BluetoothAdapter* adapter,
205 bool powered) { 194 bool powered) {
206 if (!HasBluetoothInstance()) 195 if (!HasBluetoothInstance())
207 return; 196 return;
208 197
209 // TODO(smbarber): Invoke EnableAdapter or DisableAdapter via ARC bridge 198 // TODO(smbarber): Invoke EnableAdapter or DisableAdapter via ARC bridge
210 // service. 199 // service.
211 } 200 }
212 201
213 void ArcBluetoothBridge::DeviceAdded(BluetoothAdapter* adapter, 202 void ArcBluetoothBridge::DeviceAdded(BluetoothAdapter* adapter,
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 LOG(WARNING) << "Bluetooth instance is too old (version " << version 1560 LOG(WARNING) << "Bluetooth instance is too old (version " << version
1572 << ") need version " << version_need; 1561 << ") need version " << version_need;
1573 return false; 1562 return false;
1574 } 1563 }
1575 1564
1576 bool ArcBluetoothBridge::CalledOnValidThread() { 1565 bool ArcBluetoothBridge::CalledOnValidThread() {
1577 return thread_checker_.CalledOnValidThread(); 1566 return thread_checker_.CalledOnValidThread();
1578 } 1567 }
1579 1568
1580 } // namespace arc 1569 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/bluetooth/arc_bluetooth_bridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698