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

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

Issue 1415533006: bluetooth: Implement requestDevice by name or name prefix (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-characteristic-properties
Patch Set: Merge with ToT and fix histograms conflict 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 // Convert |options| to its IPC form. 193 // Convert |options| to its IPC form.
194 std::vector<content::BluetoothScanFilter> filters(options.filters.size()); 194 std::vector<content::BluetoothScanFilter> filters(options.filters.size());
195 for (size_t i = 0; i < options.filters.size(); ++i) { 195 for (size_t i = 0; i < options.filters.size(); ++i) {
196 const WebBluetoothScanFilter& web_filter = options.filters[i]; 196 const WebBluetoothScanFilter& web_filter = options.filters[i];
197 BluetoothScanFilter& filter = filters[i]; 197 BluetoothScanFilter& filter = filters[i];
198 filter.services.reserve(web_filter.services.size()); 198 filter.services.reserve(web_filter.services.size());
199 for (const WebString& service : web_filter.services) { 199 for (const WebString& service : web_filter.services) {
200 filter.services.push_back(device::BluetoothUUID(service.utf8())); 200 filter.services.push_back(device::BluetoothUUID(service.utf8()));
201 } 201 }
202 filter.name = web_filter.name.utf8();
203 filter.namePrefix = web_filter.namePrefix.utf8();
202 } 204 }
203 std::vector<device::BluetoothUUID> optional_services; 205 std::vector<device::BluetoothUUID> optional_services;
204 optional_services.reserve(options.optionalServices.size()); 206 optional_services.reserve(options.optionalServices.size());
205 for (const WebString& optional_service : options.optionalServices) { 207 for (const WebString& optional_service : options.optionalServices) {
206 optional_services.push_back(device::BluetoothUUID(optional_service.utf8())); 208 optional_services.push_back(device::BluetoothUUID(optional_service.utf8()));
207 } 209 }
208 210
209 Send(new BluetoothHostMsg_RequestDevice(CurrentWorkerId(), request_id, 211 Send(new BluetoothHostMsg_RequestDevice(CurrentWorkerId(), request_id,
210 frame_routing_id, filters, 212 frame_routing_id, filters,
211 optional_services)); 213 optional_services));
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 int thread_id, 759 int thread_id,
758 const std::string& characteristic_instance_id, 760 const std::string& characteristic_instance_id,
759 const std::vector<uint8_t> new_value) { 761 const std::vector<uint8_t> new_value) {
760 auto active_iter = active_characteristics_.find(characteristic_instance_id); 762 auto active_iter = active_characteristics_.find(characteristic_instance_id);
761 if (active_iter != active_characteristics_.end()) { 763 if (active_iter != active_characteristics_.end()) {
762 active_iter->second->dispatchCharacteristicValueChanged(new_value); 764 active_iter->second->dispatchCharacteristicValueChanged(new_value);
763 } 765 }
764 } 766 }
765 767
766 } // namespace content 768 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698