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 EXTENSIONS_BROWSER_INSTALL_EXTENSION_INSTALL_UI_H_
6 #define EXTENSIONS_BROWSER_INSTALL_EXTENSION_INSTALL_UI_H_
10 #include "base/basictypes.h"
11 #include "ui/gfx/native_widget_types.h"
15 namespace extensions
{
16 class CrxInstallError
;
19 // Interface that should be implemented for each platform to display all the UI
20 // around extension installation.
21 class ExtensionInstallUI
{
24 virtual ~ExtensionInstallUI();
26 // Called when an extension was installed.
27 virtual void OnInstallSuccess(const extensions::Extension
* extension
,
28 const SkBitmap
* icon
) = 0;
30 // Called when an extension failed to install.
31 virtual void OnInstallFailure(const extensions::CrxInstallError
& error
) = 0;
33 // TODO(asargent) Normally we navigate to the new tab page when an app is
34 // installed, but we're experimenting with instead showing a bubble when
35 // an app is installed which points to the new tab button. This may become
36 // the default behavior in the future.
37 virtual void SetUseAppInstalledBubble(bool use_bubble
) = 0;
39 // Opens apps UI and animates the app icon for the app with id |app_id|.
40 virtual void OpenAppInstalledUI(const std::string
& app_id
) = 0;
42 // Sets whether to show the default UI after completing the installation.
43 virtual void SetSkipPostInstallUI(bool skip_ui
) = 0;
45 // Returns the gfx::NativeWindow to use as the parent for install dialogs.
46 // Returns NULL if the install dialog should be a top level window. This
47 // method is deprecated - do not add new callers.
48 // TODO(pkotwicz): Remove this method. crbug.com/422474
49 virtual gfx::NativeWindow
GetDefaultInstallDialogParent() = 0;
51 #if defined(UNIT_TEST)
52 static void set_disable_failure_ui_for_tests() {
53 disable_failure_ui_for_tests_
= true;
58 static bool disable_failure_ui_for_tests() {
59 return disable_failure_ui_for_tests_
;
63 static bool disable_failure_ui_for_tests_
;
65 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallUI
);
68 } // namespace extensions
70 #endif // EXTENSIONS_BROWSER_INSTALL_EXTENSION_INSTALL_UI_H_