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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « chrome/utility/chrome_content_utility_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/utility/chrome_content_utility_client.h" 5 #include "chrome/utility/chrome_content_utility_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 14 matching lines...) Expand all
25 #include "courgette/courgette.h" 25 #include "courgette/courgette.h"
26 #include "courgette/third_party/bsdiff.h" 26 #include "courgette/third_party/bsdiff.h"
27 #include "ipc/ipc_channel.h" 27 #include "ipc/ipc_channel.h"
28 #include "skia/ext/image_operations.h" 28 #include "skia/ext/image_operations.h"
29 #include "third_party/skia/include/core/SkBitmap.h" 29 #include "third_party/skia/include/core/SkBitmap.h"
30 #include "third_party/zlib/google/zip.h" 30 #include "third_party/zlib/google/zip.h"
31 #include "ui/gfx/geometry/size.h" 31 #include "ui/gfx/geometry/size.h"
32 32
33 #if defined(OS_CHROMEOS) 33 #if defined(OS_CHROMEOS)
34 #include "ui/gfx/chromeos/codec/jpeg_codec_robust_slow.h" 34 #include "ui/gfx/chromeos/codec/jpeg_codec_robust_slow.h"
35 #include "ui/gfx/codec/png_codec.h"
35 #endif 36 #endif
36 37
37 #if !defined(OS_ANDROID) 38 #if !defined(OS_ANDROID)
38 #include "chrome/common/resource_usage_reporter.mojom.h" 39 #include "chrome/common/resource_usage_reporter.mojom.h"
39 #include "chrome/utility/profile_import_handler.h" 40 #include "chrome/utility/profile_import_handler.h"
40 #include "mojo/public/cpp/bindings/strong_binding.h" 41 #include "mojo/public/cpp/bindings/strong_binding.h"
41 #include "net/proxy/mojo_proxy_resolver_factory_impl.h" 42 #include "net/proxy/mojo_proxy_resolver_factory_impl.h"
42 #include "net/proxy/proxy_resolver_v8.h" 43 #include "net/proxy/proxy_resolver_v8.h"
43 #endif 44 #endif
44 45
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 const IPC::Message& message) { 160 const IPC::Message& message) {
160 if (filter_messages_ && !ContainsKey(message_id_whitelist_, message.type())) 161 if (filter_messages_ && !ContainsKey(message_id_whitelist_, message.type()))
161 return false; 162 return false;
162 163
163 bool handled = true; 164 bool handled = true;
164 IPC_BEGIN_MESSAGE_MAP(ChromeContentUtilityClient, message) 165 IPC_BEGIN_MESSAGE_MAP(ChromeContentUtilityClient, message)
165 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImage, OnDecodeImage) 166 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImage, OnDecodeImage)
166 #if defined(OS_CHROMEOS) 167 #if defined(OS_CHROMEOS)
167 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RobustJPEGDecodeImage, 168 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RobustJPEGDecodeImage,
168 OnRobustJPEGDecodeImage) 169 OnRobustJPEGDecodeImage)
170 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RobustPNGDecodeImage,
171 OnRobustPNGDecodeImage)
169 #endif // defined(OS_CHROMEOS) 172 #endif // defined(OS_CHROMEOS)
170 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileBsdiff, 173 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileBsdiff,
171 OnPatchFileBsdiff) 174 OnPatchFileBsdiff)
172 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileCourgette, 175 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileCourgette,
173 OnPatchFileCourgette) 176 OnPatchFileCourgette)
174 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_StartupPing, OnStartupPing) 177 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_StartupPing, OnStartupPing)
175 #if defined(FULL_SAFE_BROWSING) 178 #if defined(FULL_SAFE_BROWSING)
176 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection, 179 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection,
177 OnAnalyzeZipFileForDownloadProtection) 180 OnAnalyzeZipFileForDownloadProtection)
178 #if defined(OS_MACOSX) 181 #if defined(OS_MACOSX)
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 Send(new ChromeUtilityHostMsg_DecodeImage_Failed(request_id)); 323 Send(new ChromeUtilityHostMsg_DecodeImage_Failed(request_id));
321 } else { 324 } else {
322 Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(*decoded_image, 325 Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(*decoded_image,
323 request_id)); 326 request_id));
324 } 327 }
325 } else { 328 } else {
326 Send(new ChromeUtilityHostMsg_DecodeImage_Failed(request_id)); 329 Send(new ChromeUtilityHostMsg_DecodeImage_Failed(request_id));
327 } 330 }
328 ReleaseProcessIfNeeded(); 331 ReleaseProcessIfNeeded();
329 } 332 }
333
334 void ChromeContentUtilityClient::OnRobustPNGDecodeImage(
335 const std::vector<unsigned char>& encoded_data,
336 int request_id) {
337 // Our robust PNG decoding is using libpng.
338 if (!encoded_data.empty()) {
339 SkBitmap decoded_image;
340 if (gfx::PNGCodec::Decode(encoded_data.data(),
341 encoded_data.size(),
342 &decoded_image)) {
343 Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(decoded_image,
344 request_id));
345 } else {
346 Send(new ChromeUtilityHostMsg_DecodeImage_Failed(request_id));
347 }
348 } else {
349 Send(new ChromeUtilityHostMsg_DecodeImage_Failed(request_id));
350 }
351 ReleaseProcessIfNeeded();
352 }
330 #endif // defined(OS_CHROMEOS) 353 #endif // defined(OS_CHROMEOS)
331 354
332 void ChromeContentUtilityClient::OnPatchFileBsdiff( 355 void ChromeContentUtilityClient::OnPatchFileBsdiff(
333 const base::FilePath& input_file, 356 const base::FilePath& input_file,
334 const base::FilePath& patch_file, 357 const base::FilePath& patch_file,
335 const base::FilePath& output_file) { 358 const base::FilePath& output_file) {
336 if (input_file.empty() || patch_file.empty() || output_file.empty()) { 359 if (input_file.empty() || patch_file.empty() || output_file.empty()) {
337 Send(new ChromeUtilityHostMsg_PatchFile_Finished(-1)); 360 Send(new ChromeUtilityHostMsg_PatchFile_Finished(-1));
338 } else { 361 } else {
339 const int patch_status = courgette::ApplyBinaryPatch(input_file, 362 const int patch_status = courgette::ApplyBinaryPatch(input_file,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 safe_browsing::zip_analyzer::Results results; 407 safe_browsing::zip_analyzer::Results results;
385 safe_browsing::dmg::AnalyzeDMGFile( 408 safe_browsing::dmg::AnalyzeDMGFile(
386 IPC::PlatformFileForTransitToFile(dmg_file), &results); 409 IPC::PlatformFileForTransitToFile(dmg_file), &results);
387 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( 410 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished(
388 results)); 411 results));
389 ReleaseProcessIfNeeded(); 412 ReleaseProcessIfNeeded();
390 } 413 }
391 #endif // defined(OS_MACOSX) 414 #endif // defined(OS_MACOSX)
392 415
393 #endif // defined(FULL_SAFE_BROWSING) 416 #endif // defined(FULL_SAFE_BROWSING)
OLDNEW
« 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