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

Side by Side Diff: content/browser/bluetooth/web_bluetooth_service_impl.cc

Issue 2735773002: work in progress
Patch Set: Created 3 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
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 // ID Not In Map Note: A service, characteristic, or descriptor ID not in the 5 // ID Not In Map Note: A service, characteristic, or descriptor ID not in the
6 // corresponding WebBluetoothServiceImpl map [service_id_to_device_address_, 6 // corresponding WebBluetoothServiceImpl map [service_id_to_device_address_,
7 // characteristic_id_to_service_id_, descriptor_id_to_characteristic_id_] 7 // characteristic_id_to_service_id_, descriptor_id_to_characteristic_id_]
8 // implies a hostile renderer because a renderer obtains the corresponding ID 8 // implies a hostile renderer because a renderer obtains the corresponding ID
9 // from this class and it will be added to the map at that time. 9 // from this class and it will be added to the map at that time.
10 10
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 void WebBluetoothServiceImpl::AdapterPoweredChanged( 206 void WebBluetoothServiceImpl::AdapterPoweredChanged(
207 device::BluetoothAdapter* adapter, 207 device::BluetoothAdapter* adapter,
208 bool powered) { 208 bool powered) {
209 DCHECK_CURRENTLY_ON(BrowserThread::UI); 209 DCHECK_CURRENTLY_ON(BrowserThread::UI);
210 if (device_chooser_controller_.get()) { 210 if (device_chooser_controller_.get()) {
211 device_chooser_controller_->AdapterPoweredChanged(powered); 211 device_chooser_controller_->AdapterPoweredChanged(powered);
212 } 212 }
213 } 213 }
214 214
215 void WebBluetoothServiceImpl::AdapterDiscoveringChanged(
216 device::BluetoothAdapter* adapter,
217 bool discovering) {
218 DCHECK_CURRENTLY_ON(BrowserThread::UI);
219 if (device_chooser_controller_.get()) {
220 device_chooser_controller_->AdapterDiscoveringChanged(discovering);
221 }
222 }
223
215 void WebBluetoothServiceImpl::DeviceAdded(device::BluetoothAdapter* adapter, 224 void WebBluetoothServiceImpl::DeviceAdded(device::BluetoothAdapter* adapter,
216 device::BluetoothDevice* device) { 225 device::BluetoothDevice* device) {
217 DCHECK_CURRENTLY_ON(BrowserThread::UI); 226 DCHECK_CURRENTLY_ON(BrowserThread::UI);
218 if (device_chooser_controller_.get()) { 227 if (device_chooser_controller_.get()) {
219 device_chooser_controller_->AddFilteredDevice(*device); 228 device_chooser_controller_->AddFilteredDevice(*device);
220 } 229 }
221 } 230 }
222 231
223 void WebBluetoothServiceImpl::DeviceChanged(device::BluetoothAdapter* adapter, 232 void WebBluetoothServiceImpl::DeviceChanged(device::BluetoothAdapter* adapter,
224 device::BluetoothDevice* device) { 233 device::BluetoothDevice* device) {
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 descriptor_id_to_characteristic_id_.clear(); 1195 descriptor_id_to_characteristic_id_.clear();
1187 characteristic_id_to_service_id_.clear(); 1196 characteristic_id_to_service_id_.clear();
1188 service_id_to_device_address_.clear(); 1197 service_id_to_device_address_.clear();
1189 connected_devices_.reset( 1198 connected_devices_.reset(
1190 new FrameConnectedBluetoothDevices(render_frame_host_)); 1199 new FrameConnectedBluetoothDevices(render_frame_host_));
1191 allowed_devices_map_ = BluetoothAllowedDevicesMap(); 1200 allowed_devices_map_ = BluetoothAllowedDevicesMap();
1192 device_chooser_controller_.reset(); 1201 device_chooser_controller_.reset();
1193 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this); 1202 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this);
1194 } 1203 }
1195 1204
1205 void WebBluetoothServiceImpl::ChangeAdapterDiscoveringForTesting(
1206 device::BluetoothAdapter* adapter,
1207 bool discovering) {
1208 AdapterDiscoveringChanged(adapter, discovering);
1209 }
1210
1211 bool WebBluetoothServiceImpl::IsDiscoverySessionActiveForTesting() {
1212 if (device_chooser_controller_.get())
1213 return device_chooser_controller_->IsDiscoverySessionActive();
1214
1215 return false;
1216 }
1217
1196 } // namespace content 1218 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bluetooth/web_bluetooth_service_impl.h ('k') | content/public/browser/bluetooth_chooser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698