| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 const IPC::Message& message) { | 154 const IPC::Message& message) { |
| 155 if (filter_messages_ && !ContainsKey(message_id_whitelist_, message.type())) | 155 if (filter_messages_ && !ContainsKey(message_id_whitelist_, message.type())) |
| 156 return false; | 156 return false; |
| 157 | 157 |
| 158 bool handled = true; | 158 bool handled = true; |
| 159 IPC_BEGIN_MESSAGE_MAP(ChromeContentUtilityClient, message) | 159 IPC_BEGIN_MESSAGE_MAP(ChromeContentUtilityClient, message) |
| 160 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileBsdiff, | 160 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileBsdiff, |
| 161 OnPatchFileBsdiff) | 161 OnPatchFileBsdiff) |
| 162 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileCourgette, | 162 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_PatchFileCourgette, |
| 163 OnPatchFileCourgette) | 163 OnPatchFileCourgette) |
| 164 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_StartupPing, OnStartupPing) | |
| 165 #if defined(FULL_SAFE_BROWSING) | 164 #if defined(FULL_SAFE_BROWSING) |
| 166 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection, | 165 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection, |
| 167 OnAnalyzeZipFileForDownloadProtection) | 166 OnAnalyzeZipFileForDownloadProtection) |
| 168 #if defined(OS_MACOSX) | 167 #if defined(OS_MACOSX) |
| 169 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection, | 168 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection, |
| 170 OnAnalyzeDmgFileForDownloadProtection) | 169 OnAnalyzeDmgFileForDownloadProtection) |
| 171 #endif // defined(OS_MACOSX) | 170 #endif // defined(OS_MACOSX) |
| 172 #endif // defined(FULL_SAFE_BROWSING) | 171 #endif // defined(FULL_SAFE_BROWSING) |
| 173 #if defined(OS_CHROMEOS) | 172 #if defined(OS_CHROMEOS) |
| 174 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_CreateZipFile, OnCreateZipFile) | 173 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_CreateZipFile, OnCreateZipFile) |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 } else { | 270 } else { |
| 272 const int patch_status = courgette::ApplyEnsemblePatch( | 271 const int patch_status = courgette::ApplyEnsemblePatch( |
| 273 input_file.value().c_str(), | 272 input_file.value().c_str(), |
| 274 patch_file.value().c_str(), | 273 patch_file.value().c_str(), |
| 275 output_file.value().c_str()); | 274 output_file.value().c_str()); |
| 276 Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status)); | 275 Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status)); |
| 277 } | 276 } |
| 278 ReleaseProcessIfNeeded(); | 277 ReleaseProcessIfNeeded(); |
| 279 } | 278 } |
| 280 | 279 |
| 281 void ChromeContentUtilityClient::OnStartupPing() { | |
| 282 Send(new ChromeUtilityHostMsg_ProcessStarted); | |
| 283 // Don't release the process, we assume further messages are on the way. | |
| 284 } | |
| 285 | |
| 286 #if defined(FULL_SAFE_BROWSING) | 280 #if defined(FULL_SAFE_BROWSING) |
| 287 void ChromeContentUtilityClient::OnAnalyzeZipFileForDownloadProtection( | 281 void ChromeContentUtilityClient::OnAnalyzeZipFileForDownloadProtection( |
| 288 const IPC::PlatformFileForTransit& zip_file, | 282 const IPC::PlatformFileForTransit& zip_file, |
| 289 const IPC::PlatformFileForTransit& temp_file) { | 283 const IPC::PlatformFileForTransit& temp_file) { |
| 290 safe_browsing::zip_analyzer::Results results; | 284 safe_browsing::zip_analyzer::Results results; |
| 291 safe_browsing::zip_analyzer::AnalyzeZipFile( | 285 safe_browsing::zip_analyzer::AnalyzeZipFile( |
| 292 IPC::PlatformFileForTransitToFile(zip_file), | 286 IPC::PlatformFileForTransitToFile(zip_file), |
| 293 IPC::PlatformFileForTransitToFile(temp_file), &results); | 287 IPC::PlatformFileForTransitToFile(temp_file), &results); |
| 294 Send(new ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished( | 288 Send(new ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished( |
| 295 results)); | 289 results)); |
| 296 ReleaseProcessIfNeeded(); | 290 ReleaseProcessIfNeeded(); |
| 297 } | 291 } |
| 298 | 292 |
| 299 #if defined(OS_MACOSX) | 293 #if defined(OS_MACOSX) |
| 300 void ChromeContentUtilityClient::OnAnalyzeDmgFileForDownloadProtection( | 294 void ChromeContentUtilityClient::OnAnalyzeDmgFileForDownloadProtection( |
| 301 const IPC::PlatformFileForTransit& dmg_file) { | 295 const IPC::PlatformFileForTransit& dmg_file) { |
| 302 safe_browsing::zip_analyzer::Results results; | 296 safe_browsing::zip_analyzer::Results results; |
| 303 safe_browsing::dmg::AnalyzeDMGFile( | 297 safe_browsing::dmg::AnalyzeDMGFile( |
| 304 IPC::PlatformFileForTransitToFile(dmg_file), &results); | 298 IPC::PlatformFileForTransitToFile(dmg_file), &results); |
| 305 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( | 299 Send(new ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished( |
| 306 results)); | 300 results)); |
| 307 ReleaseProcessIfNeeded(); | 301 ReleaseProcessIfNeeded(); |
| 308 } | 302 } |
| 309 #endif // defined(OS_MACOSX) | 303 #endif // defined(OS_MACOSX) |
| 310 | 304 |
| 311 #endif // defined(FULL_SAFE_BROWSING) | 305 #endif // defined(FULL_SAFE_BROWSING) |
| OLD | NEW |