| 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 21 matching lines...) Expand all Loading... |
| 32 namespace extensions { | 32 namespace extensions { |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 void PopulateHidDeviceInfo(hid::HidDeviceInfo* output, | 36 void PopulateHidDeviceInfo(hid::HidDeviceInfo* output, |
| 37 scoped_refptr<const HidDeviceInfo> input) { | 37 scoped_refptr<const HidDeviceInfo> input) { |
| 38 output->vendor_id = input->vendor_id(); | 38 output->vendor_id = input->vendor_id(); |
| 39 output->product_id = input->product_id(); | 39 output->product_id = input->product_id(); |
| 40 output->product_name = input->product_name(); | 40 output->product_name = input->product_name(); |
| 41 output->serial_number = input->serial_number(); | 41 output->serial_number = input->serial_number(); |
| 42 output->max_input_report_size = input->max_input_report_size(); | 42 output->max_input_report_size = |
| 43 output->max_output_report_size = input->max_output_report_size(); | 43 static_cast<int>(input->max_input_report_size()); |
| 44 output->max_feature_report_size = input->max_feature_report_size(); | 44 output->max_output_report_size = |
| 45 static_cast<int>(input->max_output_report_size()); |
| 46 output->max_feature_report_size = |
| 47 static_cast<int>(input->max_feature_report_size()); |
| 45 | 48 |
| 46 for (const device::HidCollectionInfo& collection : input->collections()) { | 49 for (const device::HidCollectionInfo& collection : input->collections()) { |
| 47 // Don't expose sensitive data. | 50 // Don't expose sensitive data. |
| 48 if (collection.usage.IsProtected()) { | 51 if (collection.usage.IsProtected()) { |
| 49 continue; | 52 continue; |
| 50 } | 53 } |
| 51 | 54 |
| 52 hid::HidCollectionInfo api_collection; | 55 hid::HidCollectionInfo api_collection; |
| 53 api_collection.usage_page = collection.usage.usage_page; | 56 api_collection.usage_page = collection.usage.usage_page; |
| 54 api_collection.usage = collection.usage.usage; | 57 api_collection.usage = collection.usage.usage; |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 std::unique_ptr<base::ListValue> event_args, | 338 std::unique_ptr<base::ListValue> event_args, |
| 336 scoped_refptr<HidDeviceInfo> device_info) { | 339 scoped_refptr<HidDeviceInfo> device_info) { |
| 337 std::unique_ptr<Event> event( | 340 std::unique_ptr<Event> event( |
| 338 new Event(histogram_value, event_name, std::move(event_args))); | 341 new Event(histogram_value, event_name, std::move(event_args))); |
| 339 event->will_dispatch_callback = base::Bind( | 342 event->will_dispatch_callback = base::Bind( |
| 340 &WillDispatchDeviceEvent, weak_factory_.GetWeakPtr(), device_info); | 343 &WillDispatchDeviceEvent, weak_factory_.GetWeakPtr(), device_info); |
| 341 event_router_->BroadcastEvent(std::move(event)); | 344 event_router_->BroadcastEvent(std::move(event)); |
| 342 } | 345 } |
| 343 | 346 |
| 344 } // namespace extensions | 347 } // namespace extensions |
| OLD | NEW |