| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 | |
| 12 class Browser; | |
| 13 class ExtensionInstallPrompt; | |
| 14 class Profile; | |
| 15 class SkBitmap; | |
| 16 | |
| 17 namespace extensions { | |
| 18 class CrxInstallerError; | |
| 19 class Extension; | |
| 20 class ExtensionWebstorePrivateApiTest; | |
| 21 } | |
| 22 | |
| 23 // Interface that should be implemented for each platform to display all the UI | |
| 24 // around extension installation. | |
| 25 class ExtensionInstallUI { | |
| 26 public: | |
| 27 static ExtensionInstallUI* Create(Profile* profile); | |
| 28 | |
| 29 virtual ~ExtensionInstallUI(); | |
| 30 | |
| 31 // Called when an extension was installed. | |
| 32 virtual void OnInstallSuccess(const extensions::Extension* extension, | |
| 33 const SkBitmap* icon) = 0; | |
| 34 | |
| 35 // Called when an extension failed to install. | |
| 36 virtual void OnInstallFailure(const extensions::CrxInstallerError& error) = 0; | |
| 37 | |
| 38 | |
| 39 // TODO(asargent) Normally we navigate to the new tab page when an app is | |
| 40 // installed, but we're experimenting with instead showing a bubble when | |
| 41 // an app is installed which points to the new tab button. This may become | |
| 42 // the default behavior in the future. | |
| 43 virtual void SetUseAppInstalledBubble(bool use_bubble) = 0; | |
| 44 | |
| 45 // Whether or not to show the default UI after completing the installation. | |
| 46 void set_skip_post_install_ui(bool skip_ui) { | |
| 47 skip_post_install_ui_ = skip_ui; | |
| 48 } | |
| 49 | |
| 50 // Opens apps UI and animates the app icon for the app with id |app_id|. | |
| 51 static void OpenAppInstalledUI(Profile* profile, const std::string& app_id); | |
| 52 | |
| 53 #if defined(UNIT_TEST) | |
| 54 static void set_disable_failure_ui_for_tests() { | |
| 55 disable_failure_ui_for_tests_ = true; | |
| 56 } | |
| 57 #endif | |
| 58 | |
| 59 // Creates an ExtensionInstallPrompt from |browser|. | |
| 60 // Caller assumes ownership. | |
| 61 static ExtensionInstallPrompt* CreateInstallPromptWithBrowser( | |
| 62 Browser* browser); | |
| 63 | |
| 64 // Creates an ExtensionInstallPrompt from |profile|. | |
| 65 // Caller assumes ownership. This method is deprecated and should not be used | |
| 66 // in new code. | |
| 67 static ExtensionInstallPrompt* CreateInstallPromptWithProfile( | |
| 68 Profile* profile); | |
| 69 | |
| 70 Profile* profile() { return profile_; } | |
| 71 | |
| 72 protected: | |
| 73 explicit ExtensionInstallUI(Profile* profile); | |
| 74 | |
| 75 static bool disable_failure_ui_for_tests() { | |
| 76 return disable_failure_ui_for_tests_; | |
| 77 } | |
| 78 | |
| 79 bool skip_post_install_ui() const { return skip_post_install_ui_; } | |
| 80 | |
| 81 private: | |
| 82 static bool disable_failure_ui_for_tests_; | |
| 83 | |
| 84 Profile* profile_; | |
| 85 | |
| 86 // Whether or not to show the default UI after completing the installation. | |
| 87 bool skip_post_install_ui_; | |
| 88 | |
| 89 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallUI); | |
| 90 }; | |
| 91 | |
| 92 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ | |
| OLD | NEW |