NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / extensions / extension_install_ui.h
blobdc43b787deea8e80219a6aeb9fa9eb678fa5115d
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_
8 #include <string>
10 #include "base/basictypes.h"
12 class Browser;
13 class ExtensionInstallPrompt;
14 class Profile;
15 class SkBitmap;
17 namespace extensions {
18 class CrxInstallerError;
19 class Extension;
20 class ExtensionWebstorePrivateApiTest;
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);
29 virtual ~ExtensionInstallUI();
31 // Called when an extension was installed.
32 virtual void OnInstallSuccess(const extensions::Extension* extension,
33 SkBitmap* icon) = 0;
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;
57 #endif
59 // Creates an ExtensionInstallPrompt from |browser|.
60 // Caller assumes ownership.
61 static ExtensionInstallPrompt* CreateInstallPromptWithBrowser(
62 Browser* browser);
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);
70 Profile* profile() { return profile_; }
72 protected:
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_; }
81 private:
82 static bool disable_failure_ui_for_tests_;
84 Profile* profile_;
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_