| OLD | NEW |
| 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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 | 912 |
| 913 if (query_result.outcome != CacheQueryOutcome::SUCCESS) { | 913 if (query_result.outcome != CacheQueryOutcome::SUCCESS) { |
| 914 RecordCharacteristicWriteValueOutcome(query_result.outcome); | 914 RecordCharacteristicWriteValueOutcome(query_result.outcome); |
| 915 Send(new BluetoothMsg_WriteCharacteristicValueError( | 915 Send(new BluetoothMsg_WriteCharacteristicValueError( |
| 916 thread_id, request_id, query_result.GetWebError())); | 916 thread_id, request_id, query_result.GetWebError())); |
| 917 return; | 917 return; |
| 918 } | 918 } |
| 919 | 919 |
| 920 query_result.characteristic->WriteRemoteCharacteristic( | 920 query_result.characteristic->WriteRemoteCharacteristic( |
| 921 value, base::Bind(&BluetoothDispatcherHost::OnWriteValueSuccess, | 921 value, base::Bind(&BluetoothDispatcherHost::OnWriteValueSuccess, |
| 922 weak_ptr_on_ui_thread_, thread_id, request_id), | 922 weak_ptr_on_ui_thread_, thread_id, request_id, value), |
| 923 base::Bind(&BluetoothDispatcherHost::OnWriteValueFailed, | 923 base::Bind(&BluetoothDispatcherHost::OnWriteValueFailed, |
| 924 weak_ptr_on_ui_thread_, thread_id, request_id)); | 924 weak_ptr_on_ui_thread_, thread_id, request_id)); |
| 925 } | 925 } |
| 926 | 926 |
| 927 void BluetoothDispatcherHost::OnStartNotifications( | 927 void BluetoothDispatcherHost::OnStartNotifications( |
| 928 int thread_id, | 928 int thread_id, |
| 929 int request_id, | 929 int request_id, |
| 930 const std::string& characteristic_instance_id) { | 930 const std::string& characteristic_instance_id) { |
| 931 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 931 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 932 RecordWebBluetoothFunctionCall( | 932 RecordWebBluetoothFunctionCall( |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 int thread_id, | 1216 int thread_id, |
| 1217 int request_id, | 1217 int request_id, |
| 1218 device::BluetoothGattService::GattErrorCode error_code) { | 1218 device::BluetoothGattService::GattErrorCode error_code) { |
| 1219 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1219 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1220 // TranslateGATTError calls RecordGATTOperationOutcome. | 1220 // TranslateGATTError calls RecordGATTOperationOutcome. |
| 1221 Send(new BluetoothMsg_ReadCharacteristicValueError( | 1221 Send(new BluetoothMsg_ReadCharacteristicValueError( |
| 1222 thread_id, request_id, | 1222 thread_id, request_id, |
| 1223 TranslateGATTError(error_code, UMAGATTOperation::CHARACTERISTIC_READ))); | 1223 TranslateGATTError(error_code, UMAGATTOperation::CHARACTERISTIC_READ))); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 void BluetoothDispatcherHost::OnWriteValueSuccess(int thread_id, | 1226 void BluetoothDispatcherHost::OnWriteValueSuccess( |
| 1227 int request_id) { | 1227 int thread_id, |
| 1228 int request_id, |
| 1229 const std::vector<uint8_t>& value) { |
| 1228 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1230 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1229 RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome::SUCCESS); | 1231 RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome::SUCCESS); |
| 1230 Send(new BluetoothMsg_WriteCharacteristicValueSuccess(thread_id, request_id)); | 1232 Send(new BluetoothMsg_WriteCharacteristicValueSuccess(thread_id, request_id, |
| 1233 value)); |
| 1231 } | 1234 } |
| 1232 | 1235 |
| 1233 void BluetoothDispatcherHost::OnWriteValueFailed( | 1236 void BluetoothDispatcherHost::OnWriteValueFailed( |
| 1234 int thread_id, | 1237 int thread_id, |
| 1235 int request_id, | 1238 int request_id, |
| 1236 device::BluetoothGattService::GattErrorCode error_code) { | 1239 device::BluetoothGattService::GattErrorCode error_code) { |
| 1237 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1240 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1238 // TranslateGATTError calls RecordGATTOperationOutcome. | 1241 // TranslateGATTError calls RecordGATTOperationOutcome. |
| 1239 Send(new BluetoothMsg_WriteCharacteristicValueError( | 1242 Send(new BluetoothMsg_WriteCharacteristicValueError( |
| 1240 thread_id, request_id, | 1243 thread_id, request_id, |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1372 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1370 NOTIMPLEMENTED(); | 1373 NOTIMPLEMENTED(); |
| 1371 } | 1374 } |
| 1372 | 1375 |
| 1373 void BluetoothDispatcherHost::ShowNeedLocationLink() { | 1376 void BluetoothDispatcherHost::ShowNeedLocationLink() { |
| 1374 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1377 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1375 NOTIMPLEMENTED(); | 1378 NOTIMPLEMENTED(); |
| 1376 } | 1379 } |
| 1377 | 1380 |
| 1378 } // namespace content | 1381 } // namespace content |
| OLD | NEW |