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 #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 Loading... |
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_ |
OLD | NEW |