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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "chrome/common/chrome_utility_messages.h" | 12 #include "chrome/common/chrome_utility_messages.h" |
13 #include "chrome/common/safe_browsing/zip_analyzer.h" | 13 #include "chrome/common/safe_browsing/zip_analyzer.h" |
| 14 #include "chrome/common/safe_browsing/zip_analyzer_results.h" |
14 #include "chrome/utility/chrome_content_utility_ipc_whitelist.h" | 15 #include "chrome/utility/chrome_content_utility_ipc_whitelist.h" |
15 #include "chrome/utility/utility_message_handler.h" | 16 #include "chrome/utility/utility_message_handler.h" |
16 #include "content/public/child/image_decoder_utils.h" | 17 #include "content/public/child/image_decoder_utils.h" |
17 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
18 #include "content/public/common/service_registry.h" | 19 #include "content/public/common/service_registry.h" |
19 #include "content/public/utility/utility_thread.h" | 20 #include "content/public/utility/utility_thread.h" |
20 #include "courgette/courgette.h" | 21 #include "courgette/courgette.h" |
21 #include "courgette/third_party/bsdiff.h" | 22 #include "courgette/third_party/bsdiff.h" |
22 #include "ipc/ipc_channel.h" | 23 #include "ipc/ipc_channel.h" |
23 #include "skia/ext/image_operations.h" | 24 #include "skia/ext/image_operations.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 ReleaseProcessIfNeeded(); | 366 ReleaseProcessIfNeeded(); |
366 } | 367 } |
367 | 368 |
368 void ChromeContentUtilityClient::OnStartupPing() { | 369 void ChromeContentUtilityClient::OnStartupPing() { |
369 Send(new ChromeUtilityHostMsg_ProcessStarted); | 370 Send(new ChromeUtilityHostMsg_ProcessStarted); |
370 // Don't release the process, we assume further messages are on the way. | 371 // Don't release the process, we assume further messages are on the way. |
371 } | 372 } |
372 | 373 |
373 #if defined(FULL_SAFE_BROWSING) | 374 #if defined(FULL_SAFE_BROWSING) |
374 void ChromeContentUtilityClient::OnAnalyzeZipFileForDownloadProtection( | 375 void ChromeContentUtilityClient::OnAnalyzeZipFileForDownloadProtection( |
375 const IPC::PlatformFileForTransit& zip_file) { | 376 const IPC::PlatformFileForTransit& zip_file, |
| 377 const IPC::PlatformFileForTransit& temp_file) { |
376 safe_browsing::zip_analyzer::Results results; | 378 safe_browsing::zip_analyzer::Results results; |
377 safe_browsing::zip_analyzer::AnalyzeZipFile( | 379 safe_browsing::zip_analyzer::AnalyzeZipFile( |
378 IPC::PlatformFileForTransitToFile(zip_file), &results); | 380 IPC::PlatformFileForTransitToFile(zip_file), |
| 381 IPC::PlatformFileForTransitToFile(temp_file), &results); |
379 Send(new ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished( | 382 Send(new ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished( |
380 results)); | 383 results)); |
381 ReleaseProcessIfNeeded(); | 384 ReleaseProcessIfNeeded(); |
382 } | 385 } |
383 #endif | 386 #endif |
384 | 387 |
385 #if defined(ENABLE_EXTENSIONS) | 388 #if defined(ENABLE_EXTENSIONS) |
386 // TODO(thestig): Try to move this to | 389 // TODO(thestig): Try to move this to |
387 // chrome/utility/extensions/extensions_handler.cc. | 390 // chrome/utility/extensions/extensions_handler.cc. |
388 void ChromeContentUtilityClient::OnParseMediaMetadata( | 391 void ChromeContentUtilityClient::OnParseMediaMetadata( |
389 const std::string& mime_type, int64 total_size, bool get_attached_images) { | 392 const std::string& mime_type, int64 total_size, bool get_attached_images) { |
390 // Only one IPCDataSource may be created and added to the list of handlers. | 393 // Only one IPCDataSource may be created and added to the list of handlers. |
391 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size); | 394 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size); |
392 handlers_.push_back(source); | 395 handlers_.push_back(source); |
393 | 396 |
394 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser( | 397 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser( |
395 source, mime_type, get_attached_images); | 398 source, mime_type, get_attached_images); |
396 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); | 399 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); |
397 } | 400 } |
398 #endif | 401 #endif |
OLD | NEW |