OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // pool. | 46 // pool. |
47 void CloseTemporaryFile(); | 47 void CloseTemporaryFile(); |
48 | 48 |
49 // Creates the sandboxed utility process and tells it to start analysis. | 49 // Creates the sandboxed utility process and tells it to start analysis. |
50 // Runs on a worker thread. | 50 // Runs on a worker thread. |
51 void AnalyzeInSandbox(); | 51 void AnalyzeInSandbox(); |
52 | 52 |
53 // content::UtilityProcessHostClient implementation. | 53 // content::UtilityProcessHostClient implementation. |
54 // These notifications run on the IO thread. | 54 // These notifications run on the IO thread. |
55 void OnProcessCrashed(int exit_code) override; | 55 void OnProcessCrashed(int exit_code) override; |
56 void OnProcessLaunchFailed() override; | 56 void OnProcessLaunchFailed(int error_code) override; |
57 bool OnMessageReceived(const IPC::Message& message) override; | 57 bool OnMessageReceived(const IPC::Message& message) override; |
58 | 58 |
59 // Launches the utility process. Must run on the IO thread. | 59 // Launches the utility process. Must run on the IO thread. |
60 void StartProcessOnIOThread(); | 60 void StartProcessOnIOThread(); |
61 | 61 |
62 // Notification from the utility process that the zip file has been analyzed, | 62 // Notification from the utility process that the zip file has been analyzed, |
63 // with the given results. Runs on the IO thread. | 63 // with the given results. Runs on the IO thread. |
64 void OnAnalyzeZipFileFinished(const zip_analyzer::Results& results); | 64 void OnAnalyzeZipFileFinished(const zip_analyzer::Results& results); |
65 | 65 |
66 const base::FilePath zip_file_name_; | 66 const base::FilePath zip_file_name_; |
67 // Once we have opened the file, we store the handle so that we can use it | 67 // Once we have opened the file, we store the handle so that we can use it |
68 // once the utility process has launched. | 68 // once the utility process has launched. |
69 base::File zip_file_; | 69 base::File zip_file_; |
70 | 70 |
71 // A temporary file to be used by the utility process for extracting files | 71 // A temporary file to be used by the utility process for extracting files |
72 // from the archive. | 72 // from the archive. |
73 base::File temp_file_; | 73 base::File temp_file_; |
74 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; | 74 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; |
75 const ResultCallback callback_; | 75 const ResultCallback callback_; |
76 // Initialized on the UI thread, but only accessed on the IO thread. | 76 // Initialized on the UI thread, but only accessed on the IO thread. |
77 bool callback_called_; | 77 bool callback_called_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(SandboxedZipAnalyzer); | 79 DISALLOW_COPY_AND_ASSIGN(SandboxedZipAnalyzer); |
80 }; | 80 }; |
81 | 81 |
82 } // namespace safe_browsing | 82 } // namespace safe_browsing |
83 | 83 |
84 #endif // CHROME_BROWSER_SAFE_BROWSING_SANDBOXED_ZIP_ANALYZER_H_ | 84 #endif // CHROME_BROWSER_SAFE_BROWSING_SANDBOXED_ZIP_ANALYZER_H_ |
OLD | NEW |