| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 DCHECK(device_permissions); | 176 DCHECK(device_permissions); |
| 177 scoped_refptr<DevicePermissionEntry> permission_entry = | 177 scoped_refptr<DevicePermissionEntry> permission_entry = |
| 178 device_permissions->FindHidDeviceEntry(device_info); | 178 device_permissions->FindHidDeviceEntry(device_info); |
| 179 if (permission_entry) { | 179 if (permission_entry) { |
| 180 if (update_last_used) { | 180 if (update_last_used) { |
| 181 permissions_manager->UpdateLastUsed(extension->id(), permission_entry); | 181 permissions_manager->UpdateLastUsed(extension->id(), permission_entry); |
| 182 } | 182 } |
| 183 return true; | 183 return true; |
| 184 } | 184 } |
| 185 | 185 |
| 186 UsbDevicePermission::CheckParam usbParam( | 186 std::unique_ptr<UsbDevicePermission::CheckParam> usb_param = |
| 187 device_info->vendor_id(), device_info->product_id(), | 187 UsbDevicePermission::CheckParam::ForHidDevice( |
| 188 UsbDevicePermissionData::UNSPECIFIED_INTERFACE); | 188 extension, device_info->vendor_id(), device_info->product_id()); |
| 189 if (extension->permissions_data()->CheckAPIPermissionWithParam( | 189 if (extension->permissions_data()->CheckAPIPermissionWithParam( |
| 190 APIPermission::kUsbDevice, &usbParam)) { | 190 APIPermission::kUsbDevice, usb_param.get())) { |
| 191 return true; | 191 return true; |
| 192 } | 192 } |
| 193 | 193 |
| 194 if (extension->permissions_data()->HasAPIPermission( | 194 if (extension->permissions_data()->HasAPIPermission( |
| 195 APIPermission::kU2fDevices)) { | 195 APIPermission::kU2fDevices)) { |
| 196 HidDeviceFilter u2f_filter; | 196 HidDeviceFilter u2f_filter; |
| 197 u2f_filter.SetUsagePage(0xF1D0); | 197 u2f_filter.SetUsagePage(0xF1D0); |
| 198 if (u2f_filter.Matches(device_info)) { | 198 if (u2f_filter.Matches(device_info)) { |
| 199 return true; | 199 return true; |
| 200 } | 200 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 std::unique_ptr<base::ListValue> event_args, | 335 std::unique_ptr<base::ListValue> event_args, |
| 336 scoped_refptr<HidDeviceInfo> device_info) { | 336 scoped_refptr<HidDeviceInfo> device_info) { |
| 337 std::unique_ptr<Event> event( | 337 std::unique_ptr<Event> event( |
| 338 new Event(histogram_value, event_name, std::move(event_args))); | 338 new Event(histogram_value, event_name, std::move(event_args))); |
| 339 event->will_dispatch_callback = base::Bind( | 339 event->will_dispatch_callback = base::Bind( |
| 340 &WillDispatchDeviceEvent, weak_factory_.GetWeakPtr(), device_info); | 340 &WillDispatchDeviceEvent, weak_factory_.GetWeakPtr(), device_info); |
| 341 event_router_->BroadcastEvent(std::move(event)); | 341 event_router_->BroadcastEvent(std::move(event)); |
| 342 } | 342 } |
| 343 | 343 |
| 344 } // namespace extensions | 344 } // namespace extensions |
| OLD | NEW |