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

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

Issue 12093036: Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
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_UNPACKER_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_UNPACKER_H_
6 #define CHROME_COMMON_EXTENSIONS_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/manifest.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 { 22 namespace extensions {
23 23
24 // 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
25 // 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
26 // 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
27 // and writes them back out to disk for later use. 27 // and writes them back out to disk for later use.
28 class Unpacker { 28 class Unpacker {
29 public: 29 public:
30 typedef std::vector< Tuple2<SkBitmap, FilePath> > DecodedImages; 30 typedef std::vector< Tuple2<SkBitmap, FilePath> > DecodedImages;
31 31
32 Unpacker(const FilePath& extension_path, 32 Unpacker(const FilePath& extension_path,
33 const std::string& extension_id, 33 const std::string& extension_id,
34 Extension::Location location, 34 Manifest::Location location,
35 int creation_flags); 35 int creation_flags);
36 ~Unpacker(); 36 ~Unpacker();
37 37
38 // Install the extension file at |extension_path|. Returns true on success. 38 // Install the extension file at |extension_path|. Returns true on success.
39 // Otherwise, error_message will contain a string explaining what went wrong. 39 // Otherwise, error_message will contain a string explaining what went wrong.
40 bool Run(); 40 bool Run();
41 41
42 // Write the decoded images to kDecodedImagesFilename. We do this instead 42 // Write the decoded images to kDecodedImagesFilename. We do this instead
43 // 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
44 // success. 44 // success.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void SetError(const std::string& error); 88 void SetError(const std::string& error);
89 void SetUTF16Error(const string16& error); 89 void SetUTF16Error(const string16& error);
90 90
91 // The extension to unpack. 91 // The extension to unpack.
92 FilePath extension_path_; 92 FilePath extension_path_;
93 93
94 // The extension ID if known. 94 // The extension ID if known.
95 std::string extension_id_; 95 std::string extension_id_;
96 96
97 // The location to use for the created extension. 97 // The location to use for the created extension.
98 Extension::Location location_; 98 Manifest::Location location_;
99 99
100 // The creation flags to use with the created extension. 100 // The creation flags to use with the created extension.
101 int creation_flags_; 101 int creation_flags_;
102 102
103 // The place we unpacked the extension to. 103 // The place we unpacked the extension to.
104 FilePath temp_install_dir_; 104 FilePath temp_install_dir_;
105 105
106 // The parsed version of the manifest JSON contained in the extension. 106 // The parsed version of the manifest JSON contained in the extension.
107 scoped_ptr<base::DictionaryValue> parsed_manifest_; 107 scoped_ptr<base::DictionaryValue> parsed_manifest_;
108 108
109 // A list of decoded images and the paths where those images came from. Paths 109 // A list of decoded images and the paths where those images came from. Paths
110 // are relative to the manifest file. 110 // are relative to the manifest file.
111 DecodedImages decoded_images_; 111 DecodedImages decoded_images_;
112 112
113 // Dictionary of relative paths and catalogs per path. Paths are in the form 113 // Dictionary of relative paths and catalogs per path. Paths are in the form
114 // of _locales/locale, without messages.json base part. 114 // of _locales/locale, without messages.json base part.
115 scoped_ptr<base::DictionaryValue> parsed_catalogs_; 115 scoped_ptr<base::DictionaryValue> parsed_catalogs_;
116 116
117 // The last error message that was set. Empty if there were no errors. 117 // The last error message that was set. Empty if there were no errors.
118 string16 error_message_; 118 string16 error_message_;
119 119
120 DISALLOW_COPY_AND_ASSIGN(Unpacker); 120 DISALLOW_COPY_AND_ASSIGN(Unpacker);
121 }; 121 };
122 122
123 } // namespace extensions 123 } // namespace extensions
124 124
125 #endif // CHROME_COMMON_EXTENSIONS_UNPACKER_H_ 125 #endif // CHROME_COMMON_EXTENSIONS_UNPACKER_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/permissions/permission_set_unittest.cc ('k') | chrome/common/extensions/unpacker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698