diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-03 19:12:28 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-03 19:12:28 +0000 |
commit | bf94abe7b12b3e68c4dfacef6484058843a142e7 (patch) | |
tree | 369ea9ec3ca70306ed4b1a1fbe79045b28cdace9 /chrome/browser/extensions | |
parent | 16bea2f619c07a92878d7ae356cf1b145f5449e5 (diff) | |
download | chromium_src-bf94abe7b12b3e68c4dfacef6484058843a142e7.zip chromium_src-bf94abe7b12b3e68c4dfacef6484058843a142e7.tar.gz chromium_src-bf94abe7b12b3e68c4dfacef6484058843a142e7.tar.bz2 |
Delete the temp dir created by CreateZip.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/341074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30841 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r-- | chrome/browser/extensions/extension_creator.cc | 11 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_creator.h | 9 |
2 files changed, 13 insertions, 7 deletions
diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc index d9bc4d6..37f40b8 100644 --- a/chrome/browser/extensions/extension_creator.cc +++ b/chrome/browser/extensions/extension_creator.cc @@ -11,6 +11,7 @@ #include "base/crypto/signature_creator.h" #include "base/file_util.h" #include "base/scoped_handle.h" +#include "base/scoped_temp_dir.h" #include "base/string_util.h" #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" #include "chrome/common/extensions/extension.h" @@ -119,9 +120,9 @@ base::RSAPrivateKey* ExtensionCreator::GenerateKey(const FilePath& } bool ExtensionCreator::CreateZip(const FilePath& extension_dir, + const FilePath& temp_path, FilePath* zip_path) { - file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("chrome_"), zip_path); - *zip_path = zip_path->Append(FILE_PATH_LITERAL("extension.zip")); + *zip_path = temp_path.Append(FILE_PATH_LITERAL("extension.zip")); if (!Zip(extension_dir, *zip_path, false)) { // no hidden files error_message_ = "Failed to create temporary zip file during packaging."; @@ -221,11 +222,15 @@ bool ExtensionCreator::Run(const FilePath& extension_dir, if (!key_pair.get()) return false; + ScopedTempDir temp_dir; + if (!temp_dir.CreateUniqueTempDir()) + return false; + // Zip up the extension. FilePath zip_path; std::vector<uint8> signature; bool result = false; - if (CreateZip(extension_dir, &zip_path) && + if (CreateZip(extension_dir, temp_dir.path(), &zip_path) && SignZip(zip_path, key_pair.get(), &signature) && WriteCRX(zip_path, key_pair.get(), signature, crx_path)) { result = true; diff --git a/chrome/browser/extensions/extension_creator.h b/chrome/browser/extensions/extension_creator.h index e2446e3..c483a70 100644 --- a/chrome/browser/extensions/extension_creator.h +++ b/chrome/browser/extensions/extension_creator.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_CREATOR_H_ -#define CHROME_COMMON_EXTENSIONS_EXTENSION_CREATOR_H_ +#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CREATOR_H_ +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_CREATOR_H_ #include <string> #include <vector> @@ -51,7 +51,8 @@ class ExtensionCreator { base::RSAPrivateKey* GenerateKey(const FilePath& private_key_path); // Creates temporary zip file for the extension. - bool CreateZip(const FilePath& extension_dir, FilePath* zip_path); + bool CreateZip(const FilePath& extension_dir, const FilePath& temp_path, + FilePath* zip_path); // Signs the temporary zip and returns the signature. bool SignZip(const FilePath& zip_path, @@ -70,4 +71,4 @@ class ExtensionCreator { DISALLOW_COPY_AND_ASSIGN(ExtensionCreator); }; -#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_CREATOR_H_ +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CREATOR_H_ |