Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: chrome/common/extensions/unpacker.h

Issue 10704060: Move ExtensionUnpacker into extensions:: namespace, rename it to Unpacker (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Even later master Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_UNPACKER_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ 6 #define CHROME_COMMON_EXTENSIONS_UNPACKER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/tuple.h" 13 #include "base/tuple.h"
14 #include "chrome/common/extensions/extension.h" 14 #include "chrome/common/extensions/extension.h"
15 15
16 class SkBitmap; 16 class SkBitmap;
17 17
18 namespace base { 18 namespace base {
19 class DictionaryValue; 19 class DictionaryValue;
20 } 20 }
21 21
22 namespace extensions {
23
22 // This class unpacks an extension. It is designed to be used in a sandboxed 24 // This class unpacks an extension. It is designed to be used in a sandboxed
23 // child process. We unpack and parse various bits of the extension, then 25 // child process. We unpack and parse various bits of the extension, then
24 // report back to the browser process, who then transcodes the pre-parsed bits 26 // report back to the browser process, who then transcodes the pre-parsed bits
25 // and writes them back out to disk for later use. 27 // and writes them back out to disk for later use.
26 class ExtensionUnpacker { 28 class Unpacker {
27 public: 29 public:
28 typedef std::vector< Tuple2<SkBitmap, FilePath> > DecodedImages; 30 typedef std::vector< Tuple2<SkBitmap, FilePath> > DecodedImages;
29 31
30 ExtensionUnpacker(const FilePath& extension_path, 32 Unpacker(const FilePath& extension_path,
31 const std::string& extension_id, 33 const std::string& extension_id,
32 extensions::Extension::Location location, 34 Extension::Location location,
33 int creation_flags); 35 int creation_flags);
34 ~ExtensionUnpacker(); 36 ~Unpacker();
35 37
36 // Install the extension file at |extension_path|. Returns true on success. 38 // Install the extension file at |extension_path|. Returns true on success.
37 // Otherwise, error_message will contain a string explaining what went wrong. 39 // Otherwise, error_message will contain a string explaining what went wrong.
38 bool Run(); 40 bool Run();
39 41
40 // Write the decoded images to kDecodedImagesFilename. We do this instead 42 // Write the decoded images to kDecodedImagesFilename. We do this instead
41 // of sending them over IPC, since they are so large. Returns true on 43 // of sending them over IPC, since they are so large. Returns true on
42 // success. 44 // success.
43 bool DumpImagesToFile(); 45 bool DumpImagesToFile();
44 46
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Set the error message. 87 // Set the error message.
86 void SetError(const std::string& error); 88 void SetError(const std::string& error);
87 89
88 // The extension to unpack. 90 // The extension to unpack.
89 FilePath extension_path_; 91 FilePath extension_path_;
90 92
91 // The extension ID if known. 93 // The extension ID if known.
92 std::string extension_id_; 94 std::string extension_id_;
93 95
94 // The location to use for the created extension. 96 // The location to use for the created extension.
95 extensions::Extension::Location location_; 97 Extension::Location location_;
96 98
97 // The creation flags to use with the created extension. 99 // The creation flags to use with the created extension.
98 int creation_flags_; 100 int creation_flags_;
99 101
100 // The place we unpacked the extension to. 102 // The place we unpacked the extension to.
101 FilePath temp_install_dir_; 103 FilePath temp_install_dir_;
102 104
103 // The parsed version of the manifest JSON contained in the extension. 105 // The parsed version of the manifest JSON contained in the extension.
104 scoped_ptr<base::DictionaryValue> parsed_manifest_; 106 scoped_ptr<base::DictionaryValue> parsed_manifest_;
105 107
106 // A list of decoded images and the paths where those images came from. Paths 108 // A list of decoded images and the paths where those images came from. Paths
107 // are relative to the manifest file. 109 // are relative to the manifest file.
108 DecodedImages decoded_images_; 110 DecodedImages decoded_images_;
109 111
110 // Dictionary of relative paths and catalogs per path. Paths are in the form 112 // Dictionary of relative paths and catalogs per path. Paths are in the form
111 // of _locales/locale, without messages.json base part. 113 // of _locales/locale, without messages.json base part.
112 scoped_ptr<base::DictionaryValue> parsed_catalogs_; 114 scoped_ptr<base::DictionaryValue> parsed_catalogs_;
113 115
114 // The last error message that was set. Empty if there were no errors. 116 // The last error message that was set. Empty if there were no errors.
115 string16 error_message_; 117 string16 error_message_;
116 118
117 DISALLOW_COPY_AND_ASSIGN(ExtensionUnpacker); 119 DISALLOW_COPY_AND_ASSIGN(Unpacker);
118 }; 120 };
119 121
120 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ 122 } // namespace extensions
123
124 #endif // CHROME_COMMON_EXTENSIONS_UNPACKER_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_unpacker_unittest.cc ('k') | chrome/common/extensions/unpacker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698