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

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

Issue 2900803002: Renaming zip_analyzer_results to archive_analyzer_results (Closed)
Patch Set: minor fixups Created 3 years, 7 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 (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/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/task_scheduler/post_task.h" 11 #include "base/task_scheduler/post_task.h"
12 #include "chrome/common/safe_browsing/zip_analyzer_results.h" 12 #include "chrome/common/safe_browsing/archive_analyzer_results.h"
13 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 16
17 namespace safe_browsing { 17 namespace safe_browsing {
18 18
19 SandboxedZipAnalyzer::SandboxedZipAnalyzer(const base::FilePath& zip_file, 19 SandboxedZipAnalyzer::SandboxedZipAnalyzer(const base::FilePath& zip_file,
20 const ResultCallback& callback) 20 const ResultCallback& callback)
21 : file_path_(zip_file), callback_(callback) { 21 : file_path_(zip_file), callback_(callback) {
22 DCHECK(callback); 22 DCHECK(callback);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 content::BrowserThread::PostTask( 61 content::BrowserThread::PostTask(
62 content::BrowserThread::UI, FROM_HERE, 62 content::BrowserThread::UI, FROM_HERE,
63 base::BindOnce(&SandboxedZipAnalyzer::AnalyzeFile, this, 63 base::BindOnce(&SandboxedZipAnalyzer::AnalyzeFile, this,
64 base::Passed(&file), base::Passed(&temp_file))); 64 base::Passed(&file), base::Passed(&temp_file)));
65 } 65 }
66 66
67 void SandboxedZipAnalyzer::ReportFileFailure() { 67 void SandboxedZipAnalyzer::ReportFileFailure() {
68 DCHECK(!utility_process_mojo_client_); 68 DCHECK(!utility_process_mojo_client_);
69 69
70 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 70 content::BrowserThread::PostTask(
71 base::BindOnce(callback_, Results())); 71 content::BrowserThread::UI, FROM_HERE,
72 base::BindOnce(callback_, ArchiveAnalyzerResults()));
72 } 73 }
73 74
74 void SandboxedZipAnalyzer::AnalyzeFile(base::File file, base::File temp_file) { 75 void SandboxedZipAnalyzer::AnalyzeFile(base::File file, base::File temp_file) {
75 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 76 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
76 DCHECK(!utility_process_mojo_client_); 77 DCHECK(!utility_process_mojo_client_);
77 78
78 utility_process_mojo_client_ = base::MakeUnique< 79 utility_process_mojo_client_ = base::MakeUnique<
79 content::UtilityProcessMojoClient<chrome::mojom::SafeArchiveAnalyzer>>( 80 content::UtilityProcessMojoClient<chrome::mojom::SafeArchiveAnalyzer>>(
80 l10n_util::GetStringUTF16( 81 l10n_util::GetStringUTF16(
81 IDS_UTILITY_PROCESS_SAFE_BROWSING_ZIP_FILE_ANALYZER_NAME)); 82 IDS_UTILITY_PROCESS_SAFE_BROWSING_ZIP_FILE_ANALYZER_NAME));
82 utility_process_mojo_client_->set_error_callback( 83 utility_process_mojo_client_->set_error_callback(base::Bind(
83 base::Bind(&SandboxedZipAnalyzer::AnalyzeFileDone, this, Results())); 84 &SandboxedZipAnalyzer::AnalyzeFileDone, this, ArchiveAnalyzerResults()));
84 85
85 utility_process_mojo_client_->Start(); 86 utility_process_mojo_client_->Start();
86 87
87 utility_process_mojo_client_->service()->AnalyzeZipFile( 88 utility_process_mojo_client_->service()->AnalyzeZipFile(
88 std::move(file), std::move(temp_file), 89 std::move(file), std::move(temp_file),
89 base::Bind(&SandboxedZipAnalyzer::AnalyzeFileDone, this)); 90 base::Bind(&SandboxedZipAnalyzer::AnalyzeFileDone, this));
90 } 91 }
91 92
92 void SandboxedZipAnalyzer::AnalyzeFileDone(const Results& results) { 93 void SandboxedZipAnalyzer::AnalyzeFileDone(
94 const ArchiveAnalyzerResults& results) {
93 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 95 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
94 96
95 utility_process_mojo_client_.reset(); 97 utility_process_mojo_client_.reset();
96 callback_.Run(results); 98 callback_.Run(results);
97 } 99 }
98 100
99 } // namespace safe_browsing 101 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/sandboxed_zip_analyzer.h ('k') | chrome/browser/safe_browsing/sandboxed_zip_analyzer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698