Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1261)

Unified Diff: chrome/browser/extensions/crx_installer.cc

Issue 501136: Merge 34812 - Add the rightclick context menu for Browser actions and Page... (Closed) Base URL: svn://chrome-svn/chrome/branches/249/src/
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/crx_installer.cc
===================================================================
--- chrome/browser/extensions/crx_installer.cc (revision 35008)
+++ chrome/browser/extensions/crx_installer.cc (working copy)
@@ -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
@@ -150,50 +149,14 @@
}
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())) {
« no previous file with comments | « chrome/browser/extensions/crx_installer.h ('k') | chrome/browser/extensions/extension_action_context_menu_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698