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

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

Issue 2014473002: bluetooth: Web Bluetooth can filter by empty device names, doesn't leak MACs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-GetNameOrEmpty-
Patch Set: addressed nits 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 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: 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 // WebBluetoothServiceImpl map [service_id_to_device_address_, 7 // WebBluetoothServiceImpl map [service_id_to_device_address_,
8 // characteristic_id_to_service_id_, descriptor_to_characteristic_] implies a 8 // characteristic_id_to_service_id_, descriptor_to_characteristic_] implies a
9 // hostile renderer because a renderer obtains the corresponding ID from this 9 // hostile renderer because a renderer obtains the corresponding ID from this
10 // class and it will be added to the map at that time. 10 // class and it will be added to the map at that time.
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 VLOG(1) << "\t Allowed: " << uuid.canonical_value(); 776 VLOG(1) << "\t Allowed: " << uuid.canonical_value();
777 filtered_uuids.push_back(uuid.canonical_value()); 777 filtered_uuids.push_back(uuid.canonical_value());
778 } else { 778 } else {
779 VLOG(1) << "\t Not Allowed: " << uuid.canonical_value(); 779 VLOG(1) << "\t Not Allowed: " << uuid.canonical_value();
780 } 780 }
781 } 781 }
782 782
783 blink::mojom::WebBluetoothDevicePtr device_ptr = 783 blink::mojom::WebBluetoothDevicePtr device_ptr =
784 blink::mojom::WebBluetoothDevice::New(); 784 blink::mojom::WebBluetoothDevice::New();
785 device_ptr->id = device_id_for_origin; 785 device_ptr->id = device_id_for_origin;
786 // TODO(615720): Use the upcoming GetName (was GetDeviceName). 786 device_ptr->name = device->GetName() ? mojo::String(device->GetName().value())
787 device_ptr->name = base::UTF16ToUTF8(device->GetNameForDisplay()); 787 : mojo::String(nullptr);
788 device_ptr->uuids = std::move(filtered_uuids); 788 device_ptr->uuids = std::move(filtered_uuids);
789 789
790 RecordRequestDeviceOutcome(UMARequestDeviceOutcome::SUCCESS); 790 RecordRequestDeviceOutcome(UMARequestDeviceOutcome::SUCCESS);
791 callback.Run(blink::mojom::WebBluetoothError::SUCCESS, std::move(device_ptr)); 791 callback.Run(blink::mojom::WebBluetoothError::SUCCESS, std::move(device_ptr));
792 } 792 }
793 793
794 void WebBluetoothServiceImpl::OnGetDeviceFailed( 794 void WebBluetoothServiceImpl::OnGetDeviceFailed(
795 const RequestDeviceCallback& callback, 795 const RequestDeviceCallback& callback,
796 blink::mojom::WebBluetoothError error) { 796 blink::mojom::WebBluetoothError error) {
797 // Errors are recorded by the *device_chooser_controller_. 797 // Errors are recorded by the *device_chooser_controller_.
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 characteristic_id_to_service_id_.clear(); 990 characteristic_id_to_service_id_.clear();
991 service_id_to_device_address_.clear(); 991 service_id_to_device_address_.clear();
992 connected_devices_.reset( 992 connected_devices_.reset(
993 new FrameConnectedBluetoothDevices(render_frame_host_)); 993 new FrameConnectedBluetoothDevices(render_frame_host_));
994 allowed_devices_map_ = BluetoothAllowedDevicesMap(); 994 allowed_devices_map_ = BluetoothAllowedDevicesMap();
995 device_chooser_controller_.reset(); 995 device_chooser_controller_.reset();
996 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this); 996 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this);
997 } 997 }
998 998
999 } // namespace content 999 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_device_chooser_controller.cc ('k') | content/renderer/bluetooth/web_bluetooth_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698