summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-13 23:03:19 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-13 23:03:19 +0000
commit7a5452f958569405f8e3d830c250d0f217ce3346 (patch)
treebd88612de4f895bf4937510fde676b74a1576f89
parentc114ae785961a879b7f0a5dcd275b8513d8be47e (diff)
downloadchromium_src-7a5452f958569405f8e3d830c250d0f217ce3346.zip
chromium_src-7a5452f958569405f8e3d830c250d0f217ce3346.tar.gz
chromium_src-7a5452f958569405f8e3d830c250d0f217ce3346.tar.bz2
Fix bug where icon is not displayed in extension install bubbles
when installed from store. BUG=65346 TEST=Install any extension from the web store. Should see icon in install success bubble. Review URL: http://codereview.chromium.org/5690004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69060 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/crx_installer.cc4
-rw-r--r--chrome/browser/extensions/crx_installer_browsertest.cc6
-rw-r--r--chrome/browser/extensions/extension_install_ui.cc14
-rw-r--r--chrome/browser/extensions/extension_install_ui.h6
4 files changed, 22 insertions, 8 deletions
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index 09fd7ea..8ed780a 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -282,7 +282,7 @@ void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir,
return;
}
- if (client_ || extension_->GetFullLaunchURL().is_valid()) {
+ if (client_) {
Extension::DecodeIcon(extension_.get(), Extension::EXTENSION_ICON_LARGE,
&install_icon_);
}
@@ -430,7 +430,7 @@ void CrxInstaller::ReportSuccessFromUIThread() {
// If there is a client, tell the client about installation.
if (client_)
- client_->OnInstallSuccess(extension_.get());
+ client_->OnInstallSuccess(extension_.get(), install_icon_.get());
// Tell the frontend about the installation and hand off ownership of
// extension_ to it.
diff --git a/chrome/browser/extensions/crx_installer_browsertest.cc b/chrome/browser/extensions/crx_installer_browsertest.cc
index 382eff6..9dae4a5 100644
--- a/chrome/browser/extensions/crx_installer_browsertest.cc
+++ b/chrome/browser/extensions/crx_installer_browsertest.cc
@@ -10,6 +10,8 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/test/ui_test_utils.h"
+class SkBitmap;
+
namespace {
class MockInstallUI : public ExtensionInstallUI {
@@ -25,11 +27,11 @@ class MockInstallUI : public ExtensionInstallUI {
confirmation_requested_ = true;
delegate->InstallUIProceed();
}
- void OnInstallSuccess(const Extension* extension) {
+ void OnInstallSuccess(const Extension* extension, SkBitmap* icon) {
MessageLoopForUI::current()->Quit();
}
void OnInstallFailure(const std::string& error) {
- ADD_FAILURE() << "insall failed";
+ ADD_FAILURE() << "install failed";
MessageLoopForUI::current()->Quit();
}
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc
index 313a21a..f0634d3 100644
--- a/chrome/browser/extensions/extension_install_ui.cc
+++ b/chrome/browser/extensions/extension_install_ui.cc
@@ -122,7 +122,11 @@ void ExtensionInstallUI::ConfirmUninstall(Delegate* delegate,
ShowConfirmation(UNINSTALL_PROMPT);
}
-void ExtensionInstallUI::OnInstallSuccess(const Extension* extension) {
+void ExtensionInstallUI::OnInstallSuccess(const Extension* extension,
+ SkBitmap* icon) {
+ extension_ = extension;
+ SetIcon(icon);
+
if (extension->is_theme()) {
ShowThemeInfoBar(previous_theme_id_, previous_use_system_theme_,
extension, profile_);
@@ -181,8 +185,7 @@ void ExtensionInstallUI::OnInstallFailure(const std::string& error) {
UTF8ToUTF16(error));
}
-void ExtensionInstallUI::OnImageLoaded(
- SkBitmap* image, ExtensionResource resource, int index) {
+void ExtensionInstallUI::SetIcon(SkBitmap* image) {
if (image)
icon_ = *image;
else
@@ -196,6 +199,11 @@ void ExtensionInstallUI::OnImageLoaded(
IDR_EXTENSION_DEFAULT_ICON);
}
}
+}
+
+void ExtensionInstallUI::OnImageLoaded(
+ SkBitmap* image, ExtensionResource resource, int index) {
+ SetIcon(image);
switch (prompt_type_) {
case INSTALL_PROMPT: {
diff --git a/chrome/browser/extensions/extension_install_ui.h b/chrome/browser/extensions/extension_install_ui.h
index 6cc8876..1a9b4d7 100644
--- a/chrome/browser/extensions/extension_install_ui.h
+++ b/chrome/browser/extensions/extension_install_ui.h
@@ -68,7 +68,7 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer {
virtual void ConfirmUninstall(Delegate* delegate, const Extension* extension);
// Installation was successful. This is declared virtual for testing.
- virtual void OnInstallSuccess(const Extension* extension);
+ virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon);
// Installation failed. This is declared virtual for testing.
virtual void OnInstallFailure(const std::string& error);
@@ -88,6 +88,10 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer {
const Extension* new_theme, Profile* profile);
private:
+ // Sets the icon that will be used in any UI. If |icon| is NULL, or contains
+ // an empty bitmap, then a default icon will be used instead.
+ void SetIcon(SkBitmap* icon);
+
// Starts the process of showing a confirmation UI, which is split into two.
// 1) Set off a 'load icon' task.
// 2) Handle the load icon response and show the UI (OnImageLoaded).