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

Unified Diff: chrome/utility/chrome_content_utility_client.cc

Issue 1764603002: Added ROBUST_PNG_CODEC to ImageDecoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 9 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 b3cc69653f23d1b8222e31aa5ca1f8160bdb1940..7d54f4eebe581bfa55a92d7038296349e4f4081a 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -32,6 +32,7 @@
#if defined(OS_CHROMEOS)
#include "ui/gfx/chromeos/codec/jpeg_codec_robust_slow.h"
+#include "ui/gfx/codec/png_codec.h"
#endif
#if !defined(OS_ANDROID)
@@ -166,6 +167,8 @@ bool ChromeContentUtilityClient::OnMessageReceived(
#if defined(OS_CHROMEOS)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RobustJPEGDecodeImage,
OnRobustJPEGDecodeImage)
+ IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RobustPNGDecodeImage,
+ OnRobustPNGDecodeImage)
#endif // defined(OS_CHROMEOS)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileBsdiff,
OnPatchFileBsdiff)
@@ -327,6 +330,26 @@ void ChromeContentUtilityClient::OnRobustJPEGDecodeImage(
}
ReleaseProcessIfNeeded();
}
+
+void ChromeContentUtilityClient::OnRobustPNGDecodeImage(
+ const std::vector<unsigned char>& encoded_data,
+ int request_id) {
+ // Our robust PNG decoding is using libpng.
+ if (!encoded_data.empty()) {
+ SkBitmap decoded_image;
+ if (gfx::PNGCodec::Decode(encoded_data.data(),
+ encoded_data.size(),
+ &decoded_image)) {
+ Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(decoded_image,
+ request_id));
+ } else {
+ Send(new ChromeUtilityHostMsg_DecodeImage_Failed(request_id));
+ }
+ } else {
+ Send(new ChromeUtilityHostMsg_DecodeImage_Failed(request_id));
+ }
+ ReleaseProcessIfNeeded();
+}
#endif // defined(OS_CHROMEOS)
void ChromeContentUtilityClient::OnPatchFileBsdiff(
« 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