OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/extensions/api/networking_private/crypto_verify_impl.h" | 5 #include "chrome/browser/extensions/api/networking_private/crypto_verify_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 std::string decoded_public_key; | 132 std::string decoded_public_key; |
133 if (!base::Base64Decode(credentials.public_key, &decoded_public_key)) { | 133 if (!base::Base64Decode(credentials.public_key, &decoded_public_key)) { |
134 LOG(ERROR) << "Failed to decode public key"; | 134 LOG(ERROR) << "Failed to decode public key"; |
135 return false; | 135 return false; |
136 } | 136 } |
137 | 137 |
138 // Start getting credentials. CredentialsGetterCompleted will be called on | 138 // Start getting credentials. CredentialsGetterCompleted will be called on |
139 // completion. On Windows it will be called from a different thread after | 139 // completion. On Windows it will be called from a different thread after |
140 // |credentials_getter| is deleted. | 140 // |credentials_getter| is deleted. |
141 scoped_ptr<NetworkingPrivateCredentialsGetter> credentials_getter( | 141 std::unique_ptr<NetworkingPrivateCredentialsGetter> credentials_getter( |
142 NetworkingPrivateCredentialsGetter::Create()); | 142 NetworkingPrivateCredentialsGetter::Create()); |
143 credentials_getter->Start(guid, decoded_public_key, | 143 credentials_getter->Start(guid, decoded_public_key, |
144 base::Bind(&CredentialsGetterCompleted, | 144 base::Bind(&CredentialsGetterCompleted, |
145 success_callback, failure_callback)); | 145 success_callback, failure_callback)); |
146 return true; | 146 return true; |
147 } | 147 } |
148 | 148 |
149 void VerifyAndEncryptCredentialsCompleted( | 149 void VerifyAndEncryptCredentialsCompleted( |
150 const CryptoVerifyImpl::FailureCallback& failure_callback, | 150 const CryptoVerifyImpl::FailureCallback& failure_callback, |
151 bool succeeded) { | 151 bool succeeded) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 232 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
233 Credentials credentials(verification_properties); | 233 Credentials credentials(verification_properties); |
234 base::PostTaskAndReplyWithResult( | 234 base::PostTaskAndReplyWithResult( |
235 blocking_pool_task_runner_.get(), FROM_HERE, | 235 blocking_pool_task_runner_.get(), FROM_HERE, |
236 base::Bind(&DoVerifyAndEncryptData, credentials, data), | 236 base::Bind(&DoVerifyAndEncryptData, credentials, data), |
237 base::Bind(&VerifyAndEncryptDataCompleted, success_callback, | 237 base::Bind(&VerifyAndEncryptDataCompleted, success_callback, |
238 failure_callback)); | 238 failure_callback)); |
239 } | 239 } |
240 | 240 |
241 } // namespace extensions | 241 } // namespace extensions |
OLD | NEW |