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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 IDS_UTILITY_PROCESS_SAFE_BROWSING_ZIP_FILE_ANALYZER_NAME)); | 66 IDS_UTILITY_PROCESS_SAFE_BROWSING_ZIP_FILE_ANALYZER_NAME)); |
67 utility_process_host->Send( | 67 utility_process_host->Send( |
68 new ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection( | 68 new ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection( |
69 IPC::TakePlatformFileForTransit(std::move(file_)))); | 69 IPC::TakePlatformFileForTransit(std::move(file_)))); |
70 } | 70 } |
71 | 71 |
72 void SandboxedDMGAnalyzer::OnProcessCrashed(int exit_code) { | 72 void SandboxedDMGAnalyzer::OnProcessCrashed(int exit_code) { |
73 OnAnalysisFinished(zip_analyzer::Results()); | 73 OnAnalysisFinished(zip_analyzer::Results()); |
74 } | 74 } |
75 | 75 |
76 void SandboxedDMGAnalyzer::OnProcessLaunchFailed() { | 76 void SandboxedDMGAnalyzer::OnProcessLaunchFailed(int error_code) { |
77 OnAnalysisFinished(zip_analyzer::Results()); | 77 OnAnalysisFinished(zip_analyzer::Results()); |
78 } | 78 } |
79 | 79 |
80 bool SandboxedDMGAnalyzer::OnMessageReceived(const IPC::Message& message) { | 80 bool SandboxedDMGAnalyzer::OnMessageReceived(const IPC::Message& message) { |
81 bool handled = true; | 81 bool handled = true; |
82 IPC_BEGIN_MESSAGE_MAP(SandboxedDMGAnalyzer, message) | 82 IPC_BEGIN_MESSAGE_MAP(SandboxedDMGAnalyzer, message) |
83 IPC_MESSAGE_HANDLER( | 83 IPC_MESSAGE_HANDLER( |
84 ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished, | 84 ChromeUtilityHostMsg_AnalyzeDmgFileForDownloadProtection_Finished, |
85 OnAnalysisFinished) | 85 OnAnalysisFinished) |
86 IPC_MESSAGE_UNHANDLED(handled = false) | 86 IPC_MESSAGE_UNHANDLED(handled = false) |
87 IPC_END_MESSAGE_MAP() | 87 IPC_END_MESSAGE_MAP() |
88 return handled; | 88 return handled; |
89 } | 89 } |
90 | 90 |
91 void SandboxedDMGAnalyzer::OnAnalysisFinished( | 91 void SandboxedDMGAnalyzer::OnAnalysisFinished( |
92 const zip_analyzer::Results& results) { | 92 const zip_analyzer::Results& results) { |
93 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 93 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
94 if (callback_called_) | 94 if (callback_called_) |
95 return; | 95 return; |
96 | 96 |
97 callback_called_ = true; | 97 callback_called_ = true; |
98 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 98 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
99 base::Bind(callback_, results)); | 99 base::Bind(callback_, results)); |
100 } | 100 } |
101 | 101 |
102 } // namespace safe_browsing | 102 } // namespace safe_browsing |
OLD | NEW |