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 #ifndef CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // long enough to receive the result of unpacking. | 67 // long enough to receive the result of unpacking. |
68 // | 68 // |
69 // | 69 // |
70 // NOTE: This class should only be used on the file thread. | 70 // NOTE: This class should only be used on the file thread. |
71 class SandboxedUnpacker : public content::UtilityProcessHostClient { | 71 class SandboxedUnpacker : public content::UtilityProcessHostClient { |
72 public: | 72 public: |
73 // Unpacks the extension in |crx_path| into a temporary directory and calls | 73 // Unpacks the extension in |crx_path| into a temporary directory and calls |
74 // |client| with the result. If |run_out_of_process| is provided, unpacking | 74 // |client| with the result. If |run_out_of_process| is provided, unpacking |
75 // is done in a sandboxed subprocess. Otherwise, it is done in-process. | 75 // is done in a sandboxed subprocess. Otherwise, it is done in-process. |
76 SandboxedUnpacker(const base::FilePath& crx_path, | 76 SandboxedUnpacker(const base::FilePath& crx_path, |
77 bool run_out_of_process, | |
78 Manifest::Location location, | 77 Manifest::Location location, |
79 int creation_flags, | 78 int creation_flags, |
80 const base::FilePath& extensions_dir, | 79 const base::FilePath& extensions_dir, |
81 base::SequencedTaskRunner* unpacker_io_task_runner, | 80 base::SequencedTaskRunner* unpacker_io_task_runner, |
82 SandboxedUnpackerClient* client); | 81 SandboxedUnpackerClient* client); |
83 | 82 |
84 // Start unpacking the extension. The client is called with the results. | 83 // Start unpacking the extension. The client is called with the results. |
85 void Start(); | 84 void Start(); |
86 | 85 |
87 private: | 86 private: |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // Reports error and returns false if it fails. | 187 // Reports error and returns false if it fails. |
189 bool RewriteImageFiles(); | 188 bool RewriteImageFiles(); |
190 bool RewriteCatalogFiles(); | 189 bool RewriteCatalogFiles(); |
191 | 190 |
192 // Cleans up temp directory artifacts. | 191 // Cleans up temp directory artifacts. |
193 void Cleanup(); | 192 void Cleanup(); |
194 | 193 |
195 // The path to the CRX to unpack. | 194 // The path to the CRX to unpack. |
196 base::FilePath crx_path_; | 195 base::FilePath crx_path_; |
197 | 196 |
198 // True if unpacking should be done by the utility process. | |
199 bool run_out_of_process_; | |
200 | |
201 // Our client. | 197 // Our client. |
202 scoped_refptr<SandboxedUnpackerClient> client_; | 198 scoped_refptr<SandboxedUnpackerClient> client_; |
203 | 199 |
204 // The Extensions directory inside the profile. | 200 // The Extensions directory inside the profile. |
205 base::FilePath extensions_dir_; | 201 base::FilePath extensions_dir_; |
206 | 202 |
207 // A temporary directory to use for unpacking. | 203 // A temporary directory to use for unpacking. |
208 base::ScopedTempDir temp_dir_; | 204 base::ScopedTempDir temp_dir_; |
209 | 205 |
210 // The root directory of the unpacked extension. This is a child of temp_dir_. | 206 // The root directory of the unpacked extension. This is a child of temp_dir_. |
(...skipping 22 matching lines...) Expand all Loading... |
233 // when calling Extenion::Create() by the crx installer. | 229 // when calling Extenion::Create() by the crx installer. |
234 int creation_flags_; | 230 int creation_flags_; |
235 | 231 |
236 // Sequenced task runner where file I/O operations will be performed at. | 232 // Sequenced task runner where file I/O operations will be performed at. |
237 scoped_refptr<base::SequencedTaskRunner> unpacker_io_task_runner_; | 233 scoped_refptr<base::SequencedTaskRunner> unpacker_io_task_runner_; |
238 }; | 234 }; |
239 | 235 |
240 } // namespace extensions | 236 } // namespace extensions |
241 | 237 |
242 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ | 238 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ |
OLD | NEW |