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" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/lock.h" | 12 #include "base/lock.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/sha2.h" | 15 #include "base/sha2.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "base/third_party/nss/blapi.h" | 17 #include "base/third_party/nss/blapi.h" |
18 #include "base/third_party/nss/sha256.h" | 18 #include "base/third_party/nss/sha256.h" |
19 #include "chrome/browser/browser_process.h" | |
20 #include "chrome/browser/browser_thread.h" | 19 #include "chrome/browser/browser_thread.h" |
21 #include "chrome/browser/chromeos/boot_times_loader.h" | 20 #include "chrome/browser/chromeos/boot_times_loader.h" |
22 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 21 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
23 #include "chrome/browser/chromeos/login/auth_response_handler.h" | 22 #include "chrome/browser/chromeos/login/auth_response_handler.h" |
24 #include "chrome/browser/chromeos/login/authentication_notification_details.h" | 23 #include "chrome/browser/chromeos/login/authentication_notification_details.h" |
25 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 24 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
26 #include "chrome/browser/chromeos/login/ownership_service.h" | 25 #include "chrome/browser/chromeos/login/ownership_service.h" |
27 #include "chrome/browser/chromeos/login/user_manager.h" | 26 #include "chrome/browser/chromeos/login/user_manager.h" |
28 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
29 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 return; | 197 return; |
199 } | 198 } |
200 BrowserThread::PostTask( | 199 BrowserThread::PostTask( |
201 BrowserThread::UI, FROM_HERE, | 200 BrowserThread::UI, FROM_HERE, |
202 NewRunnableMethod(this, | 201 NewRunnableMethod(this, |
203 &GoogleAuthenticator::OnLoginSuccess, | 202 &GoogleAuthenticator::OnLoginSuccess, |
204 credentials, false)); | 203 credentials, false)); |
205 } | 204 } |
206 | 205 |
207 void GoogleAuthenticator::OnClientLoginFailure( | 206 void GoogleAuthenticator::OnClientLoginFailure( |
208 const GoogleServiceAuthError& error) { | 207 const GoogleServiceAuthError& error) { |
209 | |
210 if (error.state() == GoogleServiceAuthError::REQUEST_CANCELED) { | 208 if (error.state() == GoogleServiceAuthError::REQUEST_CANCELED) { |
211 if (try_again_) { | 209 if (try_again_) { |
212 try_again_ = false; | 210 try_again_ = false; |
213 LOG(ERROR) << "Login attempt canceled!?!? Trying again."; | 211 LOG(ERROR) << "Login attempt canceled!?!? Trying again."; |
214 TryClientLogin(); | 212 TryClientLogin(); |
215 return; | 213 return; |
216 } | 214 } |
217 LOG(ERROR) << "Login attempt canceled again? Already retried..."; | 215 LOG(ERROR) << "Login attempt canceled again? Already retried..."; |
218 } | 216 } |
219 | 217 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 const unsigned int len) { | 480 const unsigned int len) { |
483 if (len < 2*binary_len) | 481 if (len < 2*binary_len) |
484 return false; | 482 return false; |
485 memset(hex_string, 0, len); | 483 memset(hex_string, 0, len); |
486 for (uint i = 0, j = 0; i < binary_len; i++, j+=2) | 484 for (uint i = 0, j = 0; i < binary_len; i++, j+=2) |
487 snprintf(hex_string + j, len - j, "%02x", binary[i]); | 485 snprintf(hex_string + j, len - j, "%02x", binary[i]); |
488 return true; | 486 return true; |
489 } | 487 } |
490 | 488 |
491 } // namespace chromeos | 489 } // namespace chromeos |
OLD | NEW |