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

Unified Diff: chrome/utility/chrome_content_utility_client.cc

Issue 10892023: Force avatar and wallpaper decoding to use robust JPEG. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Applied commnets Created 8 years, 4 months 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/utility/chrome_content_utility_client.cc
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index 51fa4d562c07372a480835b982a76aae2a7bf3b6..d587b9a91fcb2a94d1741bfc0ab463e985faf3bd 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -28,6 +28,7 @@
#include "printing/page_range.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/ui_base_switches.h"
+#include "ui/gfx/codec/jpeg_codec.h"
#include "ui/gfx/rect.h"
#include "webkit/glue/image_decoder.h"
@@ -81,6 +82,8 @@ bool ChromeContentUtilityClient::OnMessageReceived(
OnParseUpdateManifest)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImage, OnDecodeImage)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImageBase64, OnDecodeImageBase64)
+ IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImageWithIJGlibjpeg,
+ OnDecodeImageWithIJGlibjpeg)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafile,
OnRenderPDFPagesToMetafile)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseJSON, OnParseJSON)
@@ -184,6 +187,19 @@ void ChromeContentUtilityClient::OnDecodeImageBase64(
OnDecodeImage(decoded_vector);
}
+void ChromeContentUtilityClient::OnDecodeImageWithIJGlibjpeg(
+ const std::vector<unsigned char>& encoded_data) {
+ webkit_glue::ImageDecoder decoder;
+ scoped_ptr<SkBitmap> decoded_image(gfx::JPEGCodec::Decode(&encoded_data[0],
oshima 2012/08/29 01:32:29 align encoded_data.size() to &encoded_data[0]. If
Emmanuel Saint-loubert-Bié 2012/08/29 01:57:18 Done.
+ encoded_data.size()));
+ if (decoded_image->empty()) {
+ Send(new ChromeUtilityHostMsg_DecodeImage_Failed());
+ } else {
+ Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(*decoded_image));
+ }
+ content::UtilityThread::Get()->ReleaseProcessIfNeeded();
+}
+
void ChromeContentUtilityClient::OnRenderPDFPagesToMetafile(
base::PlatformFile pdf_file,
const FilePath& metafile_path,
« chrome/browser/image_decoder.h ('K') | « chrome/utility/chrome_content_utility_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698