| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTENSION_UNPACKER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/scoped_temp_dir.h" | 13 #include "base/scoped_temp_dir.h" |
| 14 #include "chrome/common/extensions/extension.h" |
| 14 #include "content/browser/utility_process_host.h" | 15 #include "content/browser/utility_process_host.h" |
| 15 | 16 |
| 16 class Extension; | 17 class Extension; |
| 17 class ResourceDispatcherHost; | 18 class ResourceDispatcherHost; |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class DictionaryValue; | 21 class DictionaryValue; |
| 21 } | 22 } |
| 22 | 23 |
| 23 class SandboxedExtensionUnpackerClient | 24 class SandboxedExtensionUnpackerClient |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 static const char kExtensionHeaderMagic[]; | 95 static const char kExtensionHeaderMagic[]; |
| 95 | 96 |
| 96 // The current version of the crx format. | 97 // The current version of the crx format. |
| 97 static const uint32 kCurrentVersion = 2; | 98 static const uint32 kCurrentVersion = 2; |
| 98 | 99 |
| 99 // Unpacks the extension in |crx_path| into a temporary directory and calls | 100 // Unpacks the extension in |crx_path| into a temporary directory and calls |
| 100 // |client| with the result. If |rdh| is provided, unpacking is done in a | 101 // |client| with the result. If |rdh| is provided, unpacking is done in a |
| 101 // sandboxed subprocess. Otherwise, it is done in-process. | 102 // sandboxed subprocess. Otherwise, it is done in-process. |
| 102 SandboxedExtensionUnpacker(const FilePath& crx_path, | 103 SandboxedExtensionUnpacker(const FilePath& crx_path, |
| 103 ResourceDispatcherHost* rdh, | 104 ResourceDispatcherHost* rdh, |
| 105 Extension::Location location, |
| 104 int creation_flags, | 106 int creation_flags, |
| 105 SandboxedExtensionUnpackerClient* client); | 107 SandboxedExtensionUnpackerClient* client); |
| 106 | 108 |
| 107 // Start unpacking the extension. The client is called with the results. | 109 // Start unpacking the extension. The client is called with the results. |
| 108 void Start(); | 110 void Start(); |
| 109 | 111 |
| 110 private: | 112 private: |
| 111 class ProcessHostClient; | 113 class ProcessHostClient; |
| 112 | 114 |
| 113 // Enumerate all the ways unpacking can fail. Calls to ReportFailure() | 115 // Enumerate all the ways unpacking can fail. Calls to ReportFailure() |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 237 |
| 236 // Whether we've received a response from the utility process yet. | 238 // Whether we've received a response from the utility process yet. |
| 237 bool got_response_; | 239 bool got_response_; |
| 238 | 240 |
| 239 // The public key that was extracted from the CRX header. | 241 // The public key that was extracted from the CRX header. |
| 240 std::string public_key_; | 242 std::string public_key_; |
| 241 | 243 |
| 242 // Time at which unpacking started. Used to compute the time unpacking takes. | 244 // Time at which unpacking started. Used to compute the time unpacking takes. |
| 243 base::TimeTicks unpack_start_time_; | 245 base::TimeTicks unpack_start_time_; |
| 244 | 246 |
| 247 // Location to use for the unpacked extension. |
| 248 Extension::Location location_; |
| 249 |
| 245 // Creation flags to use for the extension. These flags will be used | 250 // Creation flags to use for the extension. These flags will be used |
| 246 // when calling Extenion::Create() by the crx installer. | 251 // when calling Extenion::Create() by the crx installer. |
| 247 int creation_flags_; | 252 int creation_flags_; |
| 248 }; | 253 }; |
| 249 | 254 |
| 250 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_ | 255 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_ |
| OLD | NEW |