summaryrefslogtreecommitdiffstats
path: root/chrome/utility
diff options
context:
space:
mode:
authorsaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-29 23:12:15 +0000
committersaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-29 23:12:15 +0000
commit11f16d10114d6e266b590785fcf50bca63734d62 (patch)
tree8d68941d3e691746293b41dd890e7bcef0821d7d /chrome/utility
parent6a01960c32c340d4333257bf9d0244f5199d8dd8 (diff)
downloadchromium_src-11f16d10114d6e266b590785fcf50bca63734d62.zip
chromium_src-11f16d10114d6e266b590785fcf50bca63734d62.tar.gz
chromium_src-11f16d10114d6e266b590785fcf50bca63734d62.tar.bz2
Force avatar and wallpaper decoding to use robust JPEG.
The next step in an upcoming CL will bind this separate path to a different JPEG library (at a minimum on CrOS). BUG=144296 Review URL: https://chromiumcodereview.appspot.com/10892023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154001 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/utility')
-rw-r--r--chrome/utility/chrome_content_utility_client.cc14
-rw-r--r--chrome/utility/chrome_content_utility_client.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index 51fa4d5..f28771c 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;
diff --git a/chrome/utility/chrome_content_utility_client.h b/chrome/utility/chrome_content_utility_client.h
index fb82afa..e988ef1 100644
--- a/chrome/utility/chrome_content_utility_client.h
+++ b/chrome/utility/chrome_content_utility_client.h
@@ -60,6 +60,8 @@ class ChromeContentUtilityClient : public content::ContentUtilityClient {
const FilePath& metafile_path,
const printing::PdfRenderSettings& pdf_render_settings,
const std::vector<printing::PageRange>& page_ranges);
+ void OnRobustJPEGDecodeImage(
+ const std::vector<unsigned char>& encoded_data);
void OnParseJSON(const std::string& json);
#if defined(OS_WIN)