Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 | 261 |
| 262 if (succeeded) | 262 if (succeeded) |
| 263 Send(new ChromeUtilityHostMsg_CreateZipFile_Succeeded()); | 263 Send(new ChromeUtilityHostMsg_CreateZipFile_Succeeded()); |
| 264 else | 264 else |
| 265 Send(new ChromeUtilityHostMsg_CreateZipFile_Failed()); | 265 Send(new ChromeUtilityHostMsg_CreateZipFile_Failed()); |
| 266 ReleaseProcessIfNeeded(); | 266 ReleaseProcessIfNeeded(); |
| 267 } | 267 } |
| 268 #endif // defined(OS_CHROMEOS) | 268 #endif // defined(OS_CHROMEOS) |
| 269 | 269 |
| 270 void ChromeContentUtilityClient::OnPatchFileBsdiff( | 270 void ChromeContentUtilityClient::OnPatchFileBsdiff( |
| 271 const base::FilePath& input_file, | 271 const IPC::PlatformFileForTransit& input_file, |
| 272 const base::FilePath& patch_file, | 272 const IPC::PlatformFileForTransit& patch_file, |
| 273 const base::FilePath& output_file) { | 273 const IPC::PlatformFileForTransit& output_file) { |
| 274 if (input_file.empty() || patch_file.empty() || output_file.empty()) { | 274 const int patch_status = bsdiff::ApplyBinaryPatch( |
|
Noel Gordon
2016/12/13 05:42:08
The empty file path detection code was removed her
waffles
2016/12/13 17:38:28
It doesn't make sense to check it here, because we
| |
| 275 Send(new ChromeUtilityHostMsg_PatchFile_Finished(-1)); | 275 IPC::PlatformFileForTransitToFile(input_file), |
| 276 } else { | 276 IPC::PlatformFileForTransitToFile(patch_file), |
| 277 const int patch_status = bsdiff::ApplyBinaryPatch(input_file, | 277 IPC::PlatformFileForTransitToFile(output_file)); |
| 278 patch_file, | 278 Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status)); |
| 279 output_file); | |
| 280 Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status)); | |
| 281 } | |
| 282 ReleaseProcessIfNeeded(); | 279 ReleaseProcessIfNeeded(); |
| 283 } | 280 } |
| 284 | 281 |
| 285 void ChromeContentUtilityClient::OnPatchFileCourgette( | 282 void ChromeContentUtilityClient::OnPatchFileCourgette( |
| 286 const base::FilePath& input_file, | 283 const IPC::PlatformFileForTransit& input_file, |
| 287 const base::FilePath& patch_file, | 284 const IPC::PlatformFileForTransit& patch_file, |
| 288 const base::FilePath& output_file) { | 285 const IPC::PlatformFileForTransit& output_file) { |
| 289 if (input_file.empty() || patch_file.empty() || output_file.empty()) { | 286 const int patch_status = courgette::ApplyEnsemblePatch( |
| 290 Send(new ChromeUtilityHostMsg_PatchFile_Finished(-1)); | 287 IPC::PlatformFileForTransitToFile(input_file), |
| 291 } else { | 288 IPC::PlatformFileForTransitToFile(patch_file), |
| 292 const int patch_status = courgette::ApplyEnsemblePatch( | 289 IPC::PlatformFileForTransitToFile(output_file)); |
| 293 input_file.value().c_str(), | 290 Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status)); |
| 294 patch_file.value().c_str(), | |
| 295 output_file.value().c_str()); | |
| 296 Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status)); | |
| 297 } | |
| 298 ReleaseProcessIfNeeded(); | 291 ReleaseProcessIfNeeded(); |
| 299 } | 292 } |
| 300 | 293 |
| 301 #if defined(FULL_SAFE_BROWSING) | 294 #if defined(FULL_SAFE_BROWSING) |
| 302 void ChromeContentUtilityClient::OnAnalyzeZipFileForDownloadProtection( | 295 void ChromeContentUtilityClient::OnAnalyzeZipFileForDownloadProtection( |
| 303 const IPC::PlatformFileForTransit& zip_file, | 296 const IPC::PlatformFileForTransit& zip_file, |
| 304 const IPC::PlatformFileForTransit& temp_file) { | 297 const IPC::PlatformFileForTransit& temp_file) { |
| 305 safe_browsing::zip_analyzer::Results results; | 298 safe_browsing::zip_analyzer::Results results; |
| 306 safe_browsing::zip_analyzer::AnalyzeZipFile( | 299 safe_browsing::zip_analyzer::AnalyzeZipFile( |
| 307 IPC::PlatformFileForTransitToFile(zip_file), | 300 IPC::PlatformFileForTransitToFile(zip_file), |
| 308 IPC::PlatformFileForTransitToFile(temp_file), &results); | 301 IPC::PlatformFileForTransitToFile(temp_file), &results); |
| 309 Send(new ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished( | 302 Send(new ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished( |
| 310 results)); | 303 results)); |
| 311 ReleaseProcessIfNeeded(); | 304 ReleaseProcessIfNeeded(); |
| 312 } | 305 } |
| 313 | 306 |
| 314 #if defined(OS_MACOSX) | 307 #if defined(OS_MACOSX) |
| 315 void ChromeContentUtilityClient::OnAnalyzeDmgFileForDownloadProtection( | 308 void ChromeContentUtilityClient::OnAnalyzeDmgFileForDownloadProtection( |
| 316 const IPC::PlatformFileForTransit& dmg_file) { | 309 const IPC::PlatformFileForTransit& dmg_file) { |
| 317 safe_browsing::zip_analyzer::Results results; | 310 safe_browsing::zip_analyzer::Results results; |
| 318 safe_browsing::dmg::AnalyzeDMGFile( | 311 safe_browsing::dmg::AnalyzeDMGFile( |
| 319 IPC::PlatformFileForTransitToFile(dmg_file), &results); | 312 IPC::PlatformFileForTransitToFile(dmg_file), &results); |
| 320 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( | 313 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( |
| 321 results)); | 314 results)); |
| 322 ReleaseProcessIfNeeded(); | 315 ReleaseProcessIfNeeded(); |
| 323 } | 316 } |
| 324 #endif // defined(OS_MACOSX) | 317 #endif // defined(OS_MACOSX) |
| 325 | 318 |
| 326 #endif // defined(FULL_SAFE_BROWSING) | 319 #endif // defined(FULL_SAFE_BROWSING) |
| OLD | NEW |