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

Unified Diff: components/proximity_auth/wire_message.cc

Issue 1912433002: Convert //components/proximity_auth from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits 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
« no previous file with comments | « components/proximity_auth/wire_message.h ('k') | components/proximity_auth/wire_message_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/proximity_auth/wire_message.cc
diff --git a/components/proximity_auth/wire_message.cc b/components/proximity_auth/wire_message.cc
index 3b4865b9dcfcd9bc7f06bc603c66eea5caa46aa1..ef27a3139f23615cf8d0c602a9982caa18e30322 100644
--- a/components/proximity_auth/wire_message.cc
+++ b/components/proximity_auth/wire_message.cc
@@ -13,6 +13,7 @@
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "components/proximity_auth/logging/logging.h"
@@ -79,17 +80,17 @@ WireMessage::~WireMessage() {
}
// static
-scoped_ptr<WireMessage> WireMessage::Deserialize(
+std::unique_ptr<WireMessage> WireMessage::Deserialize(
const std::string& serialized_message,
bool* is_incomplete_message) {
if (!ParseHeader(serialized_message, is_incomplete_message))
- return scoped_ptr<WireMessage>();
+ return std::unique_ptr<WireMessage>();
- scoped_ptr<base::Value> body_value =
+ std::unique_ptr<base::Value> body_value =
base::JSONReader::Read(serialized_message.substr(kHeaderLength));
if (!body_value || !body_value->IsType(base::Value::TYPE_DICTIONARY)) {
PA_LOG(WARNING) << "Error: Unable to parse message as JSON.";
- return scoped_ptr<WireMessage>();
+ return std::unique_ptr<WireMessage>();
}
base::DictionaryValue* body;
@@ -105,7 +106,7 @@ scoped_ptr<WireMessage> WireMessage::Deserialize(
if (!body->GetString(kPayloadKey, &payload_base64) ||
payload_base64.empty()) {
PA_LOG(WARNING) << "Error: Missing payload.";
- return scoped_ptr<WireMessage>();
+ return std::unique_ptr<WireMessage>();
}
std::string payload;
@@ -113,10 +114,10 @@ scoped_ptr<WireMessage> WireMessage::Deserialize(
base::Base64UrlDecodePolicy::REQUIRE_PADDING,
&payload)) {
PA_LOG(WARNING) << "Error: Invalid base64 encoding for payload.";
- return scoped_ptr<WireMessage>();
+ return std::unique_ptr<WireMessage>();
}
- return make_scoped_ptr(new WireMessage(payload, permit_id));
+ return base::WrapUnique(new WireMessage(payload, permit_id));
}
std::string WireMessage::Serialize() const {
« no previous file with comments | « components/proximity_auth/wire_message.h ('k') | components/proximity_auth/wire_message_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698