Skip to content
Snippets Groups Projects
Commit bf94abe7 authored by thestig@chromium.org's avatar thestig@chromium.org
Browse files

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
parent 16bea2f6
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment