| 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 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // | 31 // |
| 32 // original_manifest - The parsed but unmodified version of the manifest, | 32 // original_manifest - The parsed but unmodified version of the manifest, |
| 33 // with no modifications such as localization, etc. | 33 // with no modifications such as localization, etc. |
| 34 // | 34 // |
| 35 // extension - The extension that was unpacked. The client is responsible | 35 // extension - The extension that was unpacked. The client is responsible |
| 36 // for deleting this memory. | 36 // for deleting this memory. |
| 37 virtual void OnUnpackSuccess(const FilePath& temp_dir, | 37 virtual void OnUnpackSuccess(const FilePath& temp_dir, |
| 38 const FilePath& extension_root, | 38 const FilePath& extension_root, |
| 39 const base::DictionaryValue* original_manifest, | 39 const base::DictionaryValue* original_manifest, |
| 40 const Extension* extension) = 0; | 40 const Extension* extension) = 0; |
| 41 virtual void OnUnpackFailure(const std::string& error) = 0; | 41 virtual void OnUnpackFailure(const string16& error) = 0; |
| 42 | 42 |
| 43 protected: | 43 protected: |
| 44 friend class base::RefCountedThreadSafe<SandboxedExtensionUnpackerClient>; | 44 friend class base::RefCountedThreadSafe<SandboxedExtensionUnpackerClient>; |
| 45 | 45 |
| 46 virtual ~SandboxedExtensionUnpackerClient() {} | 46 virtual ~SandboxedExtensionUnpackerClient() {} |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // SandboxedExtensionUnpacker unpacks extensions from the CRX format into a | 49 // SandboxedExtensionUnpacker unpacks extensions from the CRX format into a |
| 50 // directory. This is done in a sandboxed subprocess to protect the browser | 50 // directory. This is done in a sandboxed subprocess to protect the browser |
| 51 // process from parsing complex formats like JPEG or JSON from untrusted | 51 // process from parsing complex formats like JPEG or JSON from untrusted |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 // Starts the utility process that unpacks our extension. | 193 // Starts the utility process that unpacks our extension. |
| 194 void StartProcessOnIOThread(const FilePath& temp_crx_path); | 194 void StartProcessOnIOThread(const FilePath& temp_crx_path); |
| 195 | 195 |
| 196 // UtilityProcessHost::Client | 196 // UtilityProcessHost::Client |
| 197 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 197 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 198 virtual void OnProcessCrashed(int exit_code) OVERRIDE; | 198 virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
| 199 | 199 |
| 200 // IPC message handlers. | 200 // IPC message handlers. |
| 201 void OnUnpackExtensionSucceeded(const base::DictionaryValue& manifest); | 201 void OnUnpackExtensionSucceeded(const base::DictionaryValue& manifest); |
| 202 void OnUnpackExtensionFailed(const std::string& error_message); | 202 void OnUnpackExtensionFailed(const string16& error_message); |
| 203 | 203 |
| 204 void ReportFailure(FailureReason reason, const std::string& message); | 204 void ReportFailure(FailureReason reason, const string16& message); |
| 205 void ReportSuccess(const base::DictionaryValue& original_manifest); | 205 void ReportSuccess(const base::DictionaryValue& original_manifest); |
| 206 | 206 |
| 207 // Overwrites original manifest with safe result from utility process. | 207 // Overwrites original manifest with safe result from utility process. |
| 208 // Returns NULL on error. Caller owns the returned object. | 208 // Returns NULL on error. Caller owns the returned object. |
| 209 base::DictionaryValue* RewriteManifestFile( | 209 base::DictionaryValue* RewriteManifestFile( |
| 210 const base::DictionaryValue& manifest); | 210 const base::DictionaryValue& manifest); |
| 211 | 211 |
| 212 // Overwrites original files with safe results from utility process. | 212 // Overwrites original files with safe results from utility process. |
| 213 // Reports error and returns false if it fails. | 213 // Reports error and returns false if it fails. |
| 214 bool RewriteImageFiles(); | 214 bool RewriteImageFiles(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 // Location to use for the unpacked extension. | 247 // Location to use for the unpacked extension. |
| 248 Extension::Location location_; | 248 Extension::Location location_; |
| 249 | 249 |
| 250 // 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 |
| 251 // when calling Extenion::Create() by the crx installer. | 251 // when calling Extenion::Create() by the crx installer. |
| 252 int creation_flags_; | 252 int creation_flags_; |
| 253 }; | 253 }; |
| 254 | 254 |
| 255 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_ | 255 #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_ |
| OLD | NEW |