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> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "chrome/common/chrome_utility_messages.h" | 10 #include "chrome/common/chrome_utility_messages.h" |
9 #include "chrome/common/safe_browsing/zip_analyzer_results.h" | 11 #include "chrome/common/safe_browsing/zip_analyzer_results.h" |
10 #include "chrome/grit/generated_resources.h" | 12 #include "chrome/grit/generated_resources.h" |
11 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/child_process_data.h" | 14 #include "content/public/browser/child_process_data.h" |
13 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
14 #include "ipc/ipc_message_macros.h" | 16 #include "ipc/ipc_message_macros.h" |
15 #include "ipc/ipc_platform_file.h" | 17 #include "ipc/ipc_platform_file.h" |
16 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 base::ProcessHandle utility_process = | 87 base::ProcessHandle utility_process = |
86 content::RenderProcessHost::run_renderer_in_process() ? | 88 content::RenderProcessHost::run_renderer_in_process() ? |
87 base::GetCurrentProcessHandle() : | 89 base::GetCurrentProcessHandle() : |
88 utility_process_host_->GetData().handle; | 90 utility_process_host_->GetData().handle; |
89 if (utility_process == base::kNullProcessHandle) { | 91 if (utility_process == base::kNullProcessHandle) { |
90 DLOG(ERROR) << "Child process handle is null"; | 92 DLOG(ERROR) << "Child process handle is null"; |
91 } | 93 } |
92 | 94 |
93 utility_process_host_->Send( | 95 utility_process_host_->Send( |
94 new ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection( | 96 new ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection( |
95 IPC::TakeFileHandleForProcess(file_.Pass(), utility_process))); | 97 IPC::TakeFileHandleForProcess(std::move(file_), utility_process))); |
96 } | 98 } |
97 | 99 |
98 void SandboxedDMGAnalyzer::OnAnalysisFinished( | 100 void SandboxedDMGAnalyzer::OnAnalysisFinished( |
99 const zip_analyzer::Results& results) { | 101 const zip_analyzer::Results& results) { |
100 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 102 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
101 if (callback_called_) | 103 if (callback_called_) |
102 return; | 104 return; |
103 | 105 |
104 callback_called_ = true; | 106 callback_called_ = true; |
105 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 107 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
106 base::Bind(callback_, results)); | 108 base::Bind(callback_, results)); |
107 } | 109 } |
108 | 110 |
109 } // namespace safe_browsing | 111 } // namespace safe_browsing |
OLD | NEW |