diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-17 05:55:32 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-17 05:55:32 +0000 |
commit | c690a981436bb6a6d69ab8df959ffa5b116bf356 (patch) | |
tree | dfb4134472778bdb6409679faec3fea2e4946633 /chrome/browser/extensions/crx_installer.cc | |
parent | 5d39e314de21a384eaa226d4875b6a6e8e1bea17 (diff) | |
download | chromium_src-c690a981436bb6a6d69ab8df959ffa5b116bf356.zip chromium_src-c690a981436bb6a6d69ab8df959ffa5b116bf356.tar.gz chromium_src-c690a981436bb6a6d69ab8df959ffa5b116bf356.tar.bz2 |
Add the right-click context menu for Browser actions and Page Actions.
BUG=29538
TEST=Right-click an extension icon and make sure all the options work for both
Page and Browser actions (Options should be grayed out when there is no Options
page specified in the manifest).
Review URL: http://codereview.chromium.org/486022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34812 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/crx_installer.cc')
-rw-r--r-- | chrome/browser/extensions/crx_installer.cc | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index bfd6ef4..ca01297 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -18,7 +18,6 @@ #include "chrome/common/notification_type.h" #include "grit/chromium_strings.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "webkit/glue/image_decoder.h" namespace { // Helper function to delete files. This is used to avoid ugly casts which @@ -155,50 +154,14 @@ void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir, } if (client_.get()) { - FilePath icon_path = - extension_->GetIconPath(Extension::EXTENSION_ICON_LARGE).GetFilePath(); - DecodeInstallIcon(icon_path, &install_icon_); + Extension::DecodeIcon(extension_.get(), Extension::EXTENSION_ICON_LARGE, + &install_icon_); } ChromeThread::PostTask( ChromeThread::UI, FROM_HERE, NewRunnableMethod(this, &CrxInstaller::ConfirmInstall)); } -// static -void CrxInstaller::DecodeInstallIcon(const FilePath& large_icon_path, - scoped_ptr<SkBitmap>* result) { - if (large_icon_path.empty()) - return; - - std::string file_contents; - if (!file_util::ReadFileToString(large_icon_path, &file_contents)) { - LOG(ERROR) << "Could not read icon file: " - << WideToUTF8(large_icon_path.ToWStringHack()); - return; - } - - // Decode the image using WebKit's image decoder. - const unsigned char* data = - reinterpret_cast<const unsigned char*>(file_contents.data()); - webkit_glue::ImageDecoder decoder; - scoped_ptr<SkBitmap> decoded(new SkBitmap()); - *decoded = decoder.Decode(data, file_contents.length()); - if (decoded->empty()) { - LOG(ERROR) << "Could not decode icon file: " - << WideToUTF8(large_icon_path.ToWStringHack()); - return; - } - - if (decoded->width() != 128 || decoded->height() != 128) { - LOG(ERROR) << "Icon file has unexpected size: " - << IntToString(decoded->width()) << "x" - << IntToString(decoded->height()); - return; - } - - result->swap(decoded); -} - void CrxInstaller::ConfirmInstall() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); if (frontend_->extension_prefs()->IsExtensionBlacklisted(extension_->id())) { |