| 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/browser/safe_browsing/sandboxed_zip_analyzer.h" | 5 #include "chrome/browser/safe_browsing/sandboxed_zip_analyzer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 void SandboxedZipAnalyzer::RunCallback(const zip_analyzer::Results& results) { | 111 void SandboxedZipAnalyzer::RunCallback(const zip_analyzer::Results& results) { |
| 112 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 112 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 113 callback_.Run(results); | 113 callback_.Run(results); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void SandboxedZipAnalyzer::StartProcessOnIOThread() { | 116 void SandboxedZipAnalyzer::StartProcessOnIOThread() { |
| 117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 118 utility_process_host_ = content::UtilityProcessHost::Create( | 118 utility_process_host_ = content::UtilityProcessHost::Create( |
| 119 this, | 119 this, |
| 120 BrowserThread::GetMessageLoopProxyForThread( | 120 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get()) |
| 121 BrowserThread::IO))->AsWeakPtr(); | 121 ->AsWeakPtr(); |
| 122 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); | 122 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); |
| 123 // Wait for the startup notification before sending the main IPC to the | 123 // Wait for the startup notification before sending the main IPC to the |
| 124 // utility process, so that we can dup the file handle. | 124 // utility process, so that we can dup the file handle. |
| 125 } | 125 } |
| 126 | 126 |
| 127 void SandboxedZipAnalyzer::OnUtilityProcessStarted() { | 127 void SandboxedZipAnalyzer::OnUtilityProcessStarted() { |
| 128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 129 if (utility_process_host_->GetData().handle == base::kNullProcessHandle) { | 129 if (utility_process_host_->GetData().handle == base::kNullProcessHandle) { |
| 130 DLOG(ERROR) << "Child process handle is null"; | 130 DLOG(ERROR) << "Child process handle is null"; |
| 131 } | 131 } |
| 132 utility_process_host_->Send( | 132 utility_process_host_->Send( |
| 133 new ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection( | 133 new ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection( |
| 134 IPC::GetFileHandleForProcess( | 134 IPC::GetFileHandleForProcess( |
| 135 zip_platform_file_, | 135 zip_platform_file_, |
| 136 utility_process_host_->GetData().handle, | 136 utility_process_host_->GetData().handle, |
| 137 true /* close_source_handle */))); | 137 true /* close_source_handle */))); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace safe_browsing | 140 } // namespace safe_browsing |
| OLD | NEW |