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

Side by Side Diff: components/proximity_auth/device_to_device_authenticator.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 11 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_authenticator.h" 5 #include "components/proximity_auth/device_to_device_authenticator.h"
6 6
7 #include <utility>
8
7 #include "base/time/time.h" 9 #include "base/time/time.h"
8 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
9 #include "components/proximity_auth/connection.h" 11 #include "components/proximity_auth/connection.h"
10 #include "components/proximity_auth/cryptauth/secure_message_delegate.h" 12 #include "components/proximity_auth/cryptauth/secure_message_delegate.h"
11 #include "components/proximity_auth/device_to_device_initiator_operations.h" 13 #include "components/proximity_auth/device_to_device_initiator_operations.h"
12 #include "components/proximity_auth/device_to_device_secure_context.h" 14 #include "components/proximity_auth/device_to_device_secure_context.h"
13 #include "components/proximity_auth/logging/logging.h" 15 #include "components/proximity_auth/logging/logging.h"
14 #include "components/proximity_auth/secure_context.h" 16 #include "components/proximity_auth/secure_context.h"
15 #include "components/proximity_auth/wire_message.h" 17 #include "components/proximity_auth/wire_message.h"
16 18
(...skipping 11 matching lines...) Expand all
28 const char kPermitIdPrefix[] = "permit://google.com/easyunlock/v1/"; 30 const char kPermitIdPrefix[] = "permit://google.com/easyunlock/v1/";
29 31
30 } // namespace 32 } // namespace
31 33
32 DeviceToDeviceAuthenticator::DeviceToDeviceAuthenticator( 34 DeviceToDeviceAuthenticator::DeviceToDeviceAuthenticator(
33 Connection* connection, 35 Connection* connection,
34 const std::string& account_id, 36 const std::string& account_id,
35 scoped_ptr<SecureMessageDelegate> secure_message_delegate) 37 scoped_ptr<SecureMessageDelegate> secure_message_delegate)
36 : connection_(connection), 38 : connection_(connection),
37 account_id_(account_id), 39 account_id_(account_id),
38 secure_message_delegate_(secure_message_delegate.Pass()), 40 secure_message_delegate_(std::move(secure_message_delegate)),
39 state_(State::NOT_STARTED), 41 state_(State::NOT_STARTED),
40 weak_ptr_factory_(this) { 42 weak_ptr_factory_(this) {
41 DCHECK(connection_); 43 DCHECK(connection_);
42 } 44 }
43 45
44 DeviceToDeviceAuthenticator::~DeviceToDeviceAuthenticator() { 46 DeviceToDeviceAuthenticator::~DeviceToDeviceAuthenticator() {
45 connection_->RemoveObserver(this); 47 connection_->RemoveObserver(this);
46 } 48 }
47 49
48 void DeviceToDeviceAuthenticator::Authenticate( 50 void DeviceToDeviceAuthenticator::Authenticate(
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 void DeviceToDeviceAuthenticator::Succeed() { 174 void DeviceToDeviceAuthenticator::Succeed() {
173 DCHECK(state_ == State::SENT_INITIATOR_AUTH); 175 DCHECK(state_ == State::SENT_INITIATOR_AUTH);
174 DCHECK(!session_symmetric_key_.empty()); 176 DCHECK(!session_symmetric_key_.empty());
175 PA_LOG(INFO) << "Authentication succeeded!"; 177 PA_LOG(INFO) << "Authentication succeeded!";
176 178
177 state_ = State::AUTHENTICATION_SUCCESS; 179 state_ = State::AUTHENTICATION_SUCCESS;
178 connection_->RemoveObserver(this); 180 connection_->RemoveObserver(this);
179 callback_.Run( 181 callback_.Run(
180 Result::SUCCESS, 182 Result::SUCCESS,
181 make_scoped_ptr(new DeviceToDeviceSecureContext( 183 make_scoped_ptr(new DeviceToDeviceSecureContext(
182 secure_message_delegate_.Pass(), session_symmetric_key_, 184 std::move(secure_message_delegate_), session_symmetric_key_,
183 responder_auth_message_, SecureContext::PROTOCOL_VERSION_THREE_ONE))); 185 responder_auth_message_, SecureContext::PROTOCOL_VERSION_THREE_ONE)));
184 } 186 }
185 187
186 void DeviceToDeviceAuthenticator::OnConnectionStatusChanged( 188 void DeviceToDeviceAuthenticator::OnConnectionStatusChanged(
187 Connection* connection, 189 Connection* connection,
188 Connection::Status old_status, 190 Connection::Status old_status,
189 Connection::Status new_status) { 191 Connection::Status new_status) {
190 // We do not expect the connection to drop during authentication. 192 // We do not expect the connection to drop during authentication.
191 if (new_status == Connection::DISCONNECTED) { 193 if (new_status == Connection::DISCONNECTED) {
192 Fail("Disconnected while authentication is in progress", 194 Fail("Disconnected while authentication is in progress",
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 Succeed(); 229 Succeed();
228 else 230 else
229 Fail("Failed to send [Initiator Auth]"); 231 Fail("Failed to send [Initiator Auth]");
230 } else if (!success && state_ == State::SENT_HELLO) { 232 } else if (!success && state_ == State::SENT_HELLO) {
231 DCHECK(message.payload() == hello_message_); 233 DCHECK(message.payload() == hello_message_);
232 Fail("Failed to send [Hello]"); 234 Fail("Failed to send [Hello]");
233 } 235 }
234 } 236 }
235 237
236 } // namespace proximity_auth 238 } // namespace proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698