| 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_UI_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "chrome/browser/extensions/crx_installer_error.h" | 13 #include "chrome/browser/extensions/crx_installer_error.h" |
| 14 | 14 |
| 15 class Browser; | 15 class Browser; |
| 16 class Profile; |
| 16 class SkBitmap; | 17 class SkBitmap; |
| 17 | 18 |
| 18 namespace extensions { | 19 namespace extensions { |
| 19 class Extension; | 20 class Extension; |
| 20 class ExtensionWebstorePrivateApiTest; | 21 class ExtensionWebstorePrivateApiTest; |
| 21 } // namespace extensions | 22 } // namespace extensions |
| 22 | 23 |
| 23 // Interface that should be implemented for each platform to display all the UI | 24 // Interface that should be implemented for each platform to display all the UI |
| 24 // around extension installation. | 25 // around extension installation. |
| 25 class ExtensionInstallUI { | 26 class ExtensionInstallUI { |
| 26 public: | 27 public: |
| 27 static ExtensionInstallUI* Create(Browser* browser); | 28 static ExtensionInstallUI* Create(Profile* profile); |
| 28 | 29 |
| 29 virtual ~ExtensionInstallUI(); | 30 virtual ~ExtensionInstallUI(); |
| 30 | 31 |
| 31 // Called when an extension was installed. | 32 // Called when an extension was installed. |
| 32 virtual void OnInstallSuccess(const extensions::Extension* extension, | 33 virtual void OnInstallSuccess(const extensions::Extension* extension, |
| 33 SkBitmap* icon) = 0; | 34 SkBitmap* icon) = 0; |
| 34 // Called when an extension failed to install. | 35 // Called when an extension failed to install. |
| 35 virtual void OnInstallFailure(const CrxInstallerError& error) = 0; | 36 virtual void OnInstallFailure(const CrxInstallerError& error) = 0; |
| 36 | 37 |
| 37 // Whether or not to show the default UI after completing the installation. | 38 // Whether or not to show the default UI after completing the installation. |
| 38 virtual void SetSkipPostInstallUI(bool skip_ui) = 0; | 39 virtual void SetSkipPostInstallUI(bool skip_ui) = 0; |
| 39 | 40 |
| 40 // TODO(asargent) Normally we navigate to the new tab page when an app is | 41 // TODO(asargent) Normally we navigate to the new tab page when an app is |
| 41 // installed, but we're experimenting with instead showing a bubble when | 42 // installed, but we're experimenting with instead showing a bubble when |
| 42 // an app is installed which points to the new tab button. This may become | 43 // an app is installed which points to the new tab button. This may become |
| 43 // the default behavior in the future. | 44 // the default behavior in the future. |
| 44 virtual void SetUseAppInstalledBubble(bool use_bubble) = 0; | 45 virtual void SetUseAppInstalledBubble(bool use_bubble) = 0; |
| 45 | 46 |
| 46 // Opens apps UI and animates the app icon for the app with id |app_id|. | 47 // Opens apps UI and animates the app icon for the app with id |app_id|. |
| 47 static void OpenAppInstalledUI(Browser* browser, const std::string& app_id); | 48 static void OpenAppInstalledUI(Browser* browser, const std::string& app_id); |
| 48 | 49 |
| 49 // Disables showing UI (ErrorBox, etc.) for install failures. To be used only | 50 // Disables showing UI (ErrorBox, etc.) for install failures. To be used only |
| 50 // in tests. | 51 // in tests. |
| 51 static void DisableFailureUIForTests(); | 52 static void DisableFailureUIForTests(); |
| 52 | 53 |
| 53 Browser* browser() { return browser_; } | 54 Profile* profile() { return profile_; } |
| 54 | 55 |
| 55 protected: | 56 protected: |
| 56 ExtensionInstallUI(); | 57 ExtensionInstallUI(); |
| 57 | 58 |
| 58 Browser* browser_; | 59 Profile* profile_; |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ | 62 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ |
| OLD | NEW |