Chromium Code Reviews

Side by Side Diff: chrome/utility/chrome_content_utility_client.cc

Issue 213923002: Revert of Use UtilityProcessHost to patch files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nonblocking
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « chrome/utility/chrome_content_utility_client.h ('k') | content/content_utility.gypi » ('j') | 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 "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 13 matching lines...)
24 #include "chrome/utility/cloud_print/bitmap_image.h" 24 #include "chrome/utility/cloud_print/bitmap_image.h"
25 #include "chrome/utility/cloud_print/pwg_encoder.h" 25 #include "chrome/utility/cloud_print/pwg_encoder.h"
26 #include "chrome/utility/extensions/unpacker.h" 26 #include "chrome/utility/extensions/unpacker.h"
27 #include "chrome/utility/image_writer/image_writer_handler.h" 27 #include "chrome/utility/image_writer/image_writer_handler.h"
28 #include "chrome/utility/profile_import_handler.h" 28 #include "chrome/utility/profile_import_handler.h"
29 #include "chrome/utility/web_resource_unpacker.h" 29 #include "chrome/utility/web_resource_unpacker.h"
30 #include "content/public/child/image_decoder_utils.h" 30 #include "content/public/child/image_decoder_utils.h"
31 #include "content/public/common/content_paths.h" 31 #include "content/public/common/content_paths.h"
32 #include "content/public/common/content_switches.h" 32 #include "content/public/common/content_switches.h"
33 #include "content/public/utility/utility_thread.h" 33 #include "content/public/utility/utility_thread.h"
34 #include "courgette/courgette.h"
35 #include "courgette/third_party/bsdiff.h"
36 #include "extensions/common/extension.h" 34 #include "extensions/common/extension.h"
37 #include "extensions/common/manifest.h" 35 #include "extensions/common/manifest.h"
38 #include "media/base/media.h" 36 #include "media/base/media.h"
39 #include "media/base/media_file_checker.h" 37 #include "media/base/media_file_checker.h"
40 #include "printing/page_range.h" 38 #include "printing/page_range.h"
41 #include "printing/pdf_render_settings.h" 39 #include "printing/pdf_render_settings.h"
42 #include "third_party/skia/include/core/SkBitmap.h" 40 #include "third_party/skia/include/core/SkBitmap.h"
43 #include "third_party/zlib/google/zip.h" 41 #include "third_party/zlib/google/zip.h"
44 #include "ui/base/ui_base_switches.h" 42 #include "ui/base/ui_base_switches.h"
45 #include "ui/gfx/codec/jpeg_codec.h" 43 #include "ui/gfx/codec/jpeg_codec.h"
(...skipping 320 matching lines...)
366 OnRenderPDFPagesToMetafile) 364 OnRenderPDFPagesToMetafile)
367 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToPWGRaster, 365 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToPWGRaster,
368 OnRenderPDFPagesToPWGRaster) 366 OnRenderPDFPagesToPWGRaster)
369 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RobustJPEGDecodeImage, 367 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RobustJPEGDecodeImage,
370 OnRobustJPEGDecodeImage) 368 OnRobustJPEGDecodeImage)
371 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseJSON, OnParseJSON) 369 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseJSON, OnParseJSON)
372 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterCapsAndDefaults, 370 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterCapsAndDefaults,
373 OnGetPrinterCapsAndDefaults) 371 OnGetPrinterCapsAndDefaults)
374 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults, 372 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults,
375 OnGetPrinterSemanticCapsAndDefaults) 373 OnGetPrinterSemanticCapsAndDefaults)
376 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileBsdiff,
377 OnPatchFileBsdiff)
378 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileCourgette,
379 OnPatchFileCourgette)
380 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_StartupPing, OnStartupPing) 374 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_StartupPing, OnStartupPing)
381 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection, 375 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection,
382 OnAnalyzeZipFileForDownloadProtection) 376 OnAnalyzeZipFileForDownloadProtection)
383 377
384 #if !defined(OS_ANDROID) && !defined(OS_IOS) 378 #if !defined(OS_ANDROID) && !defined(OS_IOS)
385 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_CheckMediaFile, OnCheckMediaFile) 379 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_CheckMediaFile, OnCheckMediaFile)
386 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseMediaMetadata, 380 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseMediaMetadata,
387 OnParseMediaMetadata) 381 OnParseMediaMetadata)
388 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) 382 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
389 383
(...skipping 410 matching lines...)
800 printer_name, printer_info)); 794 printer_name, printer_info));
801 } else // NOLINT 795 } else // NOLINT
802 #endif 796 #endif
803 { 797 {
804 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed( 798 Send(new ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed(
805 printer_name)); 799 printer_name));
806 } 800 }
807 ReleaseProcessIfNeeded(); 801 ReleaseProcessIfNeeded();
808 } 802 }
809 803
810 void ChromeContentUtilityClient::OnPatchFileBsdiff(
811 const base::FilePath& input_file,
812 const base::FilePath& patch_file,
813 const base::FilePath& output_file) {
814 if (input_file.empty() || patch_file.empty() || output_file.empty()) {
815 Send(new ChromeUtilityHostMsg_PatchFile_Failed(-1));
816 } else {
817 const int patch_status = courgette::ApplyBinaryPatch(input_file,
818 patch_file,
819 output_file);
820 if (patch_status != courgette::OK)
821 Send(new ChromeUtilityHostMsg_PatchFile_Failed(patch_status));
822 else
823 Send(new ChromeUtilityHostMsg_PatchFile_Succeeded());
824 }
825 ReleaseProcessIfNeeded();
826 }
827
828 void ChromeContentUtilityClient::OnPatchFileCourgette(
829 const base::FilePath& input_file,
830 const base::FilePath& patch_file,
831 const base::FilePath& output_file) {
832 if (input_file.empty() || patch_file.empty() || output_file.empty()) {
833 Send(new ChromeUtilityHostMsg_PatchFile_Failed(-1));
834 } else {
835 const int patch_status = courgette::ApplyEnsemblePatch(
836 input_file.value().c_str(),
837 patch_file.value().c_str(),
838 output_file.value().c_str());
839 if (patch_status != courgette::C_OK)
840 Send(new ChromeUtilityHostMsg_PatchFile_Failed(patch_status));
841 else
842 Send(new ChromeUtilityHostMsg_PatchFile_Succeeded());
843 }
844 ReleaseProcessIfNeeded();
845 }
846
847 void ChromeContentUtilityClient::OnStartupPing() { 804 void ChromeContentUtilityClient::OnStartupPing() {
848 Send(new ChromeUtilityHostMsg_ProcessStarted); 805 Send(new ChromeUtilityHostMsg_ProcessStarted);
849 // Don't release the process, we assume further messages are on the way. 806 // Don't release the process, we assume further messages are on the way.
850 } 807 }
851 808
852 void ChromeContentUtilityClient::OnAnalyzeZipFileForDownloadProtection( 809 void ChromeContentUtilityClient::OnAnalyzeZipFileForDownloadProtection(
853 const IPC::PlatformFileForTransit& zip_file) { 810 const IPC::PlatformFileForTransit& zip_file) {
854 safe_browsing::zip_analyzer::Results results; 811 safe_browsing::zip_analyzer::Results results;
855 safe_browsing::zip_analyzer::AnalyzeZipFile( 812 safe_browsing::zip_analyzer::AnalyzeZipFile(
856 IPC::PlatformFileForTransitToPlatformFile(zip_file), &results); 813 IPC::PlatformFileForTransitToPlatformFile(zip_file), &results);
(...skipping 116 matching lines...)
973 NetworkingPrivateCrypto crypto; 930 NetworkingPrivateCrypto crypto;
974 success = crypto.EncryptByteString(public_key, key_data, &ciphertext); 931 success = crypto.EncryptByteString(public_key, key_data, &ciphertext);
975 } 932 }
976 933
977 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext, 934 Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(ciphertext,
978 success)); 935 success));
979 } 936 }
980 #endif // defined(OS_WIN) 937 #endif // defined(OS_WIN)
981 938
982 } // namespace chrome 939 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/utility/chrome_content_utility_client.h ('k') | content/content_utility.gypi » ('j') | no next file with comments »

Powered by Google App Engine