| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_dmg_analyzer_mac.h" | 5 #include "chrome/browser/safe_browsing/sandboxed_dmg_analyzer_mac.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "chrome/common/chrome_utility_messages.h" | 10 #include "chrome/common/chrome_utility_messages.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 IPC_MESSAGE_HANDLER( | 84 IPC_MESSAGE_HANDLER( |
| 85 ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished, | 85 ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished, |
| 86 OnAnalysisFinished) | 86 OnAnalysisFinished) |
| 87 IPC_MESSAGE_UNHANDLED(handled = false) | 87 IPC_MESSAGE_UNHANDLED(handled = false) |
| 88 IPC_END_MESSAGE_MAP() | 88 IPC_END_MESSAGE_MAP() |
| 89 return handled; | 89 return handled; |
| 90 } | 90 } |
| 91 | 91 |
| 92 void SandboxedDMGAnalyzer::OnUtilityProcessStarted() { | 92 void SandboxedDMGAnalyzer::OnUtilityProcessStarted() { |
| 93 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 93 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 94 | |
| 95 base::ProcessHandle utility_process = | |
| 96 content::RenderProcessHost::run_renderer_in_process() ? | |
| 97 base::GetCurrentProcessHandle() : | |
| 98 utility_process_host_->GetData().handle; | |
| 99 if (utility_process == base::kNullProcessHandle) { | |
| 100 DLOG(ERROR) << "Child process handle is null"; | |
| 101 } | |
| 102 | |
| 103 utility_process_host_->Send( | 94 utility_process_host_->Send( |
| 104 new ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection( | 95 new ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection( |
| 105 IPC::TakeFileHandleForProcess(std::move(file_), utility_process))); | 96 IPC::TakePlatformFileForTransit(std::move(file_)))); |
| 106 } | 97 } |
| 107 | 98 |
| 108 void SandboxedDMGAnalyzer::OnAnalysisFinished( | 99 void SandboxedDMGAnalyzer::OnAnalysisFinished( |
| 109 const zip_analyzer::Results& results) { | 100 const zip_analyzer::Results& results) { |
| 110 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 101 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 111 if (callback_called_) | 102 if (callback_called_) |
| 112 return; | 103 return; |
| 113 | 104 |
| 114 callback_called_ = true; | 105 callback_called_ = true; |
| 115 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 106 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 116 base::Bind(callback_, results)); | 107 base::Bind(callback_, results)); |
| 117 } | 108 } |
| 118 | 109 |
| 119 } // namespace safe_browsing | 110 } // namespace safe_browsing |
| OLD | NEW |