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

Side by Side Diff: content/renderer/bluetooth/bluetooth_dispatcher.cc

Issue 1427653003: bluetooth: Implement TxPower and RSSI of BluetoothAdvertisementData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Change PowerValueAdapter to int8_t Created 5 years, 1 month 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 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 const BluetoothDevice& device) { 542 const BluetoothDevice& device) {
543 DCHECK(pending_requests_.Lookup(request_id)) << request_id; 543 DCHECK(pending_requests_.Lookup(request_id)) << request_id;
544 544
545 WebVector<WebString> uuids(device.uuids.size()); 545 WebVector<WebString> uuids(device.uuids.size());
546 for (size_t i = 0; i < device.uuids.size(); ++i) 546 for (size_t i = 0; i < device.uuids.size(); ++i)
547 uuids[i] = WebString::fromUTF8(device.uuids[i].c_str()); 547 uuids[i] = WebString::fromUTF8(device.uuids[i].c_str());
548 548
549 pending_requests_.Lookup(request_id) 549 pending_requests_.Lookup(request_id)
550 ->onSuccess(blink::adoptWebPtr(new WebBluetoothDevice( 550 ->onSuccess(blink::adoptWebPtr(new WebBluetoothDevice(
551 WebString::fromUTF8(device.id), WebString(device.name), 551 WebString::fromUTF8(device.id), WebString(device.name),
552 device.device_class, GetWebVendorIdSource(device.vendor_id_source), 552 device.tx_power, device.rssi, device.device_class,
553 device.vendor_id, device.product_id, device.product_version, 553 GetWebVendorIdSource(device.vendor_id_source), device.vendor_id,
554 device.paired, uuids))); 554 device.product_id, device.product_version, device.paired, uuids)));
555 pending_requests_.Remove(request_id); 555 pending_requests_.Remove(request_id);
556 } 556 }
557 557
558 void BluetoothDispatcher::OnRequestDeviceError(int thread_id, 558 void BluetoothDispatcher::OnRequestDeviceError(int thread_id,
559 int request_id, 559 int request_id,
560 WebBluetoothError error) { 560 WebBluetoothError error) {
561 DCHECK(pending_requests_.Lookup(request_id)) << request_id; 561 DCHECK(pending_requests_.Lookup(request_id)) << request_id;
562 pending_requests_.Lookup(request_id)->onError(WebBluetoothError(error)); 562 pending_requests_.Lookup(request_id)->onError(WebBluetoothError(error));
563 pending_requests_.Remove(request_id); 563 pending_requests_.Remove(request_id);
564 } 564 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 int thread_id, 757 int thread_id,
758 const std::string& characteristic_instance_id, 758 const std::string& characteristic_instance_id,
759 const std::vector<uint8_t> new_value) { 759 const std::vector<uint8_t> new_value) {
760 auto active_iter = active_characteristics_.find(characteristic_instance_id); 760 auto active_iter = active_characteristics_.find(characteristic_instance_id);
761 if (active_iter != active_characteristics_.end()) { 761 if (active_iter != active_characteristics_.end()) {
762 active_iter->second->dispatchCharacteristicValueChanged(new_value); 762 active_iter->second->dispatchCharacteristicValueChanged(new_value);
763 } 763 }
764 } 764 }
765 765
766 } // namespace content 766 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698