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

Side by Side Diff: components/proximity_auth/device_to_device_secure_context.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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/proximity_auth/device_to_device_secure_context.h" 5 #include "components/proximity_auth/device_to_device_secure_context.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h" 11 #include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h"
12 #include "components/proximity_auth/cryptauth/proto/securemessage.pb.h" 12 #include "components/proximity_auth/cryptauth/proto/securemessage.pb.h"
13 #include "components/proximity_auth/cryptauth/secure_message_delegate.h" 13 #include "components/proximity_auth/cryptauth/secure_message_delegate.h"
14 #include "components/proximity_auth/logging/logging.h" 14 #include "components/proximity_auth/logging/logging.h"
15 15
16 namespace proximity_auth { 16 namespace proximity_auth {
17 17
18 namespace { 18 namespace {
19 19
20 // The version to put in the GcmMetadata field. 20 // The version to put in the GcmMetadata field.
21 const int kGcmMetadataVersion = 1; 21 const int kGcmMetadataVersion = 1;
22 22
23 // The sequence number of the last message used during authentication. These 23 // The sequence number of the last message used during authentication. These
24 // messages are sent and received before the SecureContext is created. 24 // messages are sent and received before the SecureContext is created.
25 const int kAuthenticationSequenceNumber = 2; 25 const int kAuthenticationSequenceNumber = 2;
26 26
27 } // namespace 27 } // namespace
28 28
29 DeviceToDeviceSecureContext::DeviceToDeviceSecureContext( 29 DeviceToDeviceSecureContext::DeviceToDeviceSecureContext(
30 scoped_ptr<SecureMessageDelegate> secure_message_delegate, 30 std::unique_ptr<SecureMessageDelegate> secure_message_delegate,
31 const std::string& symmetric_key, 31 const std::string& symmetric_key,
32 const std::string& responder_auth_message, 32 const std::string& responder_auth_message,
33 ProtocolVersion protocol_version) 33 ProtocolVersion protocol_version)
34 : secure_message_delegate_(std::move(secure_message_delegate)), 34 : secure_message_delegate_(std::move(secure_message_delegate)),
35 symmetric_key_(symmetric_key), 35 symmetric_key_(symmetric_key),
36 responder_auth_message_(responder_auth_message), 36 responder_auth_message_(responder_auth_message),
37 protocol_version_(protocol_version), 37 protocol_version_(protocol_version),
38 last_sequence_number_(kAuthenticationSequenceNumber), 38 last_sequence_number_(kAuthenticationSequenceNumber),
39 weak_ptr_factory_(this) {} 39 weak_ptr_factory_(this) {}
40 40
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 PA_LOG(ERROR) << "Failed to validate GcmMetadata."; 112 PA_LOG(ERROR) << "Failed to validate GcmMetadata.";
113 callback.Run(std::string()); 113 callback.Run(std::string());
114 return; 114 return;
115 } 115 }
116 116
117 last_sequence_number_++; 117 last_sequence_number_++;
118 callback.Run(device_to_device_message.message()); 118 callback.Run(device_to_device_message.message());
119 } 119 }
120 120
121 } // proximity_auth 121 } // proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698