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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "chrome/browser/extensions/crx_installer_error.h" | 15 #include "chrome/browser/extensions/crx_installer_error.h" |
16 #include "chrome/browser/extensions/image_loading_tracker.h" | 16 #include "chrome/browser/extensions/image_loading_tracker.h" |
17 #include "chrome/common/extensions/url_pattern.h" | 17 #include "chrome/common/extensions/url_pattern.h" |
18 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" |
19 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
20 #include "ui/gfx/image/image_skia.h" | 20 #include "ui/gfx/image/image_skia.h" |
21 #include "ui/gfx/native_widget_types.h" | 21 #include "ui/gfx/native_widget_types.h" |
22 | 22 |
23 class Browser; | 23 class Browser; |
24 class ExtensionInstallUI; | 24 class ExtensionInstallUI; |
25 class ExtensionPermissionSet; | |
26 class MessageLoop; | 25 class MessageLoop; |
27 class InfoBarDelegate; | 26 class InfoBarDelegate; |
28 | 27 |
29 namespace base { | 28 namespace base { |
30 class DictionaryValue; | 29 class DictionaryValue; |
31 } // namespace base | 30 } // namespace base |
32 | 31 |
33 namespace extensions { | 32 namespace extensions { |
34 class BundleInstaller; | 33 class BundleInstaller; |
35 class Extension; | 34 class Extension; |
36 class ExtensionWebstorePrivateApiTest; | 35 class ExtensionWebstorePrivateApiTest; |
| 36 class PermissionSet; |
37 } // namespace extensions | 37 } // namespace extensions |
38 | 38 |
39 // Displays all the UI around extension installation. | 39 // Displays all the UI around extension installation. |
40 class ExtensionInstallPrompt : public ImageLoadingTracker::Observer { | 40 class ExtensionInstallPrompt : public ImageLoadingTracker::Observer { |
41 public: | 41 public: |
42 enum PromptType { | 42 enum PromptType { |
43 UNSET_PROMPT_TYPE = -1, | 43 UNSET_PROMPT_TYPE = -1, |
44 INSTALL_PROMPT = 0, | 44 INSTALL_PROMPT = 0, |
45 INLINE_INSTALL_PROMPT, | 45 INLINE_INSTALL_PROMPT, |
46 BUNDLE_INSTALL_PROMPT, | 46 BUNDLE_INSTALL_PROMPT, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 explicit ExtensionInstallPrompt(Browser* browser); | 153 explicit ExtensionInstallPrompt(Browser* browser); |
154 virtual ~ExtensionInstallPrompt(); | 154 virtual ~ExtensionInstallPrompt(); |
155 | 155 |
156 ExtensionInstallUI* install_ui() const { return install_ui_.get(); } | 156 ExtensionInstallUI* install_ui() const { return install_ui_.get(); } |
157 | 157 |
158 // This is called by the bundle installer to verify whether the bundle | 158 // This is called by the bundle installer to verify whether the bundle |
159 // should be installed. | 159 // should be installed. |
160 // | 160 // |
161 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 161 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
162 virtual void ConfirmBundleInstall(extensions::BundleInstaller* bundle, | 162 virtual void ConfirmBundleInstall( |
163 const ExtensionPermissionSet* permissions); | 163 extensions::BundleInstaller* bundle, |
| 164 const extensions::PermissionSet* permissions); |
164 | 165 |
165 // This is called by the inline installer to verify whether the inline | 166 // This is called by the inline installer to verify whether the inline |
166 // install from the webstore should proceed. | 167 // install from the webstore should proceed. |
167 // | 168 // |
168 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 169 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
169 virtual void ConfirmInlineInstall(Delegate* delegate, | 170 virtual void ConfirmInlineInstall(Delegate* delegate, |
170 const extensions::Extension* extension, | 171 const extensions::Extension* extension, |
171 SkBitmap* icon, | 172 SkBitmap* icon, |
172 const Prompt& prompt); | 173 const Prompt& prompt); |
173 | 174 |
(...skipping 18 matching lines...) Expand all Loading... |
192 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 193 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
193 virtual void ConfirmReEnable(Delegate* delegate, | 194 virtual void ConfirmReEnable(Delegate* delegate, |
194 const extensions::Extension* extension); | 195 const extensions::Extension* extension); |
195 | 196 |
196 // This is called by the extension permissions API to verify whether an | 197 // This is called by the extension permissions API to verify whether an |
197 // extension may be granted additional permissions. | 198 // extension may be granted additional permissions. |
198 // | 199 // |
199 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 200 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
200 virtual void ConfirmPermissions(Delegate* delegate, | 201 virtual void ConfirmPermissions(Delegate* delegate, |
201 const extensions::Extension* extension, | 202 const extensions::Extension* extension, |
202 const ExtensionPermissionSet* permissions); | 203 const extensions::PermissionSet* permissions); |
203 | 204 |
204 // Installation was successful. This is declared virtual for testing. | 205 // Installation was successful. This is declared virtual for testing. |
205 virtual void OnInstallSuccess(const extensions::Extension* extension, | 206 virtual void OnInstallSuccess(const extensions::Extension* extension, |
206 SkBitmap* icon); | 207 SkBitmap* icon); |
207 | 208 |
208 // Installation failed. This is declared virtual for testing. | 209 // Installation failed. This is declared virtual for testing. |
209 virtual void OnInstallFailure(const CrxInstallerError& error); | 210 virtual void OnInstallFailure(const CrxInstallerError& error); |
210 | 211 |
211 // ImageLoadingTracker::Observer: | 212 // ImageLoadingTracker::Observer: |
212 virtual void OnImageLoaded(const gfx::Image& image, | 213 virtual void OnImageLoaded(const gfx::Image& image, |
(...skipping 25 matching lines...) Expand all Loading... |
238 // The extensions installation icon. | 239 // The extensions installation icon. |
239 SkBitmap icon_; | 240 SkBitmap icon_; |
240 | 241 |
241 // The extension we are showing the UI for. | 242 // The extension we are showing the UI for. |
242 const extensions::Extension* extension_; | 243 const extensions::Extension* extension_; |
243 | 244 |
244 // The bundle we are showing the UI for, if type BUNDLE_INSTALL_PROMPT. | 245 // The bundle we are showing the UI for, if type BUNDLE_INSTALL_PROMPT. |
245 const extensions::BundleInstaller* bundle_; | 246 const extensions::BundleInstaller* bundle_; |
246 | 247 |
247 // The permissions being prompted for. | 248 // The permissions being prompted for. |
248 scoped_refptr<const ExtensionPermissionSet> permissions_; | 249 scoped_refptr<const extensions::PermissionSet> permissions_; |
249 | 250 |
250 // The object responsible for doing the UI specific actions. | 251 // The object responsible for doing the UI specific actions. |
251 scoped_ptr<ExtensionInstallUI> install_ui_; | 252 scoped_ptr<ExtensionInstallUI> install_ui_; |
252 | 253 |
253 // The delegate we will call Proceed/Abort on after confirmation UI. | 254 // The delegate we will call Proceed/Abort on after confirmation UI. |
254 Delegate* delegate_; | 255 Delegate* delegate_; |
255 | 256 |
256 // A pre-filled prompt. | 257 // A pre-filled prompt. |
257 Prompt prompt_; | 258 Prompt prompt_; |
258 | 259 |
259 // The type of prompt we are going to show. | 260 // The type of prompt we are going to show. |
260 PromptType prompt_type_; | 261 PromptType prompt_type_; |
261 | 262 |
262 // Keeps track of extension images being loaded on the File thread for the | 263 // Keeps track of extension images being loaded on the File thread for the |
263 // purpose of showing the install UI. | 264 // purpose of showing the install UI. |
264 ImageLoadingTracker tracker_; | 265 ImageLoadingTracker tracker_; |
265 }; | 266 }; |
266 | 267 |
267 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 268 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
OLD | NEW |