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 "content/public/browser/browser_thread.h" | |
15 #include "content/public/browser/utility_process_host_client.h" | 14 #include "content/public/browser/utility_process_host_client.h" |
16 | 15 |
17 namespace base { | 16 namespace base { |
18 class DictionaryValue; | 17 class DictionaryValue; |
19 class SequencedTaskRunner; | 18 class SequencedTaskRunner; |
20 } | 19 } |
21 | 20 |
22 namespace extensions { | 21 namespace extensions { |
23 | 22 |
24 class SandboxedUnpackerClient | 23 class SandboxedUnpackerClient |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // This class is ref-counted by each call it makes to itself on another thread, | 61 // This class is ref-counted by each call it makes to itself on another thread, |
63 // and by UtilityProcessHost. | 62 // and by UtilityProcessHost. |
64 // | 63 // |
65 // Additionally, we hold a reference to our own client so that it lives at least | 64 // Additionally, we hold a reference to our own client so that it lives at least |
66 // long enough to receive the result of unpacking. | 65 // long enough to receive the result of unpacking. |
67 // | 66 // |
68 // | 67 // |
69 // NOTE: This class should only be used on the file thread. | 68 // NOTE: This class should only be used on the file thread. |
70 class SandboxedUnpacker : public content::UtilityProcessHostClient { | 69 class SandboxedUnpacker : public content::UtilityProcessHostClient { |
71 public: | 70 public: |
72 | |
73 // Unpacks the extension in |crx_path| into a temporary directory and calls | 71 // 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 | 72 // |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. | 73 // is done in a sandboxed subprocess. Otherwise, it is done in-process. |
76 SandboxedUnpacker(const FilePath& crx_path, | 74 SandboxedUnpacker(const FilePath& crx_path, |
77 bool run_out_of_process, | 75 bool run_out_of_process, |
78 Extension::Location location, | 76 Extension::Location location, |
79 int creation_flags, | 77 int creation_flags, |
80 const FilePath& extensions_dir, | 78 const FilePath& extensions_dir, |
81 base::SequencedTaskRunner* unpacker_io_task_runner, | 79 base::SequencedTaskRunner* unpacker_io_task_runner, |
82 SandboxedUnpackerClient* client); | 80 SandboxedUnpackerClient* client); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // when calling Extenion::Create() by the crx installer. | 231 // when calling Extenion::Create() by the crx installer. |
234 int creation_flags_; | 232 int creation_flags_; |
235 | 233 |
236 // Sequenced task runner where file I/O operations will be performed at. | 234 // Sequenced task runner where file I/O operations will be performed at. |
237 scoped_refptr<base::SequencedTaskRunner> unpacker_io_task_runner_; | 235 scoped_refptr<base::SequencedTaskRunner> unpacker_io_task_runner_; |
238 }; | 236 }; |
239 | 237 |
240 } // namespace extensions | 238 } // namespace extensions |
241 | 239 |
242 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ | 240 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ |
OLD | NEW |