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

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

Issue 526012: Merge 32345 - Parse messages.json in ExtensionUnpacker (like we do for manife... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/249/src/
Patch Set: Created 10 years, 11 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) 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 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 28 matching lines...) Expand all
39 // |extension_path| is the path to the extension we unpacked that wrote the 39 // |extension_path| is the path to the extension we unpacked that wrote the
40 // data. Returns true on success. 40 // data. Returns true on success.
41 static bool ReadImagesFromFile(const FilePath& extension_path, 41 static bool ReadImagesFromFile(const FilePath& extension_path,
42 DecodedImages* images); 42 DecodedImages* images);
43 43
44 const std::string& error_message() { return error_message_; } 44 const std::string& error_message() { return error_message_; }
45 DictionaryValue* parsed_manifest() { 45 DictionaryValue* parsed_manifest() {
46 return parsed_manifest_.get(); 46 return parsed_manifest_.get();
47 } 47 }
48 const DecodedImages& decoded_images() { return decoded_images_; } 48 const DecodedImages& decoded_images() { return decoded_images_; }
49 DictionaryValue* parsed_catalogs() { return parsed_catalogs_.get(); }
49 50
50 private: 51 private:
51 // Parse the manifest.json file inside the extension (not in the header). 52 // Parse the manifest.json file inside the extension (not in the header).
52 // Caller takes ownership of return value. 53 // Caller takes ownership of return value.
53 DictionaryValue* ReadManifest(); 54 DictionaryValue* ReadManifest();
54 55
56 // Parse all _locales/*/messages.json files inside the extension.
57 bool ReadAllMessageCatalogs(const std::string& default_locale);
58
55 // Decodes the image at the given path and puts it in our list of decoded 59 // Decodes the image at the given path and puts it in our list of decoded
56 // images. 60 // images.
57 bool AddDecodedImage(const FilePath& path); 61 bool AddDecodedImage(const FilePath& path);
58 62
63 // Parses the catalog at the given path and puts it in our list of parsed
64 // catalogs.
65 bool ReadMessageCatalog(const FilePath& message_path);
66
59 // Set the error message. 67 // Set the error message.
60 void SetError(const std::string& error); 68 void SetError(const std::string& error);
61 69
62 // The extension to unpack. 70 // The extension to unpack.
63 FilePath extension_path_; 71 FilePath extension_path_;
64 72
65 // The place we unpacked the extension to. 73 // The place we unpacked the extension to.
66 FilePath temp_install_dir_; 74 FilePath temp_install_dir_;
67 75
68 // The parsed version of the manifest JSON contained in the extension. 76 // The parsed version of the manifest JSON contained in the extension.
69 scoped_ptr<DictionaryValue> parsed_manifest_; 77 scoped_ptr<DictionaryValue> parsed_manifest_;
70 78
71 // A list of decoded images and the paths where those images came from. Paths 79 // A list of decoded images and the paths where those images came from. Paths
72 // are relative to the manifest file. 80 // are relative to the manifest file.
73 DecodedImages decoded_images_; 81 DecodedImages decoded_images_;
74 82
83 // Dictionary of relative paths and catalogs per path. Paths are in the form
84 // of _locales/locale, without messages.json base part.
85 scoped_ptr<DictionaryValue> parsed_catalogs_;
86
75 // The last error message that was set. Empty if there were no errors. 87 // The last error message that was set. Empty if there were no errors.
76 std::string error_message_; 88 std::string error_message_;
77 89
78 DISALLOW_COPY_AND_ASSIGN(ExtensionUnpacker); 90 DISALLOW_COPY_AND_ASSIGN(ExtensionUnpacker);
79 }; 91 };
80 92
81 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ 93 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_unittest.cc ('k') | chrome/common/extensions/extension_unpacker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698