OLD | NEW |
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/cryptauth/cryptauth_enroller_impl.h" | 5 #include "components/proximity_auth/cryptauth/cryptauth_enroller_impl.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" | 10 #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" |
9 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_utils.h" | 11 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_utils.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/logging/logging.h" | 13 #include "components/proximity_auth/logging/logging.h" |
12 #include "crypto/sha2.h" | 14 #include "crypto/sha2.h" |
13 | 15 |
14 namespace proximity_auth { | 16 namespace proximity_auth { |
15 | 17 |
16 namespace { | 18 namespace { |
(...skipping 30 matching lines...) Expand all Loading... |
47 metadata.set_version(kGCMMetadataVersion); | 49 metadata.set_version(kGCMMetadataVersion); |
48 metadata.set_type(cryptauth::MessageType::ENROLLMENT); | 50 metadata.set_type(cryptauth::MessageType::ENROLLMENT); |
49 return metadata.SerializeAsString(); | 51 return metadata.SerializeAsString(); |
50 } | 52 } |
51 | 53 |
52 } // namespace | 54 } // namespace |
53 | 55 |
54 CryptAuthEnrollerImpl::CryptAuthEnrollerImpl( | 56 CryptAuthEnrollerImpl::CryptAuthEnrollerImpl( |
55 scoped_ptr<CryptAuthClientFactory> client_factory, | 57 scoped_ptr<CryptAuthClientFactory> client_factory, |
56 scoped_ptr<SecureMessageDelegate> secure_message_delegate) | 58 scoped_ptr<SecureMessageDelegate> secure_message_delegate) |
57 : client_factory_(client_factory.Pass()), | 59 : client_factory_(std::move(client_factory)), |
58 secure_message_delegate_(secure_message_delegate.Pass()), | 60 secure_message_delegate_(std::move(secure_message_delegate)), |
59 weak_ptr_factory_(this) { | 61 weak_ptr_factory_(this) {} |
60 } | |
61 | 62 |
62 CryptAuthEnrollerImpl::~CryptAuthEnrollerImpl() { | 63 CryptAuthEnrollerImpl::~CryptAuthEnrollerImpl() { |
63 } | 64 } |
64 | 65 |
65 void CryptAuthEnrollerImpl::Enroll( | 66 void CryptAuthEnrollerImpl::Enroll( |
66 const std::string& user_public_key, | 67 const std::string& user_public_key, |
67 const std::string& user_private_key, | 68 const std::string& user_private_key, |
68 const cryptauth::GcmDeviceInfo& device_info, | 69 const cryptauth::GcmDeviceInfo& device_info, |
69 cryptauth::InvocationReason invocation_reason, | 70 cryptauth::InvocationReason invocation_reason, |
70 const EnrollmentFinishedCallback& callback) { | 71 const EnrollmentFinishedCallback& callback) { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 220 } |
220 } | 221 } |
221 | 222 |
222 void CryptAuthEnrollerImpl::OnFinishEnrollmentFailure( | 223 void CryptAuthEnrollerImpl::OnFinishEnrollmentFailure( |
223 const std::string& error) { | 224 const std::string& error) { |
224 PA_LOG(WARNING) << "FinishEnrollment API failed with error: " << error; | 225 PA_LOG(WARNING) << "FinishEnrollment API failed with error: " << error; |
225 callback_.Run(false); | 226 callback_.Run(false); |
226 } | 227 } |
227 | 228 |
228 } // namespace proximity_auth | 229 } // namespace proximity_auth |
OLD | NEW |