| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() 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 that the utility process is running, and we can now get its | |
| 63 // process handle. | |
| 64 void OnUtilityProcessStarted(); | |
| 65 | |
| 66 // 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, |
| 67 // with the given results. Runs on the IO thread. | 63 // with the given results. Runs on the IO thread. |
| 68 void OnAnalyzeZipFileFinished(const zip_analyzer::Results& results); | 64 void OnAnalyzeZipFileFinished(const zip_analyzer::Results& results); |
| 69 | 65 |
| 70 const base::FilePath zip_file_name_; | 66 const base::FilePath zip_file_name_; |
| 71 // 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 |
| 72 // once the utility process has launched. | 68 // once the utility process has launched. |
| 73 base::File zip_file_; | 69 base::File zip_file_; |
| 74 | 70 |
| 75 // 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 |
| 76 // from the archive. | 72 // from the archive. |
| 77 base::File temp_file_; | 73 base::File temp_file_; |
| 78 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; | 74 base::WeakPtr<content::UtilityProcessHost> utility_process_host_; |
| 79 const ResultCallback callback_; | 75 const ResultCallback callback_; |
| 80 // 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. |
| 81 bool callback_called_; | 77 bool callback_called_; |
| 82 | 78 |
| 83 DISALLOW_COPY_AND_ASSIGN(SandboxedZipAnalyzer); | 79 DISALLOW_COPY_AND_ASSIGN(SandboxedZipAnalyzer); |
| 84 }; | 80 }; |
| 85 | 81 |
| 86 } // namespace safe_browsing | 82 } // namespace safe_browsing |
| 87 | 83 |
| 88 #endif // CHROME_BROWSER_SAFE_BROWSING_SANDBOXED_ZIP_ANALYZER_H_ | 84 #endif // CHROME_BROWSER_SAFE_BROWSING_SANDBOXED_ZIP_ANALYZER_H_ |
| OLD | NEW |