| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 7 |
| 8 #include "app/gfx/native_widget_types.h" | 8 #include "app/gfx/native_widget_types.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| 11 #include "base/scoped_ptr.h" |
| 12 #include "third_party/skia/include/core/SkBitmap.h" |
| 11 | 13 |
| 12 #include <string> | 14 #include <string> |
| 13 | 15 |
| 14 class Extension; | 16 class Extension; |
| 15 class ExtensionsService; | 17 class ExtensionsService; |
| 16 class MessageLoop; | 18 class MessageLoop; |
| 17 class Profile; | 19 class Profile; |
| 18 class InfoBarDelegate; | 20 class InfoBarDelegate; |
| 19 class SandboxedExtensionUnpacker; | 21 class SandboxedExtensionUnpacker; |
| 20 class SkBitmap; | |
| 21 class TabContents; | 22 class TabContents; |
| 22 | 23 |
| 23 // Displays all the UI around extension installation. | 24 // Displays all the UI around extension installation. |
| 24 class ExtensionInstallUI { | 25 class ExtensionInstallUI { |
| 25 public: | 26 public: |
| 26 class Delegate { | 27 class Delegate { |
| 27 public: | 28 public: |
| 28 // We call this method after ConfirmInstall() to signal that the | 29 // We call this method after ConfirmInstall() to signal that the |
| 29 // installation should continue. | 30 // installation should continue. |
| 30 virtual void ContinueInstall() = 0; | 31 virtual void ContinueInstall() = 0; |
| 31 | 32 |
| 32 // We call this method after ConfirmInstall() to signal that the | 33 // We call this method after ConfirmInstall() to signal that the |
| 33 // installation should stop. | 34 // installation should stop. |
| 34 virtual void AbortInstall() = 0; | 35 virtual void AbortInstall() = 0; |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 // NOTE: The implementations of these functions are platform-specific. | 38 // NOTE: The implementations of these functions are platform-specific. |
| 38 static void ShowExtensionInstallPrompt(Profile* profile, | 39 static void ShowExtensionInstallPrompt(Profile* profile, |
| 39 Delegate* delegate, | 40 Delegate* delegate, |
| 40 Extension* extension, | 41 Extension* extension, |
| 41 SkBitmap* install_icon, | 42 SkBitmap* install_icon, |
| 42 const std::wstring& warning_text); | 43 const std::wstring& warning_text); |
| 43 static void ShowExtensionInstallError(const std::string& error); | 44 static void ShowExtensionInstallError(const std::string& error); |
| 44 | 45 |
| 45 ExtensionInstallUI(Profile* profile); | 46 explicit ExtensionInstallUI(Profile* profile); |
| 46 | 47 |
| 47 // This is called by the installer to verify whether the installation should | 48 // This is called by the installer to verify whether the installation should |
| 48 // proceed. | 49 // proceed. |
| 49 // | 50 // |
| 50 // We *MUST* eventually call either ContinueInstall() or AbortInstall() | 51 // We *MUST* eventually call either ContinueInstall() or AbortInstall() |
| 51 // on |delegate|. | 52 // on |delegate|. |
| 52 void ConfirmInstall(Delegate* delegate, Extension* extension, | 53 void ConfirmInstall(Delegate* delegate, Extension* extension, |
| 53 SkBitmap* icon); | 54 SkBitmap* icon); |
| 54 | 55 |
| 55 // Installation was successful. | 56 // Installation was successful. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 68 void ShowThemeInfoBar(Extension* new_theme); | 69 void ShowThemeInfoBar(Extension* new_theme); |
| 69 | 70 |
| 70 // Returns the delegate to control the browser's info bar. This is within its | 71 // Returns the delegate to control the browser's info bar. This is within its |
| 71 // own function due to its platform-specific nature. | 72 // own function due to its platform-specific nature. |
| 72 InfoBarDelegate* GetNewInfoBarDelegate(Extension* new_theme, | 73 InfoBarDelegate* GetNewInfoBarDelegate(Extension* new_theme, |
| 73 TabContents* tab_contents); | 74 TabContents* tab_contents); |
| 74 | 75 |
| 75 Profile* profile_; | 76 Profile* profile_; |
| 76 MessageLoop* ui_loop_; | 77 MessageLoop* ui_loop_; |
| 77 std::string previous_theme_id_; // Used to undo theme installation. | 78 std::string previous_theme_id_; // Used to undo theme installation. |
| 79 SkBitmap icon_; // The extensions installation icon. |
| 78 | 80 |
| 79 #if defined(TOOLKIT_GTK) | 81 #if defined(TOOLKIT_GTK) |
| 80 // Also needed to undo theme installation in the linux UI. | 82 // Also needed to undo theme installation in the linux UI. |
| 81 bool previous_use_gtk_theme_; | 83 bool previous_use_gtk_theme_; |
| 82 #endif | 84 #endif |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ | 87 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ |
| OLD | NEW |