Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4047)

Unified Diff: chrome/browser/extensions/extension_creator.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_creator.cc
diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc
index 1991cc32e8950cfb4458619dbfb763be96bcc2c8..1076db595ff333a3dd7f6e95125c3540a7edfca2 100644
--- a/chrome/browser/extensions/extension_creator.cc
+++ b/chrome/browser/extensions/extension_creator.cc
@@ -148,7 +148,7 @@ crypto::RSAPrivateKey* ExtensionCreator::ReadInputKey(const base::FilePath&
crypto::RSAPrivateKey* ExtensionCreator::GenerateKey(const base::FilePath&
output_private_key_path) {
- scoped_ptr<crypto::RSAPrivateKey> key_pair(
+ std::unique_ptr<crypto::RSAPrivateKey> key_pair(
crypto::RSAPrivateKey::Create(kRSAKeySize));
if (!key_pair) {
error_message_ =
@@ -212,12 +212,12 @@ bool ExtensionCreator::CreateZip(const base::FilePath& extension_dir,
bool ExtensionCreator::SignZip(const base::FilePath& zip_path,
crypto::RSAPrivateKey* private_key,
std::vector<uint8_t>* signature) {
- scoped_ptr<crypto::SignatureCreator> signature_creator(
+ std::unique_ptr<crypto::SignatureCreator> signature_creator(
crypto::SignatureCreator::Create(private_key,
crypto::SignatureCreator::SHA1));
base::ScopedFILE zip_handle(base::OpenFile(zip_path, "rb"));
size_t buffer_size = 1 << 16;
- scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
+ std::unique_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
int bytes_read = -1;
while ((bytes_read = fread(buffer.get(), 1, buffer_size,
zip_handle.get())) > 0) {
@@ -253,7 +253,7 @@ bool ExtensionCreator::WriteCRX(const base::FilePath& zip_path,
CHECK(private_key->ExportPublicKey(&public_key));
crx_file::CrxFile::Error error;
- scoped_ptr<crx_file::CrxFile> crx(
+ std::unique_ptr<crx_file::CrxFile> crx(
crx_file::CrxFile::Create(public_key.size(), signature.size(), &error));
if (!crx) {
LOG(ERROR) << "cannot create CrxFileHeader: " << error;
@@ -273,7 +273,7 @@ bool ExtensionCreator::WriteCRX(const base::FilePath& zip_path,
}
size_t buffer_size = 1 << 16;
- scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
+ std::unique_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]);
size_t bytes_read = 0;
base::ScopedFILE zip_handle(base::OpenFile(zip_path, "rb"));
while ((bytes_read = fread(buffer.get(), 1, buffer_size,
@@ -299,7 +299,7 @@ bool ExtensionCreator::Run(const base::FilePath& extension_dir,
}
// Initialize Key Pair
- scoped_ptr<crypto::RSAPrivateKey> key_pair;
+ std::unique_ptr<crypto::RSAPrivateKey> key_pair;
if (!private_key_path.value().empty())
key_pair.reset(ReadInputKey(private_key_path));
else

Powered by Google App Engine
This is Rietveld 408576698