summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/sandboxed_extension_unpacker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/sandboxed_extension_unpacker.cc')
-rw-r--r--chrome/browser/extensions/sandboxed_extension_unpacker.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc
index fc8aea8..c1702b1 100644
--- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc
+++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc
@@ -9,6 +9,7 @@
#include "base/base64.h"
#include "base/crypto/signature_verifier.h"
#include "base/file_util.h"
+#include "base/file_util_proxy.h"
#include "base/message_loop.h"
#include "base/scoped_handle.h"
#include "base/task.h"
@@ -116,7 +117,13 @@ void SandboxedExtensionUnpacker::Start() {
}
}
-SandboxedExtensionUnpacker::~SandboxedExtensionUnpacker() {}
+SandboxedExtensionUnpacker::~SandboxedExtensionUnpacker() {
+ base::FileUtilProxy::Delete(
+ BrowserThread::GetMessageLoopProxyForThread(thread_identifier_),
+ temp_dir_.Take(),
+ true,
+ NULL);
+}
void SandboxedExtensionUnpacker::StartProcessOnIOThread(
const FilePath& temp_crx_path) {
@@ -140,18 +147,20 @@ void SandboxedExtensionUnpacker::OnUnpackExtensionSucceeded(
// 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_));
// Localize manifest now, so confirm UI gets correct extension name.
std::string error;
- if (!extension_l10n_util::LocalizeExtension(extension_.get(),
+ if (!extension_l10n_util::LocalizeExtension(extension_root_,
final_manifest.get(),
&error)) {
ReportFailure(error);
return;
}
- if (!extension_->InitFromValue(*final_manifest, true, &error)) {
+ extension_ = Extension::Create(
+ extension_root_, Extension::INTERNAL, *final_manifest, true, &error);
+
+ if (!extension_.get()) {
ReportFailure(std::string("Manifest is invalid: ") + error);
return;
}
@@ -270,8 +279,8 @@ void SandboxedExtensionUnpacker::ReportFailure(const std::string& error) {
void SandboxedExtensionUnpacker::ReportSuccess() {
// Client takes ownership of temporary directory and extension.
- client_->OnUnpackSuccess(temp_dir_.Take(), extension_root_,
- extension_.release());
+ client_->OnUnpackSuccess(temp_dir_.Take(), extension_root_, extension_);
+ extension_ = NULL;
}
DictionaryValue* SandboxedExtensionUnpacker::RewriteManifestFile(