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

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

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
« no previous file with comments | « extensions/browser/BUILD.gn ('k') | extensions/browser/api/device_permissions_prompt.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 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 #ifndef EXTENSIONS_BROWSER_DEVICE_PERMISSIONS_PROMPT_H_ 5 #ifndef EXTENSIONS_BROWSER_DEVICE_PERMISSIONS_PROMPT_H_
6 #define EXTENSIONS_BROWSER_DEVICE_PERMISSIONS_PROMPT_H_ 6 #define EXTENSIONS_BROWSER_DEVICE_PERMISSIONS_PROMPT_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 class Delegate { 117 class Delegate {
118 public: 118 public:
119 // Called with the list of selected USB devices. 119 // Called with the list of selected USB devices.
120 virtual void OnUsbDevicesChosen( 120 virtual void OnUsbDevicesChosen(
121 const std::vector<scoped_refptr<device::UsbDevice>>& devices) = 0; 121 const std::vector<scoped_refptr<device::UsbDevice>>& devices) = 0;
122 122
123 protected: 123 protected:
124 virtual ~Delegate() {} 124 virtual ~Delegate() {}
125 }; 125 };
126 126
127 typedef base::Callback<void(content::WebContents*,
128 DevicePermissionsPrompt::Delegate*,
129 scoped_refptr<DevicePermissionsPrompt::Prompt>)>
130 ShowDialogCallback;
131
132 static ShowDialogCallback GetDefaultShowDialogCallback();
133
134 DevicePermissionsPrompt(content::WebContents* web_contents); 127 DevicePermissionsPrompt(content::WebContents* web_contents);
135 virtual ~DevicePermissionsPrompt(); 128 virtual ~DevicePermissionsPrompt();
136 129
137 virtual void AskForUsbDevices( 130 void AskForUsbDevices(Delegate* delegate,
138 Delegate* delegate, 131 const Extension* extension,
139 const Extension* extension, 132 content::BrowserContext* context,
140 content::BrowserContext* context, 133 bool multiple,
141 bool multiple, 134 const std::vector<device::UsbDeviceFilter>& filters);
142 const std::vector<device::UsbDeviceFilter>& filters); 135
136 protected:
137 virtual void ShowDialog() = 0;
138
139 content::WebContents* web_contents() { return web_contents_; }
140 Delegate* delegate() { return delegate_; }
141 scoped_refptr<Prompt> prompt() { return prompt_; }
143 142
144 private: 143 private:
145 // Parent web contents of the device permissions UI dialog. 144 // Parent web contents of the device permissions UI dialog.
146 content::WebContents* web_contents_; 145 content::WebContents* web_contents_;
147 146
148 // The delegate called after the UI has been dismissed. 147 // The delegate called after the UI has been dismissed.
149 Delegate* delegate_; 148 Delegate* delegate_;
150 149
151 // Parameters available to the UI implementation. 150 // Parameters available to the UI implementation.
152 scoped_refptr<Prompt> prompt_; 151 scoped_refptr<Prompt> prompt_;
153 }; 152 };
154 153
155 } // namespace extensions 154 } // namespace extensions
156 155
157 #endif // EXTENSIONS_BROWSER_API_DEVICE_PERMISSIONS_PROMPT_H_ 156 #endif // EXTENSIONS_BROWSER_API_DEVICE_PERMISSIONS_PROMPT_H_
OLDNEW
« no previous file with comments | « extensions/browser/BUILD.gn ('k') | extensions/browser/api/device_permissions_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698