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

Side by Side Diff: chrome/browser/chromeos/printer_detector/printer_detector.cc

Issue 2418353002: Allow interfaceClass USB device permissions (Closed)
Patch Set: . Created 4 years, 1 month 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 | « no previous file | chrome/browser/extensions/permission_messages_unittest.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser/chromeos/printer_detector/printer_detector.h" 5 #include "chrome/browser/chromeos/printer_detector/printer_detector.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 extensions::APIPermission::kUsb)) { 97 extensions::APIPermission::kUsb)) {
98 continue; 98 continue;
99 } 99 }
100 100
101 const extensions::UsbPrinterManifestData* manifest_data = 101 const extensions::UsbPrinterManifestData* manifest_data =
102 extensions::UsbPrinterManifestData::Get(extension.get()); 102 extensions::UsbPrinterManifestData::Get(extension.get());
103 if (manifest_data && manifest_data->SupportsDevice(device)) { 103 if (manifest_data && manifest_data->SupportsDevice(device)) {
104 return true; 104 return true;
105 } 105 }
106 106
107 extensions::UsbDevicePermission::CheckParam param( 107 std::unique_ptr<extensions::UsbDevicePermission::CheckParam> param =
108 device->vendor_id(), device->product_id(), 108 extensions::UsbDevicePermission::CheckParam::ForUsbDevice(
109 extensions::UsbDevicePermissionData::UNSPECIFIED_INTERFACE); 109 extension.get(), device.get());
110 if (extension->permissions_data()->CheckAPIPermissionWithParam( 110 if (extension->permissions_data()->CheckAPIPermissionWithParam(
111 extensions::APIPermission::kUsbDevice, &param)) { 111 extensions::APIPermission::kUsbDevice, param.get())) {
112 return true; 112 return true;
113 } 113 }
114 } 114 }
115 return false; 115 return false;
116 } 116 }
117 117
118 // Delegate for notification shown when a printer provider app for the plugged 118 // Delegate for notification shown when a printer provider app for the plugged
119 // in printer is found. 119 // in printer is found.
120 class PrinterProviderExistsNotificationDelegate : public NotificationDelegate { 120 class PrinterProviderExistsNotificationDelegate : public NotificationDelegate {
121 public: 121 public:
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 : g_browser_process->notification_ui_manager(), 301 : g_browser_process->notification_ui_manager(),
302 device); 302 device);
303 } 303 }
304 304
305 void PrinterDetector::SetNotificationUIManagerForTesting( 305 void PrinterDetector::SetNotificationUIManagerForTesting(
306 NotificationUIManager* manager) { 306 NotificationUIManager* manager) {
307 notification_ui_manager_ = manager; 307 notification_ui_manager_ = manager;
308 } 308 }
309 309
310 } // namespace chromeos 310 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/permission_messages_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698