summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/chrome_utility_messages.h7
-rw-r--r--chrome/common/extensions/extension_unpacker.cc11
-rw-r--r--chrome/common/extensions/extension_unpacker.h11
-rw-r--r--chrome/common/extensions/extension_unpacker_unittest.cc4
4 files changed, 25 insertions, 8 deletions
diff --git a/chrome/common/chrome_utility_messages.h b/chrome/common/chrome_utility_messages.h
index 8ec3c80..7b7fcb6 100644
--- a/chrome/common/chrome_utility_messages.h
+++ b/chrome/common/chrome_utility_messages.h
@@ -11,6 +11,7 @@
#include "base/file_path.h"
#include "base/platform_file.h"
#include "base/values.h"
+#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/update_manifest.h"
#include "content/public/common/common_param_traits.h"
#include "content/public/common/serialized_script_value.h"
@@ -53,8 +54,10 @@ IPC_STRUCT_TRAITS_END()
// These are messages from the browser to the utility process.
// Tell the utility process to unpack the given extension file in its
// directory and verify that it is valid.
-IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_UnpackExtension,
- FilePath /* extension_filename */)
+IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_UnpackExtension,
+ FilePath /* extension_filename */,
+ int /* Extension::Location */,
+ int /* InitFromValue flags */)
// Tell the utility process to parse the given JSON data and verify its
// validity.
diff --git a/chrome/common/extensions/extension_unpacker.cc b/chrome/common/extensions/extension_unpacker.cc
index 3c729a4..bf2452e 100644
--- a/chrome/common/extensions/extension_unpacker.cc
+++ b/chrome/common/extensions/extension_unpacker.cc
@@ -84,8 +84,11 @@ bool PathContainsParentDirectory(const FilePath& path) {
} // namespace
-ExtensionUnpacker::ExtensionUnpacker(const FilePath& extension_path)
- : extension_path_(extension_path) {
+ExtensionUnpacker::ExtensionUnpacker(const FilePath& extension_path,
+ Extension::Location location,
+ int creation_flags)
+ : extension_path_(extension_path), location_(location),
+ creation_flags_(creation_flags) {
}
ExtensionUnpacker::~ExtensionUnpacker() {
@@ -178,9 +181,9 @@ bool ExtensionUnpacker::Run() {
std::string error;
scoped_refptr<Extension> extension(Extension::Create(
temp_install_dir_,
- Extension::INVALID,
+ location_,
*parsed_manifest_,
- Extension::NO_FLAGS,
+ creation_flags_,
&error));
if (!extension.get()) {
SetError(error);
diff --git a/chrome/common/extensions/extension_unpacker.h b/chrome/common/extensions/extension_unpacker.h
index 2526a9e..3655a38 100644
--- a/chrome/common/extensions/extension_unpacker.h
+++ b/chrome/common/extensions/extension_unpacker.h
@@ -12,6 +12,7 @@
#include "base/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/tuple.h"
+#include "chrome/common/extensions/extension.h"
class SkBitmap;
@@ -27,7 +28,9 @@ class ExtensionUnpacker {
public:
typedef std::vector< Tuple2<SkBitmap, FilePath> > DecodedImages;
- explicit ExtensionUnpacker(const FilePath& extension_path);
+ explicit ExtensionUnpacker(const FilePath& extension_path,
+ Extension::Location location,
+ int creation_flags);
~ExtensionUnpacker();
// Install the extension file at |extension_path|. Returns true on success.
@@ -85,6 +88,12 @@ class ExtensionUnpacker {
// The extension to unpack.
FilePath extension_path_;
+ // The location to use for the created extension.
+ Extension::Location location_;
+
+ // The creation flags to use with the created extension.
+ int creation_flags_;
+
// The place we unpacked the extension to.
FilePath temp_install_dir_;
diff --git a/chrome/common/extensions/extension_unpacker_unittest.cc b/chrome/common/extensions/extension_unpacker_unittest.cc
index e53b5af..e86007b 100644
--- a/chrome/common/extensions/extension_unpacker_unittest.cc
+++ b/chrome/common/extensions/extension_unpacker_unittest.cc
@@ -35,7 +35,9 @@ public:
"Original path " << original_path.value() <<
", Crx path " << crx_path.value();
- unpacker_.reset(new ExtensionUnpacker(crx_path));
+ unpacker_.reset(
+ new ExtensionUnpacker(
+ crx_path, Extension::INTERNAL, Extension::NO_FLAGS));
}
protected: