Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: chrome/browser/safe_browsing/sandboxed_dmg_analyzer_mac.cc

Issue 1885813002: Delete the utility process startup ping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused state. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 void SandboxedDMGAnalyzer::StartAnalysis() { 58 void SandboxedDMGAnalyzer::StartAnalysis() {
59 DCHECK_CURRENTLY_ON(BrowserThread::IO); 59 DCHECK_CURRENTLY_ON(BrowserThread::IO);
60 60
61 utility_process_host_ = 61 utility_process_host_ =
62 content::UtilityProcessHost::Create(this, 62 content::UtilityProcessHost::Create(this,
63 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)) 63 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))
64 ->AsWeakPtr(); 64 ->AsWeakPtr();
65 65
66 utility_process_host_->SetName(l10n_util::GetStringUTF16( 66 utility_process_host_->SetName(l10n_util::GetStringUTF16(
67 IDS_UTILITY_PROCESS_SAFE_BROWSING_ZIP_FILE_ANALYZER_NAME)); 67 IDS_UTILITY_PROCESS_SAFE_BROWSING_ZIP_FILE_ANALYZER_NAME));
68 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); 68 utility_process_host_->Send(
69 new ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection(
70 IPC::TakePlatformFileForTransit(std::move(file_))));
69 } 71 }
Scott Hess - ex-Googler 2016/04/13 17:44:43 I suspect this may also no longer need to be an in
Anand Mistry (off Chromium) 2016/04/13 23:42:57 It's unneeded (and reset does nothing since it's a
70 72
71 void SandboxedDMGAnalyzer::OnProcessCrashed(int exit_code) { 73 void SandboxedDMGAnalyzer::OnProcessCrashed(int exit_code) {
72 OnAnalysisFinished(zip_analyzer::Results()); 74 OnAnalysisFinished(zip_analyzer::Results());
73 } 75 }
74 76
75 void SandboxedDMGAnalyzer::OnProcessLaunchFailed() { 77 void SandboxedDMGAnalyzer::OnProcessLaunchFailed() {
76 OnAnalysisFinished(zip_analyzer::Results()); 78 OnAnalysisFinished(zip_analyzer::Results());
77 } 79 }
78 80
79 bool SandboxedDMGAnalyzer::OnMessageReceived(const IPC::Message& message) { 81 bool SandboxedDMGAnalyzer::OnMessageReceived(const IPC::Message& message) {
80 bool handled = true; 82 bool handled = true;
81 IPC_BEGIN_MESSAGE_MAP(SandboxedDMGAnalyzer, message) 83 IPC_BEGIN_MESSAGE_MAP(SandboxedDMGAnalyzer, message)
82 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ProcessStarted,
83 OnUtilityProcessStarted)
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() {
93 DCHECK_CURRENTLY_ON(BrowserThread::IO);
94 utility_process_host_->Send(
95 new ChromeUtilityMsg_AnalyzeDmgFileForDownloadProtection(
96 IPC::TakePlatformFileForTransit(std::move(file_))));
97 }
98
99 void SandboxedDMGAnalyzer::OnAnalysisFinished( 92 void SandboxedDMGAnalyzer::OnAnalysisFinished(
100 const zip_analyzer::Results& results) { 93 const zip_analyzer::Results& results) {
101 DCHECK_CURRENTLY_ON(BrowserThread::IO); 94 DCHECK_CURRENTLY_ON(BrowserThread::IO);
102 if (callback_called_) 95 if (callback_called_)
103 return; 96 return;
104 97
105 callback_called_ = true; 98 callback_called_ = true;
106 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 99 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
107 base::Bind(callback_, results)); 100 base::Bind(callback_, results));
108 } 101 }
109 102
110 } // namespace safe_browsing 103 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698