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

Side by Side Diff: extensions/browser/api/hid/hid_device_manager.cc

Issue 1841483002: [Extensions] Convert APIs to use movable types [11] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « extensions/browser/api/hid/hid_api.cc ('k') | extensions/common/api/bluetooth.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/browser/api/hid/hid_device_manager.h" 5 #include "extensions/browser/api/hid/hid_device_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 27 matching lines...) Expand all
38 output->max_input_report_size = input->max_input_report_size(); 38 output->max_input_report_size = input->max_input_report_size();
39 output->max_output_report_size = input->max_output_report_size(); 39 output->max_output_report_size = input->max_output_report_size();
40 output->max_feature_report_size = input->max_feature_report_size(); 40 output->max_feature_report_size = input->max_feature_report_size();
41 41
42 for (const device::HidCollectionInfo& collection : input->collections()) { 42 for (const device::HidCollectionInfo& collection : input->collections()) {
43 // Don't expose sensitive data. 43 // Don't expose sensitive data.
44 if (collection.usage.IsProtected()) { 44 if (collection.usage.IsProtected()) {
45 continue; 45 continue;
46 } 46 }
47 47
48 hid::HidCollectionInfo* api_collection = new hid::HidCollectionInfo(); 48 hid::HidCollectionInfo api_collection;
49 api_collection->usage_page = collection.usage.usage_page; 49 api_collection.usage_page = collection.usage.usage_page;
50 api_collection->usage = collection.usage.usage; 50 api_collection.usage = collection.usage.usage;
51 51
52 api_collection->report_ids.resize(collection.report_ids.size()); 52 api_collection.report_ids.resize(collection.report_ids.size());
53 std::copy(collection.report_ids.begin(), collection.report_ids.end(), 53 std::copy(collection.report_ids.begin(), collection.report_ids.end(),
54 api_collection->report_ids.begin()); 54 api_collection.report_ids.begin());
55 55
56 output->collections.push_back(make_linked_ptr(api_collection)); 56 output->collections.push_back(std::move(api_collection));
57 } 57 }
58 58
59 const std::vector<uint8_t>& report_descriptor = input->report_descriptor(); 59 const std::vector<uint8_t>& report_descriptor = input->report_descriptor();
60 if (report_descriptor.size() > 0) { 60 if (report_descriptor.size() > 0) {
61 output->report_descriptor.assign(report_descriptor.begin(), 61 output->report_descriptor.assign(report_descriptor.begin(),
62 report_descriptor.end()); 62 report_descriptor.end());
63 } 63 }
64 } 64 }
65 65
66 bool WillDispatchDeviceEvent(base::WeakPtr<HidDeviceManager> device_manager, 66 bool WillDispatchDeviceEvent(base::WeakPtr<HidDeviceManager> device_manager,
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 scoped_ptr<base::ListValue> event_args, 329 scoped_ptr<base::ListValue> event_args,
330 scoped_refptr<HidDeviceInfo> device_info) { 330 scoped_refptr<HidDeviceInfo> device_info) {
331 scoped_ptr<Event> event( 331 scoped_ptr<Event> event(
332 new Event(histogram_value, event_name, std::move(event_args))); 332 new Event(histogram_value, event_name, std::move(event_args)));
333 event->will_dispatch_callback = base::Bind( 333 event->will_dispatch_callback = base::Bind(
334 &WillDispatchDeviceEvent, weak_factory_.GetWeakPtr(), device_info); 334 &WillDispatchDeviceEvent, weak_factory_.GetWeakPtr(), device_info);
335 event_router_->BroadcastEvent(std::move(event)); 335 event_router_->BroadcastEvent(std::move(event));
336 } 336 }
337 337
338 } // namespace extensions 338 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/hid/hid_api.cc ('k') | extensions/common/api/bluetooth.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698