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

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

Issue 25909005: Use UtilityProcessHost to patch files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nonblocking
Patch Set: Rebase to LKGR/248226 Created 6 years, 10 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
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 10 matching lines...) Expand all
21 #include "chrome/common/extensions/update_manifest.h" 21 #include "chrome/common/extensions/update_manifest.h"
22 #include "chrome/common/safe_browsing/zip_analyzer.h" 22 #include "chrome/common/safe_browsing/zip_analyzer.h"
23 #include "chrome/utility/cloud_print/bitmap_image.h" 23 #include "chrome/utility/cloud_print/bitmap_image.h"
24 #include "chrome/utility/cloud_print/pwg_encoder.h" 24 #include "chrome/utility/cloud_print/pwg_encoder.h"
25 #include "chrome/utility/extensions/unpacker.h" 25 #include "chrome/utility/extensions/unpacker.h"
26 #include "chrome/utility/profile_import_handler.h" 26 #include "chrome/utility/profile_import_handler.h"
27 #include "chrome/utility/web_resource_unpacker.h" 27 #include "chrome/utility/web_resource_unpacker.h"
28 #include "content/public/child/image_decoder_utils.h" 28 #include "content/public/child/image_decoder_utils.h"
29 #include "content/public/common/content_paths.h" 29 #include "content/public/common/content_paths.h"
30 #include "content/public/utility/utility_thread.h" 30 #include "content/public/utility/utility_thread.h"
31 #include "courgette/courgette.h"
32 #include "courgette/third_party/bsdiff.h"
31 #include "extensions/common/extension.h" 33 #include "extensions/common/extension.h"
32 #include "extensions/common/manifest.h" 34 #include "extensions/common/manifest.h"
33 #include "media/base/media.h" 35 #include "media/base/media.h"
34 #include "media/base/media_file_checker.h" 36 #include "media/base/media_file_checker.h"
35 #include "printing/page_range.h" 37 #include "printing/page_range.h"
36 #include "printing/pdf_render_settings.h" 38 #include "printing/pdf_render_settings.h"
37 #include "third_party/skia/include/core/SkBitmap.h" 39 #include "third_party/skia/include/core/SkBitmap.h"
38 #include "third_party/zlib/google/zip.h" 40 #include "third_party/zlib/google/zip.h"
39 #include "ui/base/ui_base_switches.h" 41 #include "ui/base/ui_base_switches.h"
40 #include "ui/gfx/codec/jpeg_codec.h" 42 #include "ui/gfx/codec/jpeg_codec.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImageBase64, OnDecodeImageBase64) 343 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImageBase64, OnDecodeImageBase64)
342 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafile, 344 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafile,
343 OnRenderPDFPagesToMetafile) 345 OnRenderPDFPagesToMetafile)
344 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToPWGRaster, 346 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToPWGRaster,
345 OnRenderPDFPagesToPWGRaster) 347 OnRenderPDFPagesToPWGRaster)
346 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RobustJPEGDecodeImage, 348 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RobustJPEGDecodeImage,
347 OnRobustJPEGDecodeImage) 349 OnRobustJPEGDecodeImage)
348 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseJSON, OnParseJSON) 350 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseJSON, OnParseJSON)
349 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterCapsAndDefaults, 351 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterCapsAndDefaults,
350 OnGetPrinterCapsAndDefaults) 352 OnGetPrinterCapsAndDefaults)
353 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileBsdiff,
354 OnPatchFileBsdiff)
355 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileCourgette,
356 OnPatchFileCourgette)
351 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_StartupPing, OnStartupPing) 357 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_StartupPing, OnStartupPing)
352 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection, 358 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection,
353 OnAnalyzeZipFileForDownloadProtection) 359 OnAnalyzeZipFileForDownloadProtection)
354 360
355 #if !defined(OS_ANDROID) && !defined(OS_IOS) 361 #if !defined(OS_ANDROID) && !defined(OS_IOS)
356 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_CheckMediaFile, OnCheckMediaFile) 362 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_CheckMediaFile, OnCheckMediaFile)
357 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseMediaMetadata, 363 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseMediaMetadata,
358 OnParseMediaMetadata) 364 OnParseMediaMetadata)
359 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) 365 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
360 366
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 printer_name, printer_info)); 746 printer_name, printer_info));
741 } else // NOLINT 747 } else // NOLINT
742 #endif 748 #endif
743 { 749 {
744 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( 750 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed(
745 printer_name)); 751 printer_name));
746 } 752 }
747 ReleaseProcessIfNeeded(); 753 ReleaseProcessIfNeeded();
748 } 754 }
749 755
756 void ChromeContentUtilityClient::OnPatchFileBsdiff(
757 const base::FilePath& input_file,
758 const base::FilePath& patch_file,
759 const base::FilePath& output_file) {
760 if (input_file.empty() || patch_file.empty() || output_file.empty()) {
761 Send(new ChromeUtilityHostMsg_PatchFile_Failed(-1));
762 } else {
763 const int patch_status = courgette::ApplyBinaryPatch(input_file,
764 patch_file,
765 output_file);
766 if (patch_status != courgette::OK)
767 Send(new ChromeUtilityHostMsg_PatchFile_Failed(patch_status));
768 else
769 Send(new ChromeUtilityHostMsg_PatchFile_Succeeded());
770 }
771 ReleaseProcessIfNeeded();
772 }
773
774 void ChromeContentUtilityClient::OnPatchFileCourgette(
775 const base::FilePath& input_file,
776 const base::FilePath& patch_file,
777 const base::FilePath& output_file) {
778 if (input_file.empty() || patch_file.empty() || output_file.empty()) {
779 Send(new ChromeUtilityHostMsg_PatchFile_Failed(-1));
780 } else {
781 const int patch_status = courgette::ApplyEnsemblePatch(
782 input_file.value().c_str(),
783 patch_file.value().c_str(),
784 output_file.value().c_str());
785 if (patch_status != courgette::C_OK)
786 Send(new ChromeUtilityHostMsg_PatchFile_Failed(patch_status));
787 else
788 Send(new ChromeUtilityHostMsg_PatchFile_Succeeded());
789 }
790 ReleaseProcessIfNeeded();
791 }
792
750 void ChromeContentUtilityClient::OnStartupPing() { 793 void ChromeContentUtilityClient::OnStartupPing() {
751 Send(new ChromeUtilityHostMsg_ProcessStarted); 794 Send(new ChromeUtilityHostMsg_ProcessStarted);
752 // Don't release the process, we assume further messages are on the way. 795 // Don't release the process, we assume further messages are on the way.
753 } 796 }
754 797
755 void ChromeContentUtilityClient::OnAnalyzeZipFileForDownloadProtection( 798 void ChromeContentUtilityClient::OnAnalyzeZipFileForDownloadProtection(
756 const IPC::PlatformFileForTransit& zip_file) { 799 const IPC::PlatformFileForTransit& zip_file) {
757 safe_browsing::zip_analyzer::Results results; 800 safe_browsing::zip_analyzer::Results results;
758 safe_browsing::zip_analyzer::AnalyzeZipFile( 801 safe_browsing::zip_analyzer::AnalyzeZipFile(
759 IPC::PlatformFileForTransitToPlatformFile(zip_file), &results); 802 IPC::PlatformFileForTransitToPlatformFile(zip_file), &results);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 picasa::PicasaAlbumsIndexer indexer(album_uids); 897 picasa::PicasaAlbumsIndexer indexer(album_uids);
855 indexer.ParseFolderINI(folders_inis); 898 indexer.ParseFolderINI(folders_inis);
856 899
857 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished( 900 Send(new ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished(
858 indexer.albums_images())); 901 indexer.albums_images()));
859 ReleaseProcessIfNeeded(); 902 ReleaseProcessIfNeeded();
860 } 903 }
861 #endif // defined(OS_WIN) || defined(OS_MACOSX) 904 #endif // defined(OS_WIN) || defined(OS_MACOSX)
862 905
863 } // namespace chrome 906 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698