| 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 "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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |