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

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

Issue 999003003: Include attributes of zipped binaries in ClientDownloadRequests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@zip2
Patch Set: fix ordering of SandboxedZipAnalyzer methods Created 5 years, 9 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 // Browser-side interface to analyze zip files for SafeBrowsing download 5 // Browser-side interface to analyze zip files for SafeBrowsing download
6 // protection. The actual zip decoding is performed in a sandboxed utility 6 // protection. The actual zip decoding is performed in a sandboxed utility
7 // process. 7 // process.
8 // 8 //
9 // This class lives on the UI thread. 9 // This class lives on the UI thread.
10 10
(...skipping 24 matching lines...) Expand all
35 35
36 SandboxedZipAnalyzer(const base::FilePath& zip_file, 36 SandboxedZipAnalyzer(const base::FilePath& zip_file,
37 const ResultCallback& result_callback); 37 const ResultCallback& result_callback);
38 38
39 // Posts a task to start the zip analysis in the utility process. 39 // Posts a task to start the zip analysis in the utility process.
40 void Start(); 40 void Start();
41 41
42 private: 42 private:
43 ~SandboxedZipAnalyzer() override; 43 ~SandboxedZipAnalyzer() override;
44 44
45 // Posts a fire-and-forget task to close the temporary file in the blocking
46 // pool.
47 void CloseTemporaryFile();
48
45 // Creates the sandboxed utility process and tells it to start analysis. 49 // Creates the sandboxed utility process and tells it to start analysis.
46 // Runs on a worker thread. 50 // Runs on a worker thread.
47 void AnalyzeInSandbox(); 51 void AnalyzeInSandbox();
48 52
49 // content::UtilityProcessHostClient implementation. 53 // content::UtilityProcessHostClient implementation.
50 // These notifications run on the IO thread. 54 // These notifications run on the IO thread.
51 bool OnMessageReceived(const IPC::Message& message) override; 55 bool OnMessageReceived(const IPC::Message& message) override;
52 56
57 // Launches the utility process. Must run on the IO thread.
58 void StartProcessOnIOThread();
59
53 // Notification that the utility process is running, and we can now get its 60 // Notification that the utility process is running, and we can now get its
54 // process handle. 61 // process handle.
55 void OnUtilityProcessStarted(); 62 void OnUtilityProcessStarted();
56 63
57 // Notification from the utility process that the zip file has been analyzed, 64 // Notification from the utility process that the zip file has been analyzed,
58 // with the given results. Runs on the IO thread. 65 // with the given results. Runs on the IO thread.
59 void OnAnalyzeZipFileFinished(const zip_analyzer::Results& results); 66 void OnAnalyzeZipFileFinished(const zip_analyzer::Results& results);
60 67
61 // Launches the utility process. Must run on the IO thread.
62 void StartProcessOnIOThread();
63
64 const base::FilePath zip_file_name_; 68 const base::FilePath zip_file_name_;
65 // Once we have opened the file, we store the handle so that we can use it 69 // Once we have opened the file, we store the handle so that we can use it
66 // once the utility process has launched. 70 // once the utility process has launched.
67 base::File zip_file_; 71 base::File zip_file_;
72
73 // A temporary file to be used by the utility process for extracting files
74 // from the archive.
75 base::File temp_file_;
68 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; 76 base::WeakPtr<content::UtilityProcessHost> utility_process_host_;
69 const ResultCallback callback_; 77 const ResultCallback callback_;
70 // Initialized on the UI thread, but only accessed on the IO thread. 78 // Initialized on the UI thread, but only accessed on the IO thread.
71 bool callback_called_; 79 bool callback_called_;
72 80
73 DISALLOW_COPY_AND_ASSIGN(SandboxedZipAnalyzer); 81 DISALLOW_COPY_AND_ASSIGN(SandboxedZipAnalyzer);
74 }; 82 };
75 83
76 } // namespace safe_browsing 84 } // namespace safe_browsing
77 85
78 #endif // CHROME_BROWSER_SAFE_BROWSING_SANDBOXED_ZIP_ANALYZER_H_ 86 #endif // CHROME_BROWSER_SAFE_BROWSING_SANDBOXED_ZIP_ANALYZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698