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/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
| 14 #include "chrome/common/extensions/manifest.h" |
14 #include "content/public/browser/utility_process_host_client.h" | 15 #include "content/public/browser/utility_process_host_client.h" |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class DictionaryValue; | 18 class DictionaryValue; |
18 class SequencedTaskRunner; | 19 class SequencedTaskRunner; |
19 } | 20 } |
20 | 21 |
21 namespace extensions { | 22 namespace extensions { |
22 | 23 |
23 class SandboxedUnpackerClient | 24 class SandboxedUnpackerClient |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // | 67 // |
67 // | 68 // |
68 // NOTE: This class should only be used on the file thread. | 69 // NOTE: This class should only be used on the file thread. |
69 class SandboxedUnpacker : public content::UtilityProcessHostClient { | 70 class SandboxedUnpacker : public content::UtilityProcessHostClient { |
70 public: | 71 public: |
71 // Unpacks the extension in |crx_path| into a temporary directory and calls | 72 // Unpacks the extension in |crx_path| into a temporary directory and calls |
72 // |client| with the result. If |run_out_of_process| is provided, unpacking | 73 // |client| with the result. If |run_out_of_process| is provided, unpacking |
73 // is done in a sandboxed subprocess. Otherwise, it is done in-process. | 74 // is done in a sandboxed subprocess. Otherwise, it is done in-process. |
74 SandboxedUnpacker(const FilePath& crx_path, | 75 SandboxedUnpacker(const FilePath& crx_path, |
75 bool run_out_of_process, | 76 bool run_out_of_process, |
76 Extension::Location location, | 77 Manifest::Location location, |
77 int creation_flags, | 78 int creation_flags, |
78 const FilePath& extensions_dir, | 79 const FilePath& extensions_dir, |
79 base::SequencedTaskRunner* unpacker_io_task_runner, | 80 base::SequencedTaskRunner* unpacker_io_task_runner, |
80 SandboxedUnpackerClient* client); | 81 SandboxedUnpackerClient* client); |
81 | 82 |
82 // Start unpacking the extension. The client is called with the results. | 83 // Start unpacking the extension. The client is called with the results. |
83 void Start(); | 84 void Start(); |
84 | 85 |
85 private: | 86 private: |
86 class ProcessHostClient; | 87 class ProcessHostClient; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 std::string public_key_; | 219 std::string public_key_; |
219 | 220 |
220 // The extension's ID. This will be calculated from the public key in the crx | 221 // The extension's ID. This will be calculated from the public key in the crx |
221 // header. | 222 // header. |
222 std::string extension_id_; | 223 std::string extension_id_; |
223 | 224 |
224 // Time at which unpacking started. Used to compute the time unpacking takes. | 225 // Time at which unpacking started. Used to compute the time unpacking takes. |
225 base::TimeTicks unpack_start_time_; | 226 base::TimeTicks unpack_start_time_; |
226 | 227 |
227 // Location to use for the unpacked extension. | 228 // Location to use for the unpacked extension. |
228 Extension::Location location_; | 229 Manifest::Location location_; |
229 | 230 |
230 // Creation flags to use for the extension. These flags will be used | 231 // Creation flags to use for the extension. These flags will be used |
231 // when calling Extenion::Create() by the crx installer. | 232 // when calling Extenion::Create() by the crx installer. |
232 int creation_flags_; | 233 int creation_flags_; |
233 | 234 |
234 // Sequenced task runner where file I/O operations will be performed at. | 235 // Sequenced task runner where file I/O operations will be performed at. |
235 scoped_refptr<base::SequencedTaskRunner> unpacker_io_task_runner_; | 236 scoped_refptr<base::SequencedTaskRunner> unpacker_io_task_runner_; |
236 }; | 237 }; |
237 | 238 |
238 } // namespace extensions | 239 } // namespace extensions |
239 | 240 |
240 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ | 241 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ |
OLD | NEW |