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

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

Issue 2032093002: bluetooth: Fix logic mistake in DeviceChanged (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | device/bluetooth/bluez/bluetooth_device_bluez.cc » ('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 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 // BluetoothDispatcherHost map [service_id_to_device_address_, 7 // BluetoothDispatcherHost 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 device::BluetoothAdapter* adapter, 197 device::BluetoothAdapter* adapter,
198 bool present) { 198 bool present) {
199 if (!present) { 199 if (!present) {
200 ClearState(); 200 ClearState();
201 } 201 }
202 } 202 }
203 203
204 void WebBluetoothServiceImpl::DeviceChanged(device::BluetoothAdapter* adapter, 204 void WebBluetoothServiceImpl::DeviceChanged(device::BluetoothAdapter* adapter,
205 device::BluetoothDevice* device) { 205 device::BluetoothDevice* device) {
206 DCHECK_CURRENTLY_ON(BrowserThread::UI); 206 DCHECK_CURRENTLY_ON(BrowserThread::UI);
207 if (!device->IsGattConnected() || !device->IsConnected()) { 207 if (!device->IsGattConnected()) {
208 std::string device_id = 208 std::string device_id =
209 connected_devices_->CloseConnectionToDeviceWithAddress( 209 connected_devices_->CloseConnectionToDeviceWithAddress(
210 device->GetAddress()); 210 device->GetAddress());
211 if (!device_id.empty()) { 211 if (!device_id.empty()) {
212 if (client_) { 212 if (client_) {
213 client_->GattServerDisconnected(device_id); 213 client_->GattServerDisconnected(device_id);
214 } 214 }
215 } 215 }
216 } 216 }
217 } 217 }
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 void WebBluetoothServiceImpl::ClearState() { 829 void WebBluetoothServiceImpl::ClearState() {
830 characteristic_id_to_notify_session_.clear(); 830 characteristic_id_to_notify_session_.clear();
831 pending_primary_services_requests_.clear(); 831 pending_primary_services_requests_.clear();
832 characteristic_id_to_service_id_.clear(); 832 characteristic_id_to_service_id_.clear();
833 service_id_to_device_address_.clear(); 833 service_id_to_device_address_.clear();
834 connected_devices_.reset( 834 connected_devices_.reset(
835 new FrameConnectedBluetoothDevices(render_frame_host_)); 835 new FrameConnectedBluetoothDevices(render_frame_host_));
836 } 836 }
837 837
838 } // namespace content 838 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluez/bluetooth_device_bluez.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698