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 f4569b2cc4d3affd283dcc2db6affa950fae7a7c..8b2a018ffa408cc3cfac71196c6556305542929b 100644 |
--- a/chrome/utility/chrome_content_utility_client.cc |
+++ b/chrome/utility/chrome_content_utility_client.cc |
@@ -31,6 +31,8 @@ |
#include "content/public/common/content_paths.h" |
#include "content/public/common/content_switches.h" |
#include "content/public/utility/utility_thread.h" |
+#include "courgette/courgette.h" |
+#include "courgette/third_party/bsdiff.h" |
#include "extensions/common/extension.h" |
#include "extensions/common/manifest.h" |
#include "media/base/media.h" |
@@ -371,6 +373,10 @@ bool ChromeContentUtilityClient::OnMessageReceived( |
OnGetPrinterCapsAndDefaults) |
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults, |
OnGetPrinterSemanticCapsAndDefaults) |
+ IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileBsdiff, |
+ OnPatchFileBsdiff) |
+ IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileCourgette, |
+ OnPatchFileCourgette) |
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_StartupPing, OnStartupPing) |
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection, |
OnAnalyzeZipFileForDownloadProtection) |
@@ -801,6 +807,43 @@ void ChromeContentUtilityClient::OnGetPrinterSemanticCapsAndDefaults( |
ReleaseProcessIfNeeded(); |
} |
+void ChromeContentUtilityClient::OnPatchFileBsdiff( |
+ const base::FilePath& input_file, |
+ const base::FilePath& patch_file, |
+ const base::FilePath& output_file) { |
+ if (input_file.empty() || patch_file.empty() || output_file.empty()) { |
+ Send(new ChromeUtilityHostMsg_PatchFile_Failed(-1)); |
+ } else { |
+ const int patch_status = courgette::ApplyBinaryPatch(input_file, |
+ patch_file, |
+ output_file); |
+ if (patch_status != courgette::OK) |
+ Send(new ChromeUtilityHostMsg_PatchFile_Failed(patch_status)); |
+ else |
+ Send(new ChromeUtilityHostMsg_PatchFile_Succeeded()); |
+ } |
+ ReleaseProcessIfNeeded(); |
+} |
+ |
+void ChromeContentUtilityClient::OnPatchFileCourgette( |
+ const base::FilePath& input_file, |
+ const base::FilePath& patch_file, |
+ const base::FilePath& output_file) { |
+ if (input_file.empty() || patch_file.empty() || output_file.empty()) { |
+ Send(new ChromeUtilityHostMsg_PatchFile_Failed(-1)); |
+ } else { |
+ const int patch_status = courgette::ApplyEnsemblePatch( |
+ input_file.value().c_str(), |
+ patch_file.value().c_str(), |
+ output_file.value().c_str()); |
+ if (patch_status != courgette::C_OK) |
+ Send(new ChromeUtilityHostMsg_PatchFile_Failed(patch_status)); |
+ else |
+ Send(new ChromeUtilityHostMsg_PatchFile_Succeeded()); |
+ } |
+ ReleaseProcessIfNeeded(); |
+} |
+ |
void ChromeContentUtilityClient::OnStartupPing() { |
Send(new ChromeUtilityHostMsg_ProcessStarted); |
// Don't release the process, we assume further messages are on the way. |