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

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 comments. 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..7b79532d3fca7710fe2dd4ce8392673504cb4f57 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,18 @@ void ChromeContentUtilityClient::OnDecodeImageBase64(
OnDecodeImage(decoded_vector);
}
+void ChromeContentUtilityClient::OnDecodeImageWithIJGlibjpeg(
+ const std::vector<unsigned char>& encoded_data) {
+ scoped_ptr<SkBitmap> decoded_image(gfx::JPEGCodec::Decode(
+ &encoded_data[0], 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/common/chrome_utility_messages.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