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

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

Issue 1403723004: bluetooth: Implement BluetoothCharacteristicProperties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-query-cache
Patch Set: Address scheib's comments Created 5 years, 2 months 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 DCHECK(pending_primary_service_requests_.Lookup(request_id)) << request_id; 604 DCHECK(pending_primary_service_requests_.Lookup(request_id)) << request_id;
605 605
606 pending_primary_service_requests_.Lookup(request_id) 606 pending_primary_service_requests_.Lookup(request_id)
607 ->callbacks->onError(WebBluetoothError(error)); 607 ->callbacks->onError(WebBluetoothError(error));
608 pending_primary_service_requests_.Remove(request_id); 608 pending_primary_service_requests_.Remove(request_id);
609 } 609 }
610 610
611 void BluetoothDispatcher::OnGetCharacteristicSuccess( 611 void BluetoothDispatcher::OnGetCharacteristicSuccess(
612 int thread_id, 612 int thread_id,
613 int request_id, 613 int request_id,
614 const std::string& characteristic_instance_id) { 614 const std::string& characteristic_instance_id,
615 uint32 characteristic_properties) {
615 DCHECK(pending_characteristic_requests_.Lookup(request_id)) << request_id; 616 DCHECK(pending_characteristic_requests_.Lookup(request_id)) << request_id;
616 617
617 BluetoothCharacteristicRequest* request = 618 BluetoothCharacteristicRequest* request =
618 pending_characteristic_requests_.Lookup(request_id); 619 pending_characteristic_requests_.Lookup(request_id);
619 request->callbacks->onSuccess( 620 request->callbacks->onSuccess(
620 blink::adoptWebPtr(new WebBluetoothGATTCharacteristicInit( 621 blink::adoptWebPtr(new WebBluetoothGATTCharacteristicInit(
621 WebString::fromUTF8(characteristic_instance_id), 622 WebString::fromUTF8(characteristic_instance_id),
622 request->service_instance_id, request->characteristic_uuid))); 623 request->service_instance_id, request->characteristic_uuid,
624 characteristic_properties)));
623 625
624 pending_characteristic_requests_.Remove(request_id); 626 pending_characteristic_requests_.Remove(request_id);
625 } 627 }
626 628
627 void BluetoothDispatcher::OnGetCharacteristicError(int thread_id, 629 void BluetoothDispatcher::OnGetCharacteristicError(int thread_id,
628 int request_id, 630 int request_id,
629 WebBluetoothError error) { 631 WebBluetoothError error) {
630 DCHECK(pending_characteristic_requests_.Lookup(request_id)) << request_id; 632 DCHECK(pending_characteristic_requests_.Lookup(request_id)) << request_id;
631 633
632 pending_characteristic_requests_.Lookup(request_id) 634 pending_characteristic_requests_.Lookup(request_id)
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 int thread_id, 760 int thread_id,
759 const std::string& characteristic_instance_id, 761 const std::string& characteristic_instance_id,
760 const std::vector<uint8_t> new_value) { 762 const std::vector<uint8_t> new_value) {
761 auto active_iter = active_characteristics_.find(characteristic_instance_id); 763 auto active_iter = active_characteristics_.find(characteristic_instance_id);
762 if (active_iter != active_characteristics_.end()) { 764 if (active_iter != active_characteristics_.end()) {
763 active_iter->second->dispatchCharacteristicValueChanged(new_value); 765 active_iter->second->dispatchCharacteristicValueChanged(new_value);
764 } 766 }
765 } 767 }
766 768
767 } // namespace content 769 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698