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 <stddef.h> |
| 8 |
7 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
8 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
10 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
11 #include "content/child/thread_safe_sender.h" | 13 #include "content/child/thread_safe_sender.h" |
12 #include "content/common/bluetooth/bluetooth_messages.h" | 14 #include "content/common/bluetooth/bluetooth_messages.h" |
13 #include "device/bluetooth/bluetooth_uuid.h" | 15 #include "device/bluetooth/bluetooth_uuid.h" |
14 #include "third_party/WebKit/public/platform/WebPassOwnPtr.h" | 16 #include "third_party/WebKit/public/platform/WebPassOwnPtr.h" |
15 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothDevic
e.h" | 17 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothDevic
e.h" |
16 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothError
.h" | 18 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothError
.h" |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 | 607 |
606 pending_primary_service_requests_.Lookup(request_id) | 608 pending_primary_service_requests_.Lookup(request_id) |
607 ->callbacks->onError(WebBluetoothError(error)); | 609 ->callbacks->onError(WebBluetoothError(error)); |
608 pending_primary_service_requests_.Remove(request_id); | 610 pending_primary_service_requests_.Remove(request_id); |
609 } | 611 } |
610 | 612 |
611 void BluetoothDispatcher::OnGetCharacteristicSuccess( | 613 void BluetoothDispatcher::OnGetCharacteristicSuccess( |
612 int thread_id, | 614 int thread_id, |
613 int request_id, | 615 int request_id, |
614 const std::string& characteristic_instance_id, | 616 const std::string& characteristic_instance_id, |
615 uint32 characteristic_properties) { | 617 uint32_t characteristic_properties) { |
616 DCHECK(pending_characteristic_requests_.Lookup(request_id)) << request_id; | 618 DCHECK(pending_characteristic_requests_.Lookup(request_id)) << request_id; |
617 | 619 |
618 BluetoothCharacteristicRequest* request = | 620 BluetoothCharacteristicRequest* request = |
619 pending_characteristic_requests_.Lookup(request_id); | 621 pending_characteristic_requests_.Lookup(request_id); |
620 request->callbacks->onSuccess( | 622 request->callbacks->onSuccess( |
621 blink::adoptWebPtr(new WebBluetoothGATTCharacteristicInit( | 623 blink::adoptWebPtr(new WebBluetoothGATTCharacteristicInit( |
622 WebString::fromUTF8(characteristic_instance_id), | 624 WebString::fromUTF8(characteristic_instance_id), |
623 request->service_instance_id, request->characteristic_uuid, | 625 request->service_instance_id, request->characteristic_uuid, |
624 characteristic_properties))); | 626 characteristic_properties))); |
625 | 627 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 int thread_id, | 762 int thread_id, |
761 const std::string& characteristic_instance_id, | 763 const std::string& characteristic_instance_id, |
762 const std::vector<uint8_t> new_value) { | 764 const std::vector<uint8_t> new_value) { |
763 auto active_iter = active_characteristics_.find(characteristic_instance_id); | 765 auto active_iter = active_characteristics_.find(characteristic_instance_id); |
764 if (active_iter != active_characteristics_.end()) { | 766 if (active_iter != active_characteristics_.end()) { |
765 active_iter->second->dispatchCharacteristicValueChanged(new_value); | 767 active_iter->second->dispatchCharacteristicValueChanged(new_value); |
766 } | 768 } |
767 } | 769 } |
768 | 770 |
769 } // namespace content | 771 } // namespace content |
OLD | NEW |