| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/common/extensions/permissions/usb_device_permission.h" | 5 #include "chrome/common/extensions/permissions/usb_device_permission.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 UsbDevicePermission::~UsbDevicePermission() { | 29 UsbDevicePermission::~UsbDevicePermission() { |
| 30 } | 30 } |
| 31 | 31 |
| 32 PermissionMessages UsbDevicePermission::GetMessages() const { | 32 PermissionMessages UsbDevicePermission::GetMessages() const { |
| 33 DCHECK(HasMessages()); | 33 DCHECK(HasMessages()); |
| 34 PermissionMessages result; | 34 PermissionMessages result; |
| 35 | 35 |
| 36 #if defined(ENABLE_EXTENSIONS) | 36 #if defined(ENABLE_EXTENSIONS) |
| 37 // device.gyp:device_usb is not available when extensions are disabled. | 37 // //device/usb/usb.gyp:device_usb is not available when extensions are |
| 38 // disabled. |
| 38 for (std::set<UsbDevicePermissionData>::const_iterator i = | 39 for (std::set<UsbDevicePermissionData>::const_iterator i = |
| 39 data_set_.begin(); i != data_set_.end(); ++i) { | 40 data_set_.begin(); i != data_set_.end(); ++i) { |
| 40 const char* vendor = device::UsbIds::GetVendorName(i->vendor_id()); | 41 const char* vendor = device::UsbIds::GetVendorName(i->vendor_id()); |
| 41 | 42 |
| 42 if (vendor) { | 43 if (vendor) { |
| 43 const char* product = | 44 const char* product = |
| 44 device::UsbIds::GetProductName(i->vendor_id(), i->product_id()); | 45 device::UsbIds::GetProductName(i->vendor_id(), i->product_id()); |
| 45 if (product) { | 46 if (product) { |
| 46 result.push_back(PermissionMessage( | 47 result.push_back(PermissionMessage( |
| 47 PermissionMessage::kUsbDevice, | 48 PermissionMessage::kUsbDevice, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 64 } | 65 } |
| 65 } | 66 } |
| 66 #else | 67 #else |
| 67 NOTREACHED(); | 68 NOTREACHED(); |
| 68 #endif // defined(ENABLE_EXTENSIONS) | 69 #endif // defined(ENABLE_EXTENSIONS) |
| 69 | 70 |
| 70 return result; | 71 return result; |
| 71 } | 72 } |
| 72 | 73 |
| 73 } // namespace extensions | 74 } // namespace extensions |
| OLD | NEW |