diff options
author | mek@chromium.org <mek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-29 18:24:05 +0000 |
---|---|---|
committer | mek@chromium.org <mek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-29 18:24:05 +0000 |
commit | f662fcb68b9e014e351670bf2fd38440257ac125 (patch) | |
tree | d929447e33755bdae77d5e55075923178c6f9d0d | |
parent | 9dc5999e0a5fa06210954922097a6a0db9722d16 (diff) | |
download | chromium_src-f662fcb68b9e014e351670bf2fd38440257ac125.zip chromium_src-f662fcb68b9e014e351670bf2fd38440257ac125.tar.gz chromium_src-f662fcb68b9e014e351670bf2fd38440257ac125.tar.bz2 |
Merge 199954 "Get rid of most chrome/browser/ users of webkit_gl..."
BUG=235897
> Get rid of most chrome/browser/ users of webkit_glue::ImageDecoder
>
> When decoding images from trusted sources or in unit tests, there's no need
> to use the WebKit image decoders - the ones in ui/gfx/ work just fine.
>
> BUG=237267
>
> Review URL: https://chromiumcodereview.appspot.com/14795010
TBR=jamesr@chromium.org
Review URL: https://codereview.chromium.org/15767008
git-svn-id: svn://svn.chromium.org/chrome/branches/1500/src@202918 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 12 insertions, 17 deletions
diff --git a/chrome/browser/extensions/convert_web_app_unittest.cc b/chrome/browser/extensions/convert_web_app_unittest.cc index 07aa715..3a750d4 100644 --- a/chrome/browser/extensions/convert_web_app_unittest.cc +++ b/chrome/browser/extensions/convert_web_app_unittest.cc @@ -26,7 +26,6 @@ #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/codec/png_codec.h" -#include "webkit/glue/image_decoder.h" namespace extensions { @@ -56,11 +55,12 @@ WebApplicationInfo::IconInfo GetIconInfo(const GURL& url, int size) { return result; } - webkit_glue::ImageDecoder decoder; - result.data = decoder.Decode( - reinterpret_cast<const unsigned char*>(icon_data.c_str()), - icon_data.size()); - EXPECT_FALSE(result.data.isNull()) << "Could not decode test icon."; + if (!gfx::PNGCodec::Decode( + reinterpret_cast<const unsigned char*>(icon_data.c_str()), + icon_data.size(), &result.data)) { + ADD_FAILURE() << "Could not decode test icon."; + return result; + } return result; } diff --git a/chrome/browser/extensions/extension_action_icon_factory_unittest.cc b/chrome/browser/extensions/extension_action_icon_factory_unittest.cc index fd6c87c..78e49e1 100644 --- a/chrome/browser/extensions/extension_action_icon_factory_unittest.cc +++ b/chrome/browser/extensions/extension_action_icon_factory_unittest.cc @@ -21,9 +21,9 @@ #include "skia/ext/image_operations.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/codec/png_codec.h" #include "ui/gfx/image/image_skia.h" #include "ui/gfx/skia_util.h" -#include "webkit/glue/image_decoder.h" #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/login/user_manager.h" @@ -75,8 +75,7 @@ gfx::Image LoadIcon(const std::string& filename) { reinterpret_cast<const unsigned char*>(file_contents.data()); SkBitmap bitmap; - webkit_glue::ImageDecoder decoder; - bitmap = decoder.Decode(data, file_contents.length()); + gfx::PNGCodec::Decode(data, file_contents.length(), &bitmap); return gfx::Image::CreateFrom1xBitmap(bitmap); } diff --git a/chrome/browser/extensions/image_loader.cc b/chrome/browser/extensions/image_loader.cc index 01a4b69..a941e23 100644 --- a/chrome/browser/extensions/image_loader.cc +++ b/chrome/browser/extensions/image_loader.cc @@ -19,8 +19,8 @@ #include "grit/theme_resources.h" #include "skia/ext/image_operations.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/codec/png_codec.h" #include "ui/gfx/image/image_skia.h" -#include "webkit/glue/image_decoder.h" #if defined(USE_AURA) #include "grit/keyboard_resources.h" @@ -83,17 +83,15 @@ void LoadImageOnBlockingPool(const ImageLoader::ImageRepresentation& image_info, return; } - // Decode the bitmap using WebKit's image decoder. const unsigned char* data = reinterpret_cast<const unsigned char*>(file_contents.data()); - webkit_glue::ImageDecoder decoder; // Note: This class only decodes bitmaps from extension resources. Chrome // doesn't (for security reasons) directly load extension resources provided // by the extension author, but instead decodes them in a separate // locked-down utility process. Only if the decoding succeeds is the image // saved from memory to disk and subsequently used in the Chrome UI. // Chrome is therefore decoding bitmaps here that were generated by Chrome. - *bitmap = decoder.Decode(data, file_contents.length()); + gfx::PNGCodec::Decode(data, file_contents.length(), bitmap); } } // namespace diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm index f3beab6..4781dd6 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm @@ -22,7 +22,7 @@ #include "chrome/common/extensions/extension_manifest_constants.h" #include "third_party/ocmock/gtest_support.h" #import "third_party/ocmock/OCMock/OCMock.h" -#include "webkit/glue/image_decoder.h" +#include "ui/gfx/codec/png_codec.h" using extensions::Extension; @@ -72,9 +72,7 @@ class ExtensionInstalledBubbleControllerTest : public CocoaProfileTest { reinterpret_cast<const unsigned char*>(file_contents.data()); SkBitmap bitmap; - webkit_glue::ImageDecoder decoder; - bitmap = decoder.Decode(data, file_contents.length()); - + gfx::PNGCodec::Decode(data, file_contents.length(), &bitmap); return bitmap; } |