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

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: reordered. 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
« no previous file with comments | « chrome/utility/chrome_content_utility_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f28771c4880c88697fcc48191c6d5bc88638c0fb 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"
@@ -83,6 +84,8 @@ bool ChromeContentUtilityClient::OnMessageReceived(
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImageBase64, OnDecodeImageBase64)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafile,
OnRenderPDFPagesToMetafile)
+ IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RobustJPEGDecodeImage,
+ OnRobustJPEGDecodeImage)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseJSON, OnParseJSON)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterCapsAndDefaults,
OnGetPrinterCapsAndDefaults)
@@ -357,6 +360,17 @@ bool ChromeContentUtilityClient::RenderPDFToWinMetafile(
}
#endif // defined(OS_WIN)
+void ChromeContentUtilityClient::OnRobustJPEGDecodeImage(
+ 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::OnParseJSON(const std::string& json) {
int error_code;
« no previous file with comments | « 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