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 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 class Extension; | 14 class Extension; |
15 class ExtensionsService; | 15 class ExtensionsService; |
16 class MessageLoop; | 16 class MessageLoop; |
17 class Profile; | 17 class Profile; |
| 18 class InfoBarDelegate; |
18 class SandboxedExtensionUnpacker; | 19 class SandboxedExtensionUnpacker; |
19 class SkBitmap; | 20 class SkBitmap; |
| 21 class TabContents; |
20 | 22 |
21 // Displays all the UI around extension installation. | 23 // Displays all the UI around extension installation. |
22 class ExtensionInstallUI { | 24 class ExtensionInstallUI { |
23 public: | 25 public: |
24 class Delegate { | 26 class Delegate { |
25 public: | 27 public: |
26 // We call this method after ConfirmInstall() to signal that the | 28 // We call this method after ConfirmInstall() to signal that the |
27 // installation should continue. | 29 // installation should continue. |
28 virtual void ContinueInstall() = 0; | 30 virtual void ContinueInstall() = 0; |
29 | 31 |
30 // We call this method after ConfirmInstall() to signal that the | 32 // We call this method after ConfirmInstall() to signal that the |
31 // installation should stop. | 33 // installation should stop. |
32 virtual void AbortInstall() = 0; | 34 virtual void AbortInstall() = 0; |
33 }; | 35 }; |
34 | 36 |
35 // NOTE: The implementation of this is platform-specific. | 37 // NOTE: The implementations of these functions are platform-specific. |
36 static void ShowExtensionInstallPrompt(Profile* profile, | 38 static void ShowExtensionInstallPrompt(Profile* profile, |
37 Delegate* delegate, | 39 Delegate* delegate, |
38 Extension* extension, | 40 Extension* extension, |
39 SkBitmap* install_icon, | 41 SkBitmap* install_icon, |
40 const std::wstring& warning_text); | 42 const std::wstring& warning_text); |
| 43 static void ShowExtensionInstallError(const std::string& error); |
41 | 44 |
42 ExtensionInstallUI(Profile* profile); | 45 ExtensionInstallUI(Profile* profile); |
43 | 46 |
44 // This is called by the installer to verify whether the installation should | 47 // This is called by the installer to verify whether the installation should |
45 // proceed. | 48 // proceed. |
46 // | 49 // |
47 // We *MUST* eventually call either ContinueInstall() or AbortInstall() | 50 // We *MUST* eventually call either ContinueInstall() or AbortInstall() |
48 // on |delegate|. | 51 // on |delegate|. |
49 void ConfirmInstall(Delegate* delegate, Extension* extension, | 52 void ConfirmInstall(Delegate* delegate, Extension* extension, |
50 SkBitmap* icon); | 53 SkBitmap* icon); |
51 | 54 |
52 // Installation was successful. | 55 // Installation was successful. |
53 void OnInstallSuccess(Extension* extension); | 56 void OnInstallSuccess(Extension* extension); |
54 | 57 |
55 // Intallation failed. | 58 // Intallation failed. |
56 void OnInstallFailure(const std::string& error); | 59 void OnInstallFailure(const std::string& error); |
57 | 60 |
58 // The install was rejected because the same extension/version is already | 61 // The install was rejected because the same extension/version is already |
59 // installed. | 62 // installed. |
60 void OnOverinstallAttempted(Extension* extension); | 63 void OnOverinstallAttempted(Extension* extension); |
61 | 64 |
62 private: | 65 private: |
| 66 // When a Theme is downloaded it is applied and an info bar is shown to give |
| 67 // the user a choice to keep it or undo the installation. |
63 void ShowThemeInfoBar(Extension* new_theme); | 68 void ShowThemeInfoBar(Extension* new_theme); |
64 | 69 |
| 70 // Returns the delegate to control the browser's info bar. This is within its |
| 71 // own function due to its platform-specific nature. |
| 72 InfoBarDelegate* GetNewInfoBarDelegate(Extension* new_theme, |
| 73 TabContents* tab_contents); |
| 74 |
65 Profile* profile_; | 75 Profile* profile_; |
66 MessageLoop* ui_loop_; | 76 MessageLoop* ui_loop_; |
67 std::string previous_theme_id_; // Used to undo theme installation. | 77 std::string previous_theme_id_; // Used to undo theme installation. |
68 | 78 |
69 #if defined(TOOLKIT_GTK) | 79 #if defined(TOOLKIT_GTK) |
70 // Also needed to undo theme installation in the linux UI. | 80 // Also needed to undo theme installation in the linux UI. |
71 bool previous_use_gtk_theme_; | 81 bool previous_use_gtk_theme_; |
72 #endif | 82 #endif |
73 }; | 83 }; |
74 | 84 |
75 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ | 85 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ |
OLD | NEW |