OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/login/parallel_authenticator.h" | 5 #include "chrome/browser/chromeos/login/parallel_authenticator.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 const GaiaAuthConsumer::ClientLoginResult& credentials) { | 219 const GaiaAuthConsumer::ClientLoginResult& credentials) { |
220 std::string old_hash = HashPassword(old_password); | 220 std::string old_hash = HashPassword(old_password); |
221 key_migrator_ = CryptohomeOp::CreateMigrateAttempt(current_state_.get(), | 221 key_migrator_ = CryptohomeOp::CreateMigrateAttempt(current_state_.get(), |
222 this, | 222 this, |
223 true, | 223 true, |
224 old_hash); | 224 old_hash); |
225 BrowserThread::PostTask( | 225 BrowserThread::PostTask( |
226 BrowserThread::IO, FROM_HERE, | 226 BrowserThread::IO, FROM_HERE, |
227 NewRunnableMethod(this, | 227 NewRunnableMethod(this, |
228 &ParallelAuthenticator::ResyncRecoverHelper, | 228 &ParallelAuthenticator::ResyncRecoverHelper, |
229 key_migrator_.get())); | 229 key_migrator_)); |
230 } | 230 } |
231 | 231 |
232 void ParallelAuthenticator::ResyncEncryptedData( | 232 void ParallelAuthenticator::ResyncEncryptedData( |
233 const GaiaAuthConsumer::ClientLoginResult& credentials) { | 233 const GaiaAuthConsumer::ClientLoginResult& credentials) { |
234 data_remover_ = | 234 data_remover_ = |
235 CryptohomeOp::CreateRemoveAttempt(current_state_.get(), this); | 235 CryptohomeOp::CreateRemoveAttempt(current_state_.get(), this); |
236 BrowserThread::PostTask( | 236 BrowserThread::PostTask( |
237 BrowserThread::IO, FROM_HERE, | 237 BrowserThread::IO, FROM_HERE, |
238 NewRunnableMethod(this, | 238 NewRunnableMethod(this, |
239 &ParallelAuthenticator::ResyncRecoverHelper, | 239 &ParallelAuthenticator::ResyncRecoverHelper, |
240 data_remover_.get())); | 240 data_remover_)); |
241 } | 241 } |
242 | 242 |
243 void ParallelAuthenticator::ResyncRecoverHelper(CryptohomeOp* to_initiate) { | 243 void ParallelAuthenticator::ResyncRecoverHelper(CryptohomeOp* to_initiate) { |
244 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 244 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
245 current_state_->ResetCryptohomeStatus(); | 245 current_state_->ResetCryptohomeStatus(); |
246 BrowserThread::PostTask( | 246 BrowserThread::PostTask( |
247 BrowserThread::UI, FROM_HERE, | 247 BrowserThread::UI, FROM_HERE, |
248 NewRunnableMethod(to_initiate, &CryptohomeOp::Initiate)); | 248 NewRunnableMethod(to_initiate, &CryptohomeOp::Initiate)); |
249 } | 249 } |
250 | 250 |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 const unsigned int len) { | 627 const unsigned int len) { |
628 if (len < 2*binary_len) | 628 if (len < 2*binary_len) |
629 return false; | 629 return false; |
630 memset(hex_string, 0, len); | 630 memset(hex_string, 0, len); |
631 for (uint i = 0, j = 0; i < binary_len; i++, j+=2) | 631 for (uint i = 0, j = 0; i < binary_len; i++, j+=2) |
632 snprintf(hex_string + j, len - j, "%02x", binary[i]); | 632 snprintf(hex_string + j, len - j, "%02x", binary[i]); |
633 return true; | 633 return true; |
634 } | 634 } |
635 | 635 |
636 } // namespace chromeos | 636 } // namespace chromeos |
OLD | NEW |