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 #include "content/renderer/bluetooth/bluetooth_dispatcher.h" | 5 #include "content/renderer/bluetooth/bluetooth_dispatcher.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 const BluetoothDevice& device) { | 544 const BluetoothDevice& device) { |
545 DCHECK(pending_requests_.Lookup(request_id)) << request_id; | 545 DCHECK(pending_requests_.Lookup(request_id)) << request_id; |
546 | 546 |
547 WebVector<WebString> uuids(device.uuids.size()); | 547 WebVector<WebString> uuids(device.uuids.size()); |
548 for (size_t i = 0; i < device.uuids.size(); ++i) | 548 for (size_t i = 0; i < device.uuids.size(); ++i) |
549 uuids[i] = WebString::fromUTF8(device.uuids[i].c_str()); | 549 uuids[i] = WebString::fromUTF8(device.uuids[i].c_str()); |
550 | 550 |
551 pending_requests_.Lookup(request_id) | 551 pending_requests_.Lookup(request_id) |
552 ->onSuccess(blink::adoptWebPtr(new WebBluetoothDevice( | 552 ->onSuccess(blink::adoptWebPtr(new WebBluetoothDevice( |
553 WebString::fromUTF8(device.instance_id), WebString(device.name), | 553 WebString::fromUTF8(device.instance_id), WebString(device.name), |
554 device.device_class, GetWebVendorIdSource(device.vendor_id_source), | 554 device.tx_power, device.rssi, device.device_class, |
555 device.vendor_id, device.product_id, device.product_version, | 555 GetWebVendorIdSource(device.vendor_id_source), device.vendor_id, |
556 device.paired, uuids))); | 556 device.product_id, device.product_version, device.paired, uuids))); |
557 pending_requests_.Remove(request_id); | 557 pending_requests_.Remove(request_id); |
558 } | 558 } |
559 | 559 |
560 void BluetoothDispatcher::OnRequestDeviceError(int thread_id, | 560 void BluetoothDispatcher::OnRequestDeviceError(int thread_id, |
561 int request_id, | 561 int request_id, |
562 WebBluetoothError error) { | 562 WebBluetoothError error) { |
563 DCHECK(pending_requests_.Lookup(request_id)) << request_id; | 563 DCHECK(pending_requests_.Lookup(request_id)) << request_id; |
564 pending_requests_.Lookup(request_id)->onError(WebBluetoothError(error)); | 564 pending_requests_.Lookup(request_id)->onError(WebBluetoothError(error)); |
565 pending_requests_.Remove(request_id); | 565 pending_requests_.Remove(request_id); |
566 } | 566 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 int thread_id, | 760 int thread_id, |
761 const std::string& characteristic_instance_id, | 761 const std::string& characteristic_instance_id, |
762 const std::vector<uint8_t> new_value) { | 762 const std::vector<uint8_t> new_value) { |
763 auto active_iter = active_characteristics_.find(characteristic_instance_id); | 763 auto active_iter = active_characteristics_.find(characteristic_instance_id); |
764 if (active_iter != active_characteristics_.end()) { | 764 if (active_iter != active_characteristics_.end()) { |
765 active_iter->second->dispatchCharacteristicValueChanged(new_value); | 765 active_iter->second->dispatchCharacteristicValueChanged(new_value); |
766 } | 766 } |
767 } | 767 } |
768 | 768 |
769 } // namespace content | 769 } // namespace content |
OLD | NEW |