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

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

Issue 189463002: Migrate chrome.bluetooth API backend to use device::BluetoothDiscoverySession. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « device/bluetooth/bluetooth.gyp ('k') | device/bluetooth/bluetooth_discovery_session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "device/bluetooth/bluetooth_device.h" 9 #include "device/bluetooth/bluetooth_device.h"
10 #include "device/bluetooth/bluetooth_discovery_session.h" 10 #include "device/bluetooth/bluetooth_discovery_session.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 if (pairing_delegates_.empty()) 106 if (pairing_delegates_.empty())
107 return NULL; 107 return NULL;
108 108
109 return pairing_delegates_.front().first; 109 return pairing_delegates_.front().first;
110 } 110 }
111 111
112 void BluetoothAdapter::OnStartDiscoverySession( 112 void BluetoothAdapter::OnStartDiscoverySession(
113 const DiscoverySessionCallback& callback) { 113 const DiscoverySessionCallback& callback) {
114 VLOG(1) << "Discovery session started!"; 114 VLOG(1) << "Discovery session started!";
115 scoped_ptr<BluetoothDiscoverySession> discovery_session( 115 scoped_ptr<BluetoothDiscoverySession> discovery_session(
116 new BluetoothDiscoverySession(this)); 116 new BluetoothDiscoverySession(scoped_refptr<BluetoothAdapter>(this)));
117 discovery_sessions_.insert(discovery_session.get()); 117 discovery_sessions_.insert(discovery_session.get());
118 callback.Run(discovery_session.Pass()); 118 callback.Run(discovery_session.Pass());
119 } 119 }
120 120
121 void BluetoothAdapter::MarkDiscoverySessionsAsInactive() { 121 void BluetoothAdapter::MarkDiscoverySessionsAsInactive() {
122 for (std::set<BluetoothDiscoverySession*>::iterator 122 for (std::set<BluetoothDiscoverySession*>::iterator
123 iter = discovery_sessions_.begin(); 123 iter = discovery_sessions_.begin();
124 iter != discovery_sessions_.end(); ++iter) { 124 iter != discovery_sessions_.end(); ++iter) {
125 (*iter)->MarkAsInactive(); 125 (*iter)->MarkAsInactive();
126 } 126 }
127 } 127 }
128 128
129 void BluetoothAdapter::DiscoverySessionDestroyed( 129 void BluetoothAdapter::DiscoverySessionDestroyed(
130 BluetoothDiscoverySession* discovery_session) { 130 BluetoothDiscoverySession* discovery_session) {
131 discovery_sessions_.erase(discovery_session); 131 discovery_sessions_.erase(discovery_session);
132 } 132 }
133 133
134 } // namespace device 134 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth.gyp ('k') | device/bluetooth/bluetooth_discovery_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698