summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/sandboxed_extension_unpacker.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-06 06:17:54 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-06 06:17:54 +0000
commit84ac7f362e565c096851a783ca7163b78e19b659 (patch)
tree7f671e9c025e4e4b37468240e9be7a28926f6a7c /chrome/browser/extensions/sandboxed_extension_unpacker.cc
parent17492f531825be1522991579c1a1bd6af2d8c4b1 (diff)
downloadchromium_src-84ac7f362e565c096851a783ca7163b78e19b659.zip
chromium_src-84ac7f362e565c096851a783ca7163b78e19b659.tar.gz
chromium_src-84ac7f362e565c096851a783ca7163b78e19b659.tar.bz2
Generate IDs for --load-extension by hashing the path instead
of incrementing a static counter. BUG=21281 TEST=Load an unpacked extension from chrome://extensions/ that does not have an ID in its manifest. The resulting ID should be random-looking, not something like "aaaaaa". Review URL: http://codereview.chromium.org/256049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28095 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/sandboxed_extension_unpacker.cc')
-rw-r--r--chrome/browser/extensions/sandboxed_extension_unpacker.cc20
1 files changed, 9 insertions, 11 deletions
diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc
index 9d043b7..8756450 100644
--- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc
+++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc
@@ -127,18 +127,13 @@ void SandboxedExtensionUnpacker::OnUnpackExtensionSucceeded(
return;
}
- // Delete any images that may be used by the browser. We're going to write
- // out our own versions of the parsed images, and we want to make sure the
- // originals are gone for good.
- extension_.reset(new Extension);
- std::string manifest_error;
-
- // Update the path to refer to the temporary location. We do this because
- // clients may want to use resources inside the extension before it is
- // installed and they need the correct path. For example, the install UI shows
- // one of the icons from the extension.
- extension_->set_path(extension_root_);
+ // Create an extension object that refers to the temporary location the
+ // extension was unpacked to. We use this until the extension is finally
+ // installed. For example, the install UI shows images from inside the
+ // extension.
+ extension_.reset(new Extension(extension_root_));
+ std::string manifest_error;
if (!extension_->InitFromValue(*final_manifest, true, // require id
&manifest_error)) {
ReportFailure(std::string("Manifest is invalid: ") +
@@ -146,6 +141,9 @@ void SandboxedExtensionUnpacker::OnUnpackExtensionSucceeded(
return;
}
+ // Delete any images that may be used by the browser. We're going to write
+ // out our own versions of the parsed images, and we want to make sure the
+ // originals are gone for good.
std::set<FilePath> image_paths = extension_->GetBrowserImages();
if (image_paths.size() != images.size()) {
ReportFailure("Decoded images don't match what's in the manifest.");