| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 !CommandLine::ForCurrentProcess()->HasSwitch( | 98 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 99 switches::kSkipOAuthLogin)) { | 99 switches::kSkipOAuthLogin)) { |
| 100 CHECK(chromeos::CrosLibrary::Get()->EnsureLoaded()); | 100 CHECK(chromeos::CrosLibrary::Get()->EnsureLoaded()); |
| 101 // If not already owned, this is a no-op. If it is, this loads the owner's | 101 // If not already owned, this is a no-op. If it is, this loads the owner's |
| 102 // public key off of disk. | 102 // public key off of disk. |
| 103 OwnershipService::GetSharedInstance()->StartLoadOwnerKeyAttempt(); | 103 OwnershipService::GetSharedInstance()->StartLoadOwnerKeyAttempt(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 ParallelAuthenticator::~ParallelAuthenticator() {} | 106 ParallelAuthenticator::~ParallelAuthenticator() {} |
| 107 | 107 |
| 108 bool ParallelAuthenticator::AuthenticateToLogin( | 108 void ParallelAuthenticator::AuthenticateToLogin( |
| 109 Profile* profile, | 109 Profile* profile, |
| 110 const std::string& username, | 110 const std::string& username, |
| 111 const std::string& password, | 111 const std::string& password, |
| 112 const std::string& login_token, | 112 const std::string& login_token, |
| 113 const std::string& login_captcha) { | 113 const std::string& login_captcha) { |
| 114 std::string canonicalized = Authenticator::Canonicalize(username); | 114 std::string canonicalized = Authenticator::Canonicalize(username); |
| 115 authentication_profile_ = profile; | 115 authentication_profile_ = profile; |
| 116 current_state_.reset( | 116 current_state_.reset( |
| 117 new AuthAttemptState(canonicalized, | 117 new AuthAttemptState(canonicalized, |
| 118 password, | 118 password, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 136 current_state_.get(), | 136 current_state_.get(), |
| 137 this); | 137 this); |
| 138 current_online_->Initiate(profile); | 138 current_online_->Initiate(profile); |
| 139 } | 139 } |
| 140 | 140 |
| 141 BrowserThread::PostTask( | 141 BrowserThread::PostTask( |
| 142 BrowserThread::FILE, FROM_HERE, | 142 BrowserThread::FILE, FROM_HERE, |
| 143 NewRunnableMethod(this, | 143 NewRunnableMethod(this, |
| 144 &ParallelAuthenticator::LoadLocalaccount, | 144 &ParallelAuthenticator::LoadLocalaccount, |
| 145 std::string(kLocalaccountFile))); | 145 std::string(kLocalaccountFile))); |
| 146 return true; | |
| 147 } | 146 } |
| 148 | 147 |
| 149 bool ParallelAuthenticator::CompleteLogin(Profile* profile, | 148 void ParallelAuthenticator::CompleteLogin(Profile* profile, |
| 150 const std::string& username, | 149 const std::string& username, |
| 151 const std::string& password) { | 150 const std::string& password) { |
| 152 std::string canonicalized = Authenticator::Canonicalize(username); | 151 std::string canonicalized = Authenticator::Canonicalize(username); |
| 153 authentication_profile_ = profile; | 152 authentication_profile_ = profile; |
| 154 current_state_.reset( | 153 current_state_.reset( |
| 155 new AuthAttemptState(canonicalized, | 154 new AuthAttemptState(canonicalized, |
| 156 password, | 155 password, |
| 157 HashPassword(password), | 156 HashPassword(password), |
| 158 !UserManager::Get()->IsKnownUser(canonicalized))); | 157 !UserManager::Get()->IsKnownUser(canonicalized))); |
| 159 mounter_ = CryptohomeOp::CreateMountAttempt(current_state_.get(), | 158 mounter_ = CryptohomeOp::CreateMountAttempt(current_state_.get(), |
| (...skipping 21 matching lines...) Expand all Loading... |
| 181 BrowserThread::IO, FROM_HERE, | 180 BrowserThread::IO, FROM_HERE, |
| 182 NewRunnableMethod(this, | 181 NewRunnableMethod(this, |
| 183 &ParallelAuthenticator::ResolveLoginCompletionStatus)); | 182 &ParallelAuthenticator::ResolveLoginCompletionStatus)); |
| 184 } | 183 } |
| 185 | 184 |
| 186 BrowserThread::PostTask( | 185 BrowserThread::PostTask( |
| 187 BrowserThread::FILE, FROM_HERE, | 186 BrowserThread::FILE, FROM_HERE, |
| 188 NewRunnableMethod(this, | 187 NewRunnableMethod(this, |
| 189 &ParallelAuthenticator::LoadLocalaccount, | 188 &ParallelAuthenticator::LoadLocalaccount, |
| 190 std::string(kLocalaccountFile))); | 189 std::string(kLocalaccountFile))); |
| 191 return true; | |
| 192 } | 190 } |
| 193 | 191 |
| 194 bool ParallelAuthenticator::AuthenticateToUnlock(const std::string& username, | 192 bool ParallelAuthenticator::AuthenticateToUnlock(const std::string& username, |
| 195 const std::string& password) { | 193 const std::string& password) { |
| 196 current_state_.reset( | 194 current_state_.reset( |
| 197 new AuthAttemptState(Authenticator::Canonicalize(username), | 195 new AuthAttemptState(Authenticator::Canonicalize(username), |
| 198 HashPassword(password))); | 196 HashPassword(password))); |
| 199 BrowserThread::PostTask( | 197 BrowserThread::PostTask( |
| 200 BrowserThread::FILE, FROM_HERE, | 198 BrowserThread::FILE, FROM_HERE, |
| 201 NewRunnableMethod(this, | 199 NewRunnableMethod(this, |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 } | 804 } |
| 807 | 805 |
| 808 void ParallelAuthenticator::ResolveLoginCompletionStatus() { | 806 void ParallelAuthenticator::ResolveLoginCompletionStatus() { |
| 809 // Shortcut online state resolution process. | 807 // Shortcut online state resolution process. |
| 810 current_state_->RecordOnlineLoginStatus(GaiaAuthConsumer::ClientLoginResult(), | 808 current_state_->RecordOnlineLoginStatus(GaiaAuthConsumer::ClientLoginResult(), |
| 811 LoginFailure::None()); | 809 LoginFailure::None()); |
| 812 Resolve(); | 810 Resolve(); |
| 813 } | 811 } |
| 814 | 812 |
| 815 } // namespace chromeos | 813 } // namespace chromeos |
| OLD | NEW |