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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_
10 #include "base/basictypes.h"
13 class ExtensionInstallPrompt
;
17 namespace extensions
{
18 class CrxInstallerError
;
20 class ExtensionWebstorePrivateApiTest
;
23 // Interface that should be implemented for each platform to display all the UI
24 // around extension installation.
25 class ExtensionInstallUI
{
27 static ExtensionInstallUI
* Create(Profile
* profile
);
29 virtual ~ExtensionInstallUI();
31 // Called when an extension was installed.
32 virtual void OnInstallSuccess(const extensions::Extension
* extension
,
35 // Called when an extension failed to install.
36 virtual void OnInstallFailure(const extensions::CrxInstallerError
& error
) = 0;
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;
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
;
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
);
53 #if defined(UNIT_TEST)
54 static void set_disable_failure_ui_for_tests() {
55 disable_failure_ui_for_tests_
= true;
59 // Creates an ExtensionInstallPrompt from |browser|.
60 // Caller assumes ownership.
61 static ExtensionInstallPrompt
* CreateInstallPromptWithBrowser(
64 // Creates an ExtensionInstallPrompt from |profile|.
65 // Caller assumes ownership. This method is deprecated and should not be used
67 static ExtensionInstallPrompt
* CreateInstallPromptWithProfile(
70 Profile
* profile() { return profile_
; }
73 explicit ExtensionInstallUI(Profile
* profile
);
75 static bool disable_failure_ui_for_tests() {
76 return disable_failure_ui_for_tests_
;
79 bool skip_post_install_ui() const { return skip_post_install_ui_
; }
82 static bool disable_failure_ui_for_tests_
;
86 // Whether or not to show the default UI after completing the installation.
87 bool skip_post_install_ui_
;
89 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallUI
);
92 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_