| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 #include "chrome/browser/extensions/crx_installer_error.h" | |
| 19 #include "chrome/browser/extensions/extension_install_prompt_experiment.h" | 18 #include "chrome/browser/extensions/extension_install_prompt_experiment.h" |
| 20 #include "extensions/common/url_pattern.h" | 19 #include "extensions/common/url_pattern.h" |
| 21 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
| 22 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
| 23 #include "ui/gfx/image/image_skia.h" | 22 #include "ui/gfx/image/image_skia.h" |
| 24 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
| 25 | 24 |
| 26 class ExtensionInstallUI; | |
| 27 class Profile; | 25 class Profile; |
| 28 | 26 |
| 29 namespace base { | 27 namespace base { |
| 30 class DictionaryValue; | 28 class DictionaryValue; |
| 31 class MessageLoop; | 29 class MessageLoop; |
| 32 } // namespace base | 30 } // namespace base |
| 33 | 31 |
| 34 namespace content { | 32 namespace content { |
| 35 class PageNavigator; | 33 class PageNavigator; |
| 36 class WebContents; | 34 class WebContents; |
| 37 } | 35 } |
| 38 | 36 |
| 39 namespace extensions { | 37 namespace extensions { |
| 40 class BundleInstaller; | 38 class BundleInstaller; |
| 39 class CrxInstallerError; |
| 41 class Extension; | 40 class Extension; |
| 41 class ExtensionInstallUI; |
| 42 class ExtensionWebstorePrivateApiTest; | 42 class ExtensionWebstorePrivateApiTest; |
| 43 class MockGetAuthTokenFunction; | 43 class MockGetAuthTokenFunction; |
| 44 class PermissionSet; | 44 class PermissionSet; |
| 45 } // namespace extensions | 45 } // namespace extensions |
| 46 | 46 |
| 47 namespace infobars { | 47 namespace infobars { |
| 48 class InfoBarDelegate; | 48 class InfoBarDelegate; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Displays all the UI around extension installation. | 51 // Displays all the UI around extension installation. |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 // Creates a prompt with a parent web content. | 318 // Creates a prompt with a parent web content. |
| 319 explicit ExtensionInstallPrompt(content::WebContents* contents); | 319 explicit ExtensionInstallPrompt(content::WebContents* contents); |
| 320 | 320 |
| 321 // Creates a prompt with a profile, a native window and a page navigator. | 321 // Creates a prompt with a profile, a native window and a page navigator. |
| 322 ExtensionInstallPrompt(Profile* profile, | 322 ExtensionInstallPrompt(Profile* profile, |
| 323 gfx::NativeWindow native_window, | 323 gfx::NativeWindow native_window, |
| 324 content::PageNavigator* navigator); | 324 content::PageNavigator* navigator); |
| 325 | 325 |
| 326 virtual ~ExtensionInstallPrompt(); | 326 virtual ~ExtensionInstallPrompt(); |
| 327 | 327 |
| 328 ExtensionInstallUI* install_ui() const { return install_ui_.get(); } | 328 extensions::ExtensionInstallUI* install_ui() const { |
| 329 return install_ui_.get(); |
| 330 } |
| 329 | 331 |
| 330 content::WebContents* parent_web_contents() const { | 332 content::WebContents* parent_web_contents() const { |
| 331 return show_params_.parent_web_contents; | 333 return show_params_.parent_web_contents; |
| 332 } | 334 } |
| 333 | 335 |
| 334 // This is called by the bundle installer to verify whether the bundle | 336 // This is called by the bundle installer to verify whether the bundle |
| 335 // should be installed. | 337 // should be installed. |
| 336 // | 338 // |
| 337 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 339 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
| 338 virtual void ConfirmBundleInstall( | 340 virtual void ConfirmBundleInstall( |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 void OnImageLoaded(const gfx::Image& image); | 434 void OnImageLoaded(const gfx::Image& image); |
| 433 | 435 |
| 434 // Starts the process of showing a confirmation UI, which is split into two. | 436 // Starts the process of showing a confirmation UI, which is split into two. |
| 435 // 1) Set off a 'load icon' task. | 437 // 1) Set off a 'load icon' task. |
| 436 // 2) Handle the load icon response and show the UI (OnImageLoaded). | 438 // 2) Handle the load icon response and show the UI (OnImageLoaded). |
| 437 void LoadImageIfNeeded(); | 439 void LoadImageIfNeeded(); |
| 438 | 440 |
| 439 // Shows the actual UI (the icon should already be loaded). | 441 // Shows the actual UI (the icon should already be loaded). |
| 440 void ShowConfirmation(); | 442 void ShowConfirmation(); |
| 441 | 443 |
| 444 Profile* profile_; |
| 445 |
| 442 base::MessageLoop* ui_loop_; | 446 base::MessageLoop* ui_loop_; |
| 443 | 447 |
| 444 // The extensions installation icon. | 448 // The extensions installation icon. |
| 445 SkBitmap icon_; | 449 SkBitmap icon_; |
| 446 | 450 |
| 447 // The extension we are showing the UI for, if type is not | 451 // The extension we are showing the UI for, if type is not |
| 448 // BUNDLE_INSTALL_PROMPT. | 452 // BUNDLE_INSTALL_PROMPT. |
| 449 const extensions::Extension* extension_; | 453 const extensions::Extension* extension_; |
| 450 | 454 |
| 451 // The bundle we are showing the UI for, if type BUNDLE_INSTALL_PROMPT. | 455 // The bundle we are showing the UI for, if type BUNDLE_INSTALL_PROMPT. |
| 452 const extensions::BundleInstaller* bundle_; | 456 const extensions::BundleInstaller* bundle_; |
| 453 | 457 |
| 454 // A custom set of permissions to show in the install prompt instead of the | 458 // A custom set of permissions to show in the install prompt instead of the |
| 455 // extension's active permissions. | 459 // extension's active permissions. |
| 456 scoped_refptr<const extensions::PermissionSet> custom_permissions_; | 460 scoped_refptr<const extensions::PermissionSet> custom_permissions_; |
| 457 | 461 |
| 458 // The object responsible for doing the UI specific actions. | 462 // The object responsible for doing the UI specific actions. |
| 459 scoped_ptr<ExtensionInstallUI> install_ui_; | 463 scoped_ptr<extensions::ExtensionInstallUI> install_ui_; |
| 460 | 464 |
| 461 // Parameters to show the confirmation UI. | 465 // Parameters to show the confirmation UI. |
| 462 ShowParams show_params_; | 466 ShowParams show_params_; |
| 463 | 467 |
| 464 // The delegate we will call Proceed/Abort on after confirmation UI. | 468 // The delegate we will call Proceed/Abort on after confirmation UI. |
| 465 Delegate* delegate_; | 469 Delegate* delegate_; |
| 466 | 470 |
| 467 // A pre-filled prompt. | 471 // A pre-filled prompt. |
| 468 scoped_refptr<Prompt> prompt_; | 472 scoped_refptr<Prompt> prompt_; |
| 469 | 473 |
| 470 // Used to show the confirm dialog. | 474 // Used to show the confirm dialog. |
| 471 ShowDialogCallback show_dialog_callback_; | 475 ShowDialogCallback show_dialog_callback_; |
| 472 }; | 476 }; |
| 473 | 477 |
| 474 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 478 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
| OLD | NEW |