OLD | NEW |
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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 WebBluetoothServiceImpl::~WebBluetoothServiceImpl() { | 199 WebBluetoothServiceImpl::~WebBluetoothServiceImpl() { |
200 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 200 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
201 ClearState(); | 201 ClearState(); |
202 } | 202 } |
203 | 203 |
204 void WebBluetoothServiceImpl::SetClientConnectionErrorHandler( | 204 void WebBluetoothServiceImpl::SetClientConnectionErrorHandler( |
205 base::Closure closure) { | 205 base::Closure closure) { |
206 binding_.set_connection_error_handler(closure); | 206 binding_.set_connection_error_handler(closure); |
207 } | 207 } |
208 | 208 |
| 209 bool WebBluetoothServiceImpl::IsDevicePaired( |
| 210 const std::string& device_address) { |
| 211 return allowed_devices_map_.GetDeviceId(GetOrigin(), device_address) != |
| 212 nullptr; |
| 213 } |
| 214 |
209 void WebBluetoothServiceImpl::DidFinishNavigation( | 215 void WebBluetoothServiceImpl::DidFinishNavigation( |
210 NavigationHandle* navigation_handle) { | 216 NavigationHandle* navigation_handle) { |
211 if (navigation_handle->HasCommitted() && | 217 if (navigation_handle->HasCommitted() && |
212 navigation_handle->GetRenderFrameHost() == render_frame_host_ && | 218 navigation_handle->GetRenderFrameHost() == render_frame_host_ && |
213 !navigation_handle->IsSamePage()) { | 219 !navigation_handle->IsSamePage()) { |
214 ClearState(); | 220 ClearState(); |
215 } | 221 } |
216 } | 222 } |
217 | 223 |
218 void WebBluetoothServiceImpl::AdapterPoweredChanged( | 224 void WebBluetoothServiceImpl::AdapterPoweredChanged( |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 characteristic_id_to_service_id_.clear(); | 1001 characteristic_id_to_service_id_.clear(); |
996 service_id_to_device_address_.clear(); | 1002 service_id_to_device_address_.clear(); |
997 connected_devices_.reset( | 1003 connected_devices_.reset( |
998 new FrameConnectedBluetoothDevices(render_frame_host_)); | 1004 new FrameConnectedBluetoothDevices(render_frame_host_)); |
999 allowed_devices_map_ = BluetoothAllowedDevicesMap(); | 1005 allowed_devices_map_ = BluetoothAllowedDevicesMap(); |
1000 device_chooser_controller_.reset(); | 1006 device_chooser_controller_.reset(); |
1001 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this); | 1007 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this); |
1002 } | 1008 } |
1003 | 1009 |
1004 } // namespace content | 1010 } // namespace content |
OLD | NEW |