diff options
author | Ben Murdoch <benm@google.com> | 2010-11-18 18:32:45 +0000 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-11-18 18:38:07 +0000 |
commit | 513209b27ff55e2841eac0e4120199c23acce758 (patch) | |
tree | aeba30bb08c5f47c57003544e378a377c297eee6 /chrome/browser/extensions/sandboxed_extension_unpacker.cc | |
parent | 164f7496de0fbee436b385a79ead9e3cb81a50c1 (diff) | |
download | external_chromium-513209b27ff55e2841eac0e4120199c23acce758.zip external_chromium-513209b27ff55e2841eac0e4120199c23acce758.tar.gz external_chromium-513209b27ff55e2841eac0e4120199c23acce758.tar.bz2 |
Merge Chromium at r65505: Initial merge by git.
Change-Id: I31d8f1d8cd33caaf7f47ffa7350aef42d5fbdb45
Diffstat (limited to 'chrome/browser/extensions/sandboxed_extension_unpacker.cc')
-rw-r--r-- | chrome/browser/extensions/sandboxed_extension_unpacker.cc | 21 |
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( |