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" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // | 66 // |
67 // | 67 // |
68 // NOTE: This class should only be used on the file thread. | 68 // NOTE: This class should only be used on the file thread. |
69 class SandboxedUnpacker : public content::UtilityProcessHostClient { | 69 class SandboxedUnpacker : public content::UtilityProcessHostClient { |
70 public: | 70 public: |
71 | 71 |
72 // 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 |
73 // |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 |
74 // 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. |
75 SandboxedUnpacker(const FilePath& crx_path, | 75 SandboxedUnpacker(const FilePath& crx_path, |
76 bool run_out_of_process, | 76 bool run_out_of_process, |
77 Extension::Location location, | 77 Extension::Location location, |
78 int creation_flags, | 78 int creation_flags, |
79 SandboxedUnpackerClient* client); | 79 const FilePath& extensions_dir, |
| 80 SandboxedUnpackerClient* client); |
80 | 81 |
81 // Start unpacking the extension. The client is called with the results. | 82 // Start unpacking the extension. The client is called with the results. |
82 void Start(); | 83 void Start(); |
83 | 84 |
84 private: | 85 private: |
85 class ProcessHostClient; | 86 class ProcessHostClient; |
86 | 87 |
87 // Enumerate all the ways unpacking can fail. Calls to ReportFailure() | 88 // Enumerate all the ways unpacking can fail. Calls to ReportFailure() |
88 // take a failure reason as an argument, and put it in histogram | 89 // take a failure reason as an argument, and put it in histogram |
89 // Extensions.SandboxUnpackFailureReason. | 90 // Extensions.SandboxUnpackFailureReason. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 192 |
192 // Our client's thread. This is the thread we respond on. | 193 // Our client's thread. This is the thread we respond on. |
193 content::BrowserThread::ID thread_identifier_; | 194 content::BrowserThread::ID thread_identifier_; |
194 | 195 |
195 // True if unpacking should be done by the utility process. | 196 // True if unpacking should be done by the utility process. |
196 bool run_out_of_process_; | 197 bool run_out_of_process_; |
197 | 198 |
198 // Our client. | 199 // Our client. |
199 scoped_refptr<SandboxedUnpackerClient> client_; | 200 scoped_refptr<SandboxedUnpackerClient> client_; |
200 | 201 |
| 202 // The Extensions directory inside the profile. |
| 203 FilePath extensions_dir_; |
| 204 |
201 // A temporary directory to use for unpacking. | 205 // A temporary directory to use for unpacking. |
202 ScopedTempDir temp_dir_; | 206 ScopedTempDir temp_dir_; |
203 | 207 |
204 // The root directory of the unpacked extension. This is a child of temp_dir_. | 208 // The root directory of the unpacked extension. This is a child of temp_dir_. |
205 FilePath extension_root_; | 209 FilePath extension_root_; |
206 | 210 |
207 // Represents the extension we're unpacking. | 211 // Represents the extension we're unpacking. |
208 scoped_refptr<Extension> extension_; | 212 scoped_refptr<Extension> extension_; |
209 | 213 |
210 // Whether we've received a response from the utility process yet. | 214 // Whether we've received a response from the utility process yet. |
(...skipping 13 matching lines...) Expand all Loading... |
224 Extension::Location location_; | 228 Extension::Location location_; |
225 | 229 |
226 // Creation flags to use for the extension. These flags will be used | 230 // Creation flags to use for the extension. These flags will be used |
227 // when calling Extenion::Create() by the crx installer. | 231 // when calling Extenion::Create() by the crx installer. |
228 int creation_flags_; | 232 int creation_flags_; |
229 }; | 233 }; |
230 | 234 |
231 } // namespace extensions | 235 } // namespace extensions |
232 | 236 |
233 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ | 237 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_UNPACKER_H_ |
OLD | NEW |