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

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

Issue 1875463002: Remove unused fields from //content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scythe-root
Patch Set: Fixed Ozone build. Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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: 5 // ID Not In Map Note:
6 // A service, characteristic, or descriptor ID not in the corresponding 6 // A service, characteristic, or descriptor ID not in the corresponding
7 // BluetoothDispatcherHost map [service_to_device_, characteristic_to_service_, 7 // BluetoothDispatcherHost map [service_to_device_, characteristic_to_service_,
8 // descriptor_to_characteristic_] implies a hostile renderer because a renderer 8 // descriptor_to_characteristic_] implies a hostile renderer because a renderer
9 // obtains the corresponding ID from this class and it will be added to the map 9 // obtains the corresponding ID from this class and it will be added to the map
10 // at that time. 10 // at that time.
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // Clear adapter, releasing observer references. 361 // Clear adapter, releasing observer references.
362 set_adapter(scoped_refptr<device::BluetoothAdapter>()); 362 set_adapter(scoped_refptr<device::BluetoothAdapter>());
363 } 363 }
364 364
365 // Stores information associated with an in-progress requestDevice call. This 365 // Stores information associated with an in-progress requestDevice call. This
366 // will include the state of the active chooser dialog in a future patch. 366 // will include the state of the active chooser dialog in a future patch.
367 struct BluetoothDispatcherHost::RequestDeviceSession { 367 struct BluetoothDispatcherHost::RequestDeviceSession {
368 public: 368 public:
369 RequestDeviceSession(int thread_id, 369 RequestDeviceSession(int thread_id,
370 int request_id, 370 int request_id,
371 int frame_routing_id,
ncarter (slow) 2016/04/14 17:37:36 My understanding is that the bluetooth code is in
ortuno 2016/04/14 17:53:53 This is OK. We used to save the routing id so we c
372 url::Origin origin, 371 url::Origin origin,
373 const std::vector<BluetoothScanFilter>& filters, 372 const std::vector<BluetoothScanFilter>& filters,
374 const std::vector<BluetoothUUID>& optional_services) 373 const std::vector<BluetoothUUID>& optional_services)
375 : thread_id(thread_id), 374 : thread_id(thread_id),
376 request_id(request_id), 375 request_id(request_id),
377 frame_routing_id(frame_routing_id),
378 origin(origin), 376 origin(origin),
379 filters(filters), 377 filters(filters),
380 optional_services(optional_services) {} 378 optional_services(optional_services) {}
381 379
382 void AddFilteredDevice(const device::BluetoothDevice& device) { 380 void AddFilteredDevice(const device::BluetoothDevice& device) {
383 if (chooser && MatchesFilters(device, filters)) { 381 if (chooser && MatchesFilters(device, filters)) {
384 chooser->AddDevice(device.GetAddress(), device.GetName()); 382 chooser->AddDevice(device.GetAddress(), device.GetName());
385 } 383 }
386 } 384 }
387 385
388 std::unique_ptr<device::BluetoothDiscoveryFilter> ComputeScanFilter() const { 386 std::unique_ptr<device::BluetoothDiscoveryFilter> ComputeScanFilter() const {
389 std::set<BluetoothUUID> services; 387 std::set<BluetoothUUID> services;
390 for (const BluetoothScanFilter& filter : filters) { 388 for (const BluetoothScanFilter& filter : filters) {
391 services.insert(filter.services.begin(), filter.services.end()); 389 services.insert(filter.services.begin(), filter.services.end());
392 } 390 }
393 std::unique_ptr<device::BluetoothDiscoveryFilter> discovery_filter( 391 std::unique_ptr<device::BluetoothDiscoveryFilter> discovery_filter(
394 new device::BluetoothDiscoveryFilter( 392 new device::BluetoothDiscoveryFilter(
395 device::BluetoothDiscoveryFilter::TRANSPORT_DUAL)); 393 device::BluetoothDiscoveryFilter::TRANSPORT_DUAL));
396 for (const BluetoothUUID& service : services) { 394 for (const BluetoothUUID& service : services) {
397 discovery_filter->AddUUID(service); 395 discovery_filter->AddUUID(service);
398 } 396 }
399 return discovery_filter; 397 return discovery_filter;
400 } 398 }
401 399
402 const int thread_id; 400 const int thread_id;
403 const int request_id; 401 const int request_id;
404 const int frame_routing_id;
405 const url::Origin origin; 402 const url::Origin origin;
406 const std::vector<BluetoothScanFilter> filters; 403 const std::vector<BluetoothScanFilter> filters;
407 const std::vector<BluetoothUUID> optional_services; 404 const std::vector<BluetoothUUID> optional_services;
408 std::unique_ptr<BluetoothChooser> chooser; 405 std::unique_ptr<BluetoothChooser> chooser;
409 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session; 406 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session;
410 }; 407 };
411 408
412 BluetoothDispatcherHost::CacheQueryResult::CacheQueryResult() {} 409 BluetoothDispatcherHost::CacheQueryResult::CacheQueryResult() {}
413 410
414 BluetoothDispatcherHost::CacheQueryResult::CacheQueryResult( 411 BluetoothDispatcherHost::CacheQueryResult::CacheQueryResult(
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 thread_id, request_id, 1250 thread_id, request_id,
1254 WebBluetoothError::CHOOSER_NOT_SHOWN_API_GLOBALLY_DISABLED)); 1251 WebBluetoothError::CHOOSER_NOT_SHOWN_API_GLOBALLY_DISABLED));
1255 return; 1252 return;
1256 } 1253 }
1257 case ContentBrowserClient::AllowWebBluetoothResult::ALLOW: 1254 case ContentBrowserClient::AllowWebBluetoothResult::ALLOW:
1258 break; 1255 break;
1259 } 1256 }
1260 1257
1261 // Create storage for the information that backs the chooser, and show the 1258 // Create storage for the information that backs the chooser, and show the
1262 // chooser. 1259 // chooser.
1263 RequestDeviceSession* const session = new RequestDeviceSession( 1260 RequestDeviceSession* const session =
1264 thread_id, request_id, frame_routing_id, requesting_origin, filters, 1261 new RequestDeviceSession(thread_id, request_id, requesting_origin,
1265 optional_services_blacklist_filtered); 1262 filters, optional_services_blacklist_filtered);
1266 int chooser_id = request_device_sessions_.Add(session); 1263 int chooser_id = request_device_sessions_.Add(session);
1267 1264
1268 BluetoothChooser::EventHandler chooser_event_handler = 1265 BluetoothChooser::EventHandler chooser_event_handler =
1269 base::Bind(&BluetoothDispatcherHost::OnBluetoothChooserEvent, 1266 base::Bind(&BluetoothDispatcherHost::OnBluetoothChooserEvent,
1270 weak_ptr_on_ui_thread_, chooser_id); 1267 weak_ptr_on_ui_thread_, chooser_id);
1271 if (WebContentsDelegate* delegate = web_contents->GetDelegate()) { 1268 if (WebContentsDelegate* delegate = web_contents->GetDelegate()) {
1272 session->chooser = 1269 session->chooser =
1273 delegate->RunBluetoothChooser(render_frame_host, chooser_event_handler); 1270 delegate->RunBluetoothChooser(render_frame_host, chooser_event_handler);
1274 } 1271 }
1275 if (!session->chooser) { 1272 if (!session->chooser) {
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 1674
1678 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance( 1675 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance(
1679 int frame_routing_id, 1676 int frame_routing_id,
1680 const std::string& characteristic_instance_id) { 1677 const std::string& characteristic_instance_id) {
1681 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id), 1678 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id),
1682 characteristic_instance_id) 1679 characteristic_instance_id)
1683 .outcome != CacheQueryOutcome::BAD_RENDERER; 1680 .outcome != CacheQueryOutcome::BAD_RENDERER;
1684 } 1681 }
1685 1682
1686 } // namespace content 1683 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698