OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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> |
11 | 11 |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/tuple.h" | 14 #include "base/tuple.h" |
15 | 15 |
16 class DictionaryValue; | 16 class DictionaryValue; |
17 class SkBitmap; | 17 class SkBitmap; |
18 | 18 |
19 // This class unpacks an extension. It is designed to be used in a sandboxed | 19 // This class unpacks an extension. It is designed to be used in a sandboxed |
20 // child process. We unpack and parse various bits of the extension, then | 20 // child process. We unpack and parse various bits of the extension, then |
21 // report back to the browser process, who then transcodes the pre-parsed bits | 21 // report back to the browser process, who then transcodes the pre-parsed bits |
22 // and writes them back out to disk for later use. | 22 // and writes them back out to disk for later use. |
23 class ExtensionUnpacker { | 23 class ExtensionUnpacker { |
24 public: | 24 public: |
25 typedef std::vector< Tuple2<SkBitmap, FilePath> > DecodedImages; | 25 typedef std::vector< Tuple2<SkBitmap, FilePath> > DecodedImages; |
26 | 26 |
27 explicit ExtensionUnpacker(const FilePath& extension_path) | 27 explicit ExtensionUnpacker(const FilePath& extension_path); |
28 : extension_path_(extension_path) {} | 28 ~ExtensionUnpacker(); |
29 | 29 |
30 // Install the extension file at |extension_path|. Returns true on success. | 30 // Install the extension file at |extension_path|. Returns true on success. |
31 // Otherwise, error_message will contain a string explaining what went wrong. | 31 // Otherwise, error_message will contain a string explaining what went wrong. |
32 bool Run(); | 32 bool Run(); |
33 | 33 |
34 // Write the decoded images to kDecodedImagesFilename. We do this instead | 34 // Write the decoded images to kDecodedImagesFilename. We do this instead |
35 // of sending them over IPC, since they are so large. Returns true on | 35 // of sending them over IPC, since they are so large. Returns true on |
36 // success. | 36 // success. |
37 bool DumpImagesToFile(); | 37 bool DumpImagesToFile(); |
38 | 38 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // of _locales/locale, without messages.json base part. | 96 // of _locales/locale, without messages.json base part. |
97 scoped_ptr<DictionaryValue> parsed_catalogs_; | 97 scoped_ptr<DictionaryValue> parsed_catalogs_; |
98 | 98 |
99 // The last error message that was set. Empty if there were no errors. | 99 // The last error message that was set. Empty if there were no errors. |
100 std::string error_message_; | 100 std::string error_message_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(ExtensionUnpacker); | 102 DISALLOW_COPY_AND_ASSIGN(ExtensionUnpacker); |
103 }; | 103 }; |
104 | 104 |
105 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ | 105 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ |
OLD | NEW |