| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include <vector> | 10 #include <vector> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension); | 61 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension); |
| 62 | 62 |
| 63 // This is called by the extensions management page to verify whether the | 63 // This is called by the extensions management page to verify whether the |
| 64 // uninstallation should proceed. This is declared virtual for testing. | 64 // uninstallation should proceed. This is declared virtual for testing. |
| 65 // | 65 // |
| 66 // We *MUST* eventually call either Proceed() or Abort() | 66 // We *MUST* eventually call either Proceed() or Abort() |
| 67 // on |delegate|. | 67 // on |delegate|. |
| 68 virtual void ConfirmUninstall(Delegate* delegate, const Extension* extension); | 68 virtual void ConfirmUninstall(Delegate* delegate, const Extension* extension); |
| 69 | 69 |
| 70 // Installation was successful. This is declared virtual for testing. | 70 // Installation was successful. This is declared virtual for testing. |
| 71 virtual void OnInstallSuccess(const Extension* extension); | 71 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon); |
| 72 | 72 |
| 73 // Installation failed. This is declared virtual for testing. | 73 // Installation failed. This is declared virtual for testing. |
| 74 virtual void OnInstallFailure(const std::string& error); | 74 virtual void OnInstallFailure(const std::string& error); |
| 75 | 75 |
| 76 // ImageLoadingTracker::Observer overrides. | 76 // ImageLoadingTracker::Observer overrides. |
| 77 virtual void OnImageLoaded( | 77 virtual void OnImageLoaded( |
| 78 SkBitmap* image, ExtensionResource resource, int index); | 78 SkBitmap* image, ExtensionResource resource, int index); |
| 79 | 79 |
| 80 // Show an infobar for a newly-installed theme. previous_theme_id | 80 // Show an infobar for a newly-installed theme. previous_theme_id |
| 81 // should be empty if the previous theme was the system/default | 81 // should be empty if the previous theme was the system/default |
| 82 // theme. | 82 // theme. |
| 83 // | 83 // |
| 84 // TODO(akalin): Find a better home for this (and | 84 // TODO(akalin): Find a better home for this (and |
| 85 // GetNewThemeInstalledInfoBarDelegate()). | 85 // GetNewThemeInstalledInfoBarDelegate()). |
| 86 static void ShowThemeInfoBar( | 86 static void ShowThemeInfoBar( |
| 87 const std::string& previous_theme_id, bool previous_use_system_theme, | 87 const std::string& previous_theme_id, bool previous_use_system_theme, |
| 88 const Extension* new_theme, Profile* profile); | 88 const Extension* new_theme, Profile* profile); |
| 89 | 89 |
| 90 private: | 90 private: |
| 91 // Sets the icon that will be used in any UI. If |icon| is NULL, or contains |
| 92 // an empty bitmap, then a default icon will be used instead. |
| 93 void SetIcon(SkBitmap* icon); |
| 94 |
| 91 // Starts the process of showing a confirmation UI, which is split into two. | 95 // Starts the process of showing a confirmation UI, which is split into two. |
| 92 // 1) Set off a 'load icon' task. | 96 // 1) Set off a 'load icon' task. |
| 93 // 2) Handle the load icon response and show the UI (OnImageLoaded). | 97 // 2) Handle the load icon response and show the UI (OnImageLoaded). |
| 94 void ShowConfirmation(PromptType prompt_type); | 98 void ShowConfirmation(PromptType prompt_type); |
| 95 | 99 |
| 96 #if defined(OS_MACOSX) | 100 #if defined(OS_MACOSX) |
| 97 // When an extension is installed on Mac with neither browser action nor | 101 // When an extension is installed on Mac with neither browser action nor |
| 98 // page action icons, show an infobar instead of a popup bubble. | 102 // page action icons, show an infobar instead of a popup bubble. |
| 99 void ShowGenericExtensionInstalledInfoBar(const Extension* new_extension); | 103 void ShowGenericExtensionInstalledInfoBar(const Extension* new_extension); |
| 100 #endif | 104 #endif |
| (...skipping 28 matching lines...) Expand all Loading... |
| 129 Delegate* delegate_; // The delegate we will call Proceed/Abort on after | 133 Delegate* delegate_; // The delegate we will call Proceed/Abort on after |
| 130 // confirmation UI. | 134 // confirmation UI. |
| 131 PromptType prompt_type_; // The type of prompt we are going to show. | 135 PromptType prompt_type_; // The type of prompt we are going to show. |
| 132 | 136 |
| 133 // Keeps track of extension images being loaded on the File thread for the | 137 // Keeps track of extension images being loaded on the File thread for the |
| 134 // purpose of showing the install UI. | 138 // purpose of showing the install UI. |
| 135 ImageLoadingTracker tracker_; | 139 ImageLoadingTracker tracker_; |
| 136 }; | 140 }; |
| 137 | 141 |
| 138 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ | 142 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ |
| OLD | NEW |