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

Side by Side Diff: device/bluetooth/bluetooth_adapter.cc

Issue 2223203002: arc: bluetooth: Add/Remove BT observer only when ARC is ready (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add HasObserver 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
OLDNEW
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 "device/bluetooth/bluetooth_adapter.h" 5 #include "device/bluetooth/bluetooth_adapter.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 void BluetoothAdapter::AddObserver(BluetoothAdapter::Observer* observer) { 48 void BluetoothAdapter::AddObserver(BluetoothAdapter::Observer* observer) {
49 DCHECK(observer); 49 DCHECK(observer);
50 observers_.AddObserver(observer); 50 observers_.AddObserver(observer);
51 } 51 }
52 52
53 void BluetoothAdapter::RemoveObserver(BluetoothAdapter::Observer* observer) { 53 void BluetoothAdapter::RemoveObserver(BluetoothAdapter::Observer* observer) {
54 DCHECK(observer); 54 DCHECK(observer);
55 observers_.RemoveObserver(observer); 55 observers_.RemoveObserver(observer);
56 } 56 }
57 57
58 bool BluetoothAdapter::HasObserver(BluetoothAdapter::Observer* observer) {
59 return observers_.HasObserver(observer);
rkc 2016/08/08 23:53:33 Before this line, DCHECK(observer);
puthik_chromium 2016/08/09 00:08:57 Added. Actually, It would just return false if obs
60 }
61
58 void BluetoothAdapter::StartDiscoverySession( 62 void BluetoothAdapter::StartDiscoverySession(
59 const DiscoverySessionCallback& callback, 63 const DiscoverySessionCallback& callback,
60 const ErrorCallback& error_callback) { 64 const ErrorCallback& error_callback) {
61 StartDiscoverySessionWithFilter(nullptr, callback, error_callback); 65 StartDiscoverySessionWithFilter(nullptr, callback, error_callback);
62 } 66 }
63 67
64 void BluetoothAdapter::StartDiscoverySessionWithFilter( 68 void BluetoothAdapter::StartDiscoverySessionWithFilter(
65 std::unique_ptr<BluetoothDiscoveryFilter> discovery_filter, 69 std::unique_ptr<BluetoothDiscoveryFilter> discovery_filter,
66 const DiscoverySessionCallback& callback, 70 const DiscoverySessionCallback& callback,
67 const ErrorCallback& error_callback) { 71 const ErrorCallback& error_callback) {
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 UMA_HISTOGRAM_ENUMERATION( 415 UMA_HISTOGRAM_ENUMERATION(
412 "Bluetooth.DiscoverySession.Stop.Outcome", static_cast<int>(outcome), 416 "Bluetooth.DiscoverySession.Stop.Outcome", static_cast<int>(outcome),
413 static_cast<int>(UMABluetoothDiscoverySessionOutcome::COUNT)); 417 static_cast<int>(UMABluetoothDiscoverySessionOutcome::COUNT));
414 } 418 }
415 419
416 // static 420 // static
417 const base::TimeDelta BluetoothAdapter::timeoutSec = 421 const base::TimeDelta BluetoothAdapter::timeoutSec =
418 base::TimeDelta::FromSeconds(180); 422 base::TimeDelta::FromSeconds(180);
419 423
420 } // namespace device 424 } // namespace device
OLDNEW
« components/arc/bluetooth/arc_bluetooth_bridge.cc ('K') | « device/bluetooth/bluetooth_adapter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698