summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_creator.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-17 07:06:16 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-17 07:06:16 +0000
commit0dc2ca8ae3d110f25b9cad91fd0e15d2e6ca426d (patch)
treeb866c5583143fe7de16ee0b3b1fb2c398a098d61 /chrome/browser/extensions/extension_creator.cc
parent6c28d5cfb0ec978b6185a5adbbb60dcbd6fa7a6e (diff)
downloadchromium_src-0dc2ca8ae3d110f25b9cad91fd0e15d2e6ca426d.zip
chromium_src-0dc2ca8ae3d110f25b9cad91fd0e15d2e6ca426d.tar.gz
chromium_src-0dc2ca8ae3d110f25b9cad91fd0e15d2e6ca426d.tar.bz2
Add validation to extension packaging.
BUG=27685,27690 Review URL: http://codereview.chromium.org/398001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32163 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_creator.cc')
-rw-r--r--chrome/browser/extensions/extension_creator.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc
index 37f40b8..9b8f31e 100644
--- a/chrome/browser/extensions/extension_creator.cc
+++ b/chrome/browser/extensions/extension_creator.cc
@@ -13,6 +13,7 @@
#include "base/scoped_handle.h"
#include "base/scoped_temp_dir.h"
#include "base/string_util.h"
+#include "chrome/browser/extensions/extension_file_util.h"
#include "chrome/browser/extensions/sandboxed_extension_unpacker.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/zip.h"
@@ -50,6 +51,15 @@ bool ExtensionCreator::InitializeInput(
return false;
}
+ // Load the extension once. We don't really need it, but this does a lot of
+ // useful validation of the structure.
+ scoped_ptr<Extension> extension(
+ extension_file_util::LoadExtension(extension_dir,
+ false, // key not required
+ &error_message_));
+ if (!extension.get())
+ return false; // LoadExtension already set error_message_.
+
return true;
}