diff options
author | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 19:02:19 +0000 |
---|---|---|
committer | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 19:02:19 +0000 |
commit | 902f7cd528743a286439cfca87266aa1b723a8bf (patch) | |
tree | 986e45ef007fba1dd21436bcf1a00470ca6ae1e4 /chrome/common/extensions/extension_unpacker.h | |
parent | 5be94dffc6b19e0ed8397879ad60fe06e498cb3a (diff) | |
download | chromium_src-902f7cd528743a286439cfca87266aa1b723a8bf.zip chromium_src-902f7cd528743a286439cfca87266aa1b723a8bf.tar.gz chromium_src-902f7cd528743a286439cfca87266aa1b723a8bf.tar.bz2 |
Have the browser process rewrite manifest.json and theme/page action images
that the extension unpacker process parsed.
BUG=11680
Review URL: http://codereview.chromium.org/115595
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16768 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension_unpacker.h')
-rw-r--r-- | chrome/common/extensions/extension_unpacker.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/chrome/common/extensions/extension_unpacker.h b/chrome/common/extensions/extension_unpacker.h index 6d5fbf3..7e83363 100644 --- a/chrome/common/extensions/extension_unpacker.h +++ b/chrome/common/extensions/extension_unpacker.h @@ -6,16 +6,22 @@ #define CHROME_COMMON_EXTENSIONS_EXTENSION_UNPACKER_H_ #include <string> +#include <vector> #include "base/file_path.h" +#include "base/scoped_ptr.h" +#include "base/tuple.h" class DictionaryValue; +class SkBitmap; // Implements IO for the ExtensionsService. // TODO(aa): Extract an interface out of this for testing the frontend, once the // frontend has significant logic to test. class ExtensionUnpacker { public: + typedef std::vector< Tuple2<SkBitmap, FilePath> > DecodedImages; + explicit ExtensionUnpacker(const FilePath& extension_path) : extension_path_(extension_path) {} @@ -24,18 +30,40 @@ class ExtensionUnpacker { bool Run(); const std::string& error_message() { return error_message_; } + DictionaryValue* parsed_manifest() { + return parsed_manifest_.get(); + } + const DecodedImages& decoded_images() { return decoded_images_; } private: - // Read the manifest from the front of the extension file. + // Parse the header on the front of the extension file and return the manifest + // inside it. Caller takes ownership of return value. + DictionaryValue* ReadPackageHeader(); + + // Parse the manifest.json file inside the extension (not in the header). // Caller takes ownership of return value. DictionaryValue* ReadManifest(); + // Decodes the image at the given path and puts it in our list of decoded + // images. + bool AddDecodedImage(const FilePath& path); + // Set the error message. void SetError(const std::string& error); // The extension to unpack. FilePath extension_path_; + // The place we unpacked the extension to. + FilePath temp_install_dir_; + + // The parsed version of the manifest JSON contained in the extension. + scoped_ptr<DictionaryValue> parsed_manifest_; + + // A list of decoded images and the paths where those images came from. Paths + // are relative to the manifest file. + DecodedImages decoded_images_; + // The last error message that was set. Empty if there were no errors. std::string error_message_; |