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

Unified Diff: components/crx_file/crx_file.cc

Issue 1921973002: Convert //components/[a-e]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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: components/crx_file/crx_file.cc
diff --git a/components/crx_file/crx_file.cc b/components/crx_file/crx_file.cc
index 7a6240d265a1ff1997e9d70c4ef7271f5920f5c1..7a310aca98828693d9b2bc4e235fbb76b7b7b36f 100644
--- a/components/crx_file/crx_file.cc
+++ b/components/crx_file/crx_file.cc
@@ -9,7 +9,7 @@
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/numerics/safe_math.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -77,24 +77,24 @@ CrxFile::ValidateError FinalizeHash(const std::string& extension_id,
const char kCrxFileHeaderMagic[] = "Cr24";
const char kCrxDiffFileHeaderMagic[] = "CrOD";
-scoped_ptr<CrxFile> CrxFile::Parse(const CrxFile::Header& header,
- CrxFile::Error* error) {
+std::unique_ptr<CrxFile> CrxFile::Parse(const CrxFile::Header& header,
+ CrxFile::Error* error) {
if (HeaderIsValid(header, error))
- return scoped_ptr<CrxFile>(new CrxFile(header));
- return scoped_ptr<CrxFile>();
+ return base::WrapUnique(new CrxFile(header));
+ return nullptr;
}
-scoped_ptr<CrxFile> CrxFile::Create(const uint32_t key_size,
- const uint32_t signature_size,
- CrxFile::Error* error) {
+std::unique_ptr<CrxFile> CrxFile::Create(const uint32_t key_size,
+ const uint32_t signature_size,
+ CrxFile::Error* error) {
CrxFile::Header header;
memcpy(&header.magic, kCrxFileHeaderMagic, kCrxFileHeaderMagicSize);
header.version = kCurrentVersion;
header.key_size = key_size;
header.signature_size = signature_size;
if (HeaderIsValid(header, error))
- return scoped_ptr<CrxFile>(new CrxFile(header));
- return scoped_ptr<CrxFile>();
+ return base::WrapUnique(new CrxFile(header));
+ return nullptr;
}
bool CrxFile::HeaderIsDelta(const CrxFile::Header& header) {
@@ -109,7 +109,7 @@ CrxFile::ValidateError CrxFile::ValidateSignature(
std::string* extension_id,
CrxFile::Header* header_out) {
base::ScopedFILE file(base::OpenFile(crx_path, "rb"));
- scoped_ptr<crypto::SecureHash> hash;
+ std::unique_ptr<crypto::SecureHash> hash;
if (!expected_hash.empty())
hash.reset(crypto::SecureHash::Create(crypto::SecureHash::SHA256));
@@ -124,7 +124,7 @@ CrxFile::ValidateError CrxFile::ValidateSignature(
*header_out = header;
CrxFile::Error error;
- scoped_ptr<CrxFile> crx(CrxFile::Parse(header, &error));
+ std::unique_ptr<CrxFile> crx(CrxFile::Parse(header, &error));
if (!crx) {
switch (error) {
case CrxFile::kWrongMagic:
« no previous file with comments | « components/crx_file/crx_file.h ('k') | components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698