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

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

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 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 #ifndef CHROME_BROWSER_SAFE_BROWSING_SANDBOXED_DMG_ANALYZER_MAC_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SANDBOXED_DMG_ANALYZER_MAC_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_SANDBOXED_DMG_ANALYZER_MAC_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_SANDBOXED_DMG_ANALYZER_MAC_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "chrome/common/safe_archive_analyzer.mojom.h" 13 #include "chrome/common/safe_archive_analyzer.mojom.h"
14 #include "content/public/browser/utility_process_mojo_client.h" 14 #include "content/public/browser/utility_process_mojo_client.h"
15 15
16 namespace safe_browsing { 16 namespace safe_browsing {
17 17
18 // This class is used to analyze DMG files in a sandboxed utility process 18 // This class is used to analyze DMG files in a sandboxed utility process
19 // for file download protection. This class lives on the UI thread, which 19 // for file download protection. This class lives on the UI thread, which
20 // is where the result callback will be invoked. 20 // is where the result callback will be invoked.
21 class SandboxedDMGAnalyzer 21 class SandboxedDMGAnalyzer
22 : public base::RefCountedThreadSafe<SandboxedDMGAnalyzer> { 22 : public base::RefCountedThreadSafe<SandboxedDMGAnalyzer> {
23 public: 23 public:
24 using Results = zip_analyzer::Results; 24 using ResultCallback = base::Callback<void(const ArchiveAnalyzerResults&)>;
25
26 using ResultCallback = base::Callback<void(const Results&)>;
27 25
28 SandboxedDMGAnalyzer(const base::FilePath& dmg_file, 26 SandboxedDMGAnalyzer(const base::FilePath& dmg_file,
29 const ResultCallback& callback); 27 const ResultCallback& callback);
30 28
31 // Starts the analysis. Must be called on the UI thread. 29 // Starts the analysis. Must be called on the UI thread.
32 void Start(); 30 void Start();
33 31
34 private: 32 private:
35 friend class base::RefCountedThreadSafe<SandboxedDMGAnalyzer>; 33 friend class base::RefCountedThreadSafe<SandboxedDMGAnalyzer>;
36 34
37 ~SandboxedDMGAnalyzer(); 35 ~SandboxedDMGAnalyzer();
38 36
39 // Prepare the file for analysis. 37 // Prepare the file for analysis.
40 void PrepareFileToAnalyze(); 38 void PrepareFileToAnalyze();
41 39
42 // If file preparation failed, analysis has failed: report failure. 40 // If file preparation failed, analysis has failed: report failure.
43 void ReportFileFailure(); 41 void ReportFileFailure();
44 42
45 // Starts the utility process and sends it a file analyze request. 43 // Starts the utility process and sends it a file analyze request.
46 void AnalyzeFile(base::File file); 44 void AnalyzeFile(base::File file);
47 45
48 // The response containing the file analyze results. 46 // The response containing the file analyze results.
49 void AnalyzeFileDone(const Results& results); 47 void AnalyzeFileDone(const ArchiveAnalyzerResults& results);
50 48
51 // The file path of the file to analyze. 49 // The file path of the file to analyze.
52 const base::FilePath file_path_; 50 const base::FilePath file_path_;
53 51
54 // Utility client used to send analyze tasks to the utility process. 52 // Utility client used to send analyze tasks to the utility process.
55 std::unique_ptr< 53 std::unique_ptr<
56 content::UtilityProcessMojoClient<chrome::mojom::SafeArchiveAnalyzer>> 54 content::UtilityProcessMojoClient<chrome::mojom::SafeArchiveAnalyzer>>
57 utility_process_mojo_client_; 55 utility_process_mojo_client_;
58 56
59 // Callback invoked on the UI thread with the file analyze results. 57 // Callback invoked on the UI thread with the file analyze results.
60 const ResultCallback callback_; 58 const ResultCallback callback_;
61 59
62 DISALLOW_COPY_AND_ASSIGN(SandboxedDMGAnalyzer); 60 DISALLOW_COPY_AND_ASSIGN(SandboxedDMGAnalyzer);
63 }; 61 };
64 62
65 } // namespace safe_browsing 63 } // namespace safe_browsing
66 64
67 #endif // CHROME_BROWSER_SAFE_BROWSING_SANDBOXED_DMG_ANALYZER_MAC_H_ 65 #endif // CHROME_BROWSER_SAFE_BROWSING_SANDBOXED_DMG_ANALYZER_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698