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> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" | 10 #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 std::string CreateEnrollmentPublicMetadata() { | 47 std::string CreateEnrollmentPublicMetadata() { |
48 cryptauth::GcmMetadata metadata; | 48 cryptauth::GcmMetadata metadata; |
49 metadata.set_version(kGCMMetadataVersion); | 49 metadata.set_version(kGCMMetadataVersion); |
50 metadata.set_type(cryptauth::MessageType::ENROLLMENT); | 50 metadata.set_type(cryptauth::MessageType::ENROLLMENT); |
51 return metadata.SerializeAsString(); | 51 return metadata.SerializeAsString(); |
52 } | 52 } |
53 | 53 |
54 } // namespace | 54 } // namespace |
55 | 55 |
56 CryptAuthEnrollerImpl::CryptAuthEnrollerImpl( | 56 CryptAuthEnrollerImpl::CryptAuthEnrollerImpl( |
57 scoped_ptr<CryptAuthClientFactory> client_factory, | 57 std::unique_ptr<CryptAuthClientFactory> client_factory, |
58 scoped_ptr<SecureMessageDelegate> secure_message_delegate) | 58 std::unique_ptr<SecureMessageDelegate> secure_message_delegate) |
59 : client_factory_(std::move(client_factory)), | 59 : client_factory_(std::move(client_factory)), |
60 secure_message_delegate_(std::move(secure_message_delegate)), | 60 secure_message_delegate_(std::move(secure_message_delegate)), |
61 weak_ptr_factory_(this) {} | 61 weak_ptr_factory_(this) {} |
62 | 62 |
63 CryptAuthEnrollerImpl::~CryptAuthEnrollerImpl() { | 63 CryptAuthEnrollerImpl::~CryptAuthEnrollerImpl() { |
64 } | 64 } |
65 | 65 |
66 void CryptAuthEnrollerImpl::Enroll( | 66 void CryptAuthEnrollerImpl::Enroll( |
67 const std::string& user_public_key, | 67 const std::string& user_public_key, |
68 const std::string& user_private_key, | 68 const std::string& user_private_key, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 void CryptAuthEnrollerImpl::OnFinishEnrollmentFailure( | 223 void CryptAuthEnrollerImpl::OnFinishEnrollmentFailure( |
224 const std::string& error) { | 224 const std::string& error) { |
225 PA_LOG(WARNING) << "FinishEnrollment API failed with error: " << error; | 225 PA_LOG(WARNING) << "FinishEnrollment API failed with error: " << error; |
226 callback_.Run(false); | 226 callback_.Run(false); |
227 } | 227 } |
228 | 228 |
229 } // namespace proximity_auth | 229 } // namespace proximity_auth |
OLD | NEW |