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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 IPC_MESSAGE_HANDLER( | 115 IPC_MESSAGE_HANDLER( |
116 ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished, | 116 ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished, |
117 OnAnalyzeZipFileFinished) | 117 OnAnalyzeZipFileFinished) |
118 IPC_MESSAGE_UNHANDLED(handled = false) | 118 IPC_MESSAGE_UNHANDLED(handled = false) |
119 IPC_END_MESSAGE_MAP() | 119 IPC_END_MESSAGE_MAP() |
120 return handled; | 120 return handled; |
121 } | 121 } |
122 | 122 |
123 void SandboxedZipAnalyzer::StartProcessOnIOThread() { | 123 void SandboxedZipAnalyzer::StartProcessOnIOThread() { |
124 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 124 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
125 utility_process_host_ = content::UtilityProcessHost::Create( | 125 utility_process_host_ = |
126 this, | 126 content::UtilityProcessHost::Create( |
127 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get()) | 127 this, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO).get()) |
128 ->AsWeakPtr(); | 128 ->AsWeakPtr(); |
129 utility_process_host_->SetName(l10n_util::GetStringUTF16( | 129 utility_process_host_->SetName(l10n_util::GetStringUTF16( |
130 IDS_UTILITY_PROCESS_SAFE_BROWSING_ZIP_FILE_ANALYZER_NAME)); | 130 IDS_UTILITY_PROCESS_SAFE_BROWSING_ZIP_FILE_ANALYZER_NAME)); |
131 utility_process_host_->Send( | 131 utility_process_host_->Send( |
132 new ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection( | 132 new ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection( |
133 IPC::TakePlatformFileForTransit(std::move(zip_file_)), | 133 IPC::TakePlatformFileForTransit(std::move(zip_file_)), |
134 IPC::GetPlatformFileForTransit(temp_file_.GetPlatformFile(), | 134 IPC::GetPlatformFileForTransit(temp_file_.GetPlatformFile(), |
135 false /* !close_source_handle */))); | 135 false /* !close_source_handle */))); |
136 } | 136 } |
137 | 137 |
138 void SandboxedZipAnalyzer::OnAnalyzeZipFileFinished( | 138 void SandboxedZipAnalyzer::OnAnalyzeZipFileFinished( |
139 const zip_analyzer::Results& results) { | 139 const zip_analyzer::Results& results) { |
140 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 140 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
141 if (callback_called_) | 141 if (callback_called_) |
142 return; | 142 return; |
143 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 143 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
144 base::Bind(callback_, results)); | 144 base::Bind(callback_, results)); |
145 callback_called_ = true; | 145 callback_called_ = true; |
146 CloseTemporaryFile(); | 146 CloseTemporaryFile(); |
147 } | 147 } |
148 | 148 |
149 } // namespace safe_browsing | 149 } // namespace safe_browsing |
OLD | NEW |