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

Side by Side Diff: extensions/browser/api/device_permissions_prompt.cc

Issue 599303004: Add getUserSelectedDevices to the USB extensions API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add device_permissions_prompt.* to BUILD.gn. Created 6 years, 2 months 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
OLDNEW
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/device_permissions_prompt.h" 5 #include "extensions/browser/api/device_permissions_prompt.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "device/core/device_client.h" 10 #include "device/core/device_client.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 void DevicePermissionsPrompt::Prompt::SetDevices( 166 void DevicePermissionsPrompt::Prompt::SetDevices(
167 const std::vector<DeviceInfo>& devices) { 167 const std::vector<DeviceInfo>& devices) {
168 devices_ = devices; 168 devices_ = devices;
169 if (observer_) { 169 if (observer_) {
170 observer_->OnDevicesChanged(); 170 observer_->OnDevicesChanged();
171 } 171 }
172 } 172 }
173 173
174 DevicePermissionsPrompt::DevicePermissionsPrompt( 174 DevicePermissionsPrompt::DevicePermissionsPrompt(
175 content::WebContents* web_contents) 175 content::WebContents* web_contents)
176 : web_contents_(web_contents), 176 : web_contents_(web_contents), delegate_(nullptr) {
177 delegate_(nullptr) {
178 } 177 }
179 178
180 DevicePermissionsPrompt::~DevicePermissionsPrompt() { 179 DevicePermissionsPrompt::~DevicePermissionsPrompt() {
181 } 180 }
182 181
183 void DevicePermissionsPrompt::AskForUsbDevices( 182 void DevicePermissionsPrompt::AskForUsbDevices(
184 Delegate* delegate, 183 Delegate* delegate,
185 const Extension* extension, 184 const Extension* extension,
186 content::BrowserContext* context, 185 content::BrowserContext* context,
187 bool multiple, 186 bool multiple,
188 const std::vector<UsbDeviceFilter>& filters) { 187 const std::vector<UsbDeviceFilter>& filters) {
189 prompt_ = new Prompt(); 188 prompt_ = new Prompt();
190 prompt_->set_extension(extension); 189 prompt_->set_extension(extension);
191 prompt_->set_browser_context(context); 190 prompt_->set_browser_context(context);
192 prompt_->set_multiple(multiple); 191 prompt_->set_multiple(multiple);
193 prompt_->set_filters(filters); 192 prompt_->set_filters(filters);
194 delegate_ = delegate; 193 delegate_ = delegate;
195 194
196 GetDefaultShowDialogCallback().Run(web_contents_, delegate_, prompt_); 195 ShowDialog();
197 } 196 }
198 197
199 } // namespace extensions 198 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/device_permissions_prompt.h ('k') | extensions/browser/api/extensions_api_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698