Chromium Code Reviews| 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/google_authenticator.h" | 5 #include "chrome/browser/chromeos/login/google_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 27 matching lines...) Expand all Loading... | |
| 38 using file_util::PathExists; | 38 using file_util::PathExists; |
| 39 using file_util::ReadFile; | 39 using file_util::ReadFile; |
| 40 using file_util::ReadFileToString; | 40 using file_util::ReadFileToString; |
| 41 | 41 |
| 42 namespace chromeos { | 42 namespace chromeos { |
| 43 | 43 |
| 44 // static | 44 // static |
| 45 const char GoogleAuthenticator::kLocalaccountFile[] = "localaccount"; | 45 const char GoogleAuthenticator::kLocalaccountFile[] = "localaccount"; |
| 46 | 46 |
| 47 // static | 47 // static |
| 48 const int GoogleAuthenticator::kClientLoginTimeoutMs = 5000; | 48 const int GoogleAuthenticator::kClientLoginTimeoutMs = 15000; |
|
Nikita (slow)
2010/07/27 10:06:57
Isn't 15s too much since we always have an option
| |
| 49 // static | 49 // static |
| 50 const int GoogleAuthenticator::kLocalaccountRetryIntervalMs = 20; | 50 const int GoogleAuthenticator::kLocalaccountRetryIntervalMs = 20; |
| 51 | 51 |
| 52 const int kPassHashLen = 32; | 52 const int kPassHashLen = 32; |
| 53 | 53 |
| 54 GoogleAuthenticator::GoogleAuthenticator(LoginStatusConsumer* consumer) | 54 GoogleAuthenticator::GoogleAuthenticator(LoginStatusConsumer* consumer) |
| 55 : Authenticator(consumer), | 55 : Authenticator(consumer), |
| 56 unlock_(false), | 56 unlock_(false), |
| 57 try_again_(true), | 57 try_again_(true), |
| 58 checked_for_localaccount_(false) { | 58 checked_for_localaccount_(false) { |
| 59 CHECK(chromeos::CrosLibrary::Get()->EnsureLoaded()); | 59 CHECK(chromeos::CrosLibrary::Get()->EnsureLoaded()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 GoogleAuthenticator::~GoogleAuthenticator() {} | 62 GoogleAuthenticator::~GoogleAuthenticator() {} |
| 63 | 63 |
| 64 void GoogleAuthenticator::CancelClientLogin() { | 64 void GoogleAuthenticator::CancelClientLogin() { |
| 65 if (gaia_authenticator_->HasPendingFetch()) { | 65 if (gaia_authenticator_->HasPendingFetch()) { |
| 66 gaia_authenticator_->CancelRequest(); | 66 gaia_authenticator_->CancelRequest(); |
| 67 OnLoginFailure("Login has timed out; please try again!"); | 67 CheckOffline("Login has timed out; please try again!"); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 void GoogleAuthenticator::TryClientLogin() { | 71 void GoogleAuthenticator::TryClientLogin() { |
| 72 gaia_authenticator_->StartClientLogin(username_, | 72 gaia_authenticator_->StartClientLogin(username_, |
| 73 password_, | 73 password_, |
| 74 GaiaAuthenticator2::kContactsService, | 74 GaiaAuthenticator2::kContactsService, |
| 75 login_token_, | 75 login_token_, |
| 76 login_captcha_); | 76 login_captcha_); |
| 77 ChromeThread::PostDelayedTask( | 77 ChromeThread::PostDelayedTask( |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 DCHECK_EQ(parts.size(), 2U) << "email_address should have only one @"; | 422 DCHECK_EQ(parts.size(), 2U) << "email_address should have only one @"; |
| 423 RemoveChars(parts[0], ".", &parts[0]); | 423 RemoveChars(parts[0], ".", &parts[0]); |
| 424 if (parts[0].find('+') != std::string::npos) | 424 if (parts[0].find('+') != std::string::npos) |
| 425 parts[0].erase(parts[0].find('+')); | 425 parts[0].erase(parts[0].find('+')); |
| 426 std::string new_email = StringToLowerASCII(JoinString(parts, at)); | 426 std::string new_email = StringToLowerASCII(JoinString(parts, at)); |
| 427 LOG(INFO) << "Canonicalized " << email_address << " to " << new_email; | 427 LOG(INFO) << "Canonicalized " << email_address << " to " << new_email; |
| 428 return new_email; | 428 return new_email; |
| 429 } | 429 } |
| 430 | 430 |
| 431 } // namespace chromeos | 431 } // namespace chromeos |
| OLD | NEW |