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_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ |
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 12 matching lines...) Expand all Loading... |
23 // This class unpacks an extension. It is designed to be used in a sandboxed | 23 // This class unpacks an extension. It is designed to be used in a sandboxed |
24 // child process. We unpack and parse various bits of the extension, then | 24 // child process. We unpack and parse various bits of the extension, then |
25 // report back to the browser process, who then transcodes the pre-parsed bits | 25 // report back to the browser process, who then transcodes the pre-parsed bits |
26 // and writes them back out to disk for later use. | 26 // and writes them back out to disk for later use. |
27 class ExtensionUnpacker { | 27 class ExtensionUnpacker { |
28 public: | 28 public: |
29 typedef std::vector< Tuple2<SkBitmap, FilePath> > DecodedImages; | 29 typedef std::vector< Tuple2<SkBitmap, FilePath> > DecodedImages; |
30 | 30 |
31 ExtensionUnpacker(const FilePath& extension_path, | 31 ExtensionUnpacker(const FilePath& extension_path, |
32 const std::string& extension_id, | 32 const std::string& extension_id, |
33 Extension::Location location, | 33 extensions::Extension::Location location, |
34 int creation_flags); | 34 int creation_flags); |
35 ~ExtensionUnpacker(); | 35 ~ExtensionUnpacker(); |
36 | 36 |
37 // Install the extension file at |extension_path|. Returns true on success. | 37 // Install the extension file at |extension_path|. Returns true on success. |
38 // Otherwise, error_message will contain a string explaining what went wrong. | 38 // Otherwise, error_message will contain a string explaining what went wrong. |
39 bool Run(); | 39 bool Run(); |
40 | 40 |
41 // Write the decoded images to kDecodedImagesFilename. We do this instead | 41 // Write the decoded images to kDecodedImagesFilename. We do this instead |
42 // of sending them over IPC, since they are so large. Returns true on | 42 // of sending them over IPC, since they are so large. Returns true on |
43 // success. | 43 // success. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Set the error message. | 86 // Set the error message. |
87 void SetError(const std::string& error); | 87 void SetError(const std::string& error); |
88 | 88 |
89 // The extension to unpack. | 89 // The extension to unpack. |
90 FilePath extension_path_; | 90 FilePath extension_path_; |
91 | 91 |
92 // The extension ID if known. | 92 // The extension ID if known. |
93 std::string extension_id_; | 93 std::string extension_id_; |
94 | 94 |
95 // The location to use for the created extension. | 95 // The location to use for the created extension. |
96 Extension::Location location_; | 96 extensions::Extension::Location location_; |
97 | 97 |
98 // The creation flags to use with the created extension. | 98 // The creation flags to use with the created extension. |
99 int creation_flags_; | 99 int creation_flags_; |
100 | 100 |
101 // The place we unpacked the extension to. | 101 // The place we unpacked the extension to. |
102 FilePath temp_install_dir_; | 102 FilePath temp_install_dir_; |
103 | 103 |
104 // The parsed version of the manifest JSON contained in the extension. | 104 // The parsed version of the manifest JSON contained in the extension. |
105 scoped_ptr<base::DictionaryValue> parsed_manifest_; | 105 scoped_ptr<base::DictionaryValue> parsed_manifest_; |
106 | 106 |
107 // A list of decoded images and the paths where those images came from. Paths | 107 // A list of decoded images and the paths where those images came from. Paths |
108 // are relative to the manifest file. | 108 // are relative to the manifest file. |
109 DecodedImages decoded_images_; | 109 DecodedImages decoded_images_; |
110 | 110 |
111 // Dictionary of relative paths and catalogs per path. Paths are in the form | 111 // Dictionary of relative paths and catalogs per path. Paths are in the form |
112 // of _locales/locale, without messages.json base part. | 112 // of _locales/locale, without messages.json base part. |
113 scoped_ptr<base::DictionaryValue> parsed_catalogs_; | 113 scoped_ptr<base::DictionaryValue> parsed_catalogs_; |
114 | 114 |
115 // The last error message that was set. Empty if there were no errors. | 115 // The last error message that was set. Empty if there were no errors. |
116 string16 error_message_; | 116 string16 error_message_; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(ExtensionUnpacker); | 118 DISALLOW_COPY_AND_ASSIGN(ExtensionUnpacker); |
119 }; | 119 }; |
120 | 120 |
121 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ | 121 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ |
OLD | NEW |