| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 13 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
| 14 #include "chrome/common/net/gaia/gaia_auth_consumer.h" | 14 #include "chrome/common/net/gaia/gaia_auth_consumer.h" |
| 15 | 15 |
| 16 class Profile; | 16 class Profile; |
| 17 | 17 |
| 18 namespace chromeos { | 18 namespace chromeos { |
| 19 | 19 |
| 20 // An interface for objects that will authenticate a Chromium OS user. | 20 // An interface for objects that will authenticate a Chromium OS user. |
| 21 // When authentication successfully completes, will call | 21 // When authentication successfully completes, will call |
| 22 // consumer_->OnLoginSuccess() on the UI thread. | 22 // consumer_->OnLoginSuccess() on the UI thread. |
| 23 // On failure, will call consumer_->OnLoginFailure() on the UI thread. | 23 // On failure, will call consumer_->OnLoginFailure() on the UI thread. |
| 24 // On password change detected, will call | 24 // On password change detected, will call |
| 25 // consumer_->OnPasswordChangeDetected() on the UI thread. | 25 // consumer_->OnPasswordChangeDetected() on the UI thread. |
| 26 class Authenticator : public base::RefCountedThreadSafe<Authenticator> { | 26 class Authenticator : public base::RefCountedThreadSafe<Authenticator> { |
| 27 public: | 27 public: |
| 28 explicit Authenticator(LoginStatusConsumer* consumer); | 28 explicit Authenticator(LoginStatusConsumer* consumer); |
| 29 virtual ~Authenticator(); | |
| 30 | 29 |
| 31 // Given externally authenticated |username| and |password|, this method | 30 // Given externally authenticated |username| and |password|, this method |
| 32 // attempts to complete authentication process. | 31 // attempts to complete authentication process. |
| 33 virtual void CompleteLogin(Profile* profile, | 32 virtual void CompleteLogin(Profile* profile, |
| 34 const std::string& username, | 33 const std::string& username, |
| 35 const std::string& password) = 0; | 34 const std::string& password) = 0; |
| 36 | 35 |
| 37 // Given a |username| and |password|, this method attempts to authenticate | 36 // Given a |username| and |password|, this method attempts to authenticate |
| 38 // to login. | 37 // to login. |
| 39 // Optionally |login_token| and |login_captcha| could be provided. | 38 // Optionally |login_token| and |login_captcha| could be provided. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 const std::string& username, | 85 const std::string& username, |
| 87 const std::string& password, | 86 const std::string& password, |
| 88 const std::string& login_token, | 87 const std::string& login_token, |
| 89 const std::string& login_captcha) = 0; | 88 const std::string& login_captcha) = 0; |
| 90 | 89 |
| 91 // Profile (usually off the record ) that was used to perform the last | 90 // Profile (usually off the record ) that was used to perform the last |
| 92 // authentication process. | 91 // authentication process. |
| 93 Profile* authentication_profile() { return authentication_profile_; } | 92 Profile* authentication_profile() { return authentication_profile_; } |
| 94 | 93 |
| 95 protected: | 94 protected: |
| 95 virtual ~Authenticator(); |
| 96 |
| 96 LoginStatusConsumer* consumer_; | 97 LoginStatusConsumer* consumer_; |
| 97 Profile* authentication_profile_; | 98 Profile* authentication_profile_; |
| 98 | 99 |
| 99 private: | 100 private: |
| 101 friend class base::RefCountedThreadSafe<Authenticator>; |
| 102 |
| 100 DISALLOW_COPY_AND_ASSIGN(Authenticator); | 103 DISALLOW_COPY_AND_ASSIGN(Authenticator); |
| 101 }; | 104 }; |
| 102 | 105 |
| 103 } // namespace chromeos | 106 } // namespace chromeos |
| 104 | 107 |
| 105 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ | 108 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ |
| OLD | NEW |