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 #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 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // On failure, will call consumer_->OnLoginFailure() on the UI thread. | 22 // On failure, will call consumer_->OnLoginFailure() on the UI thread. |
23 class Authenticator : public base::RefCountedThreadSafe<Authenticator> { | 23 class Authenticator : public base::RefCountedThreadSafe<Authenticator> { |
24 public: | 24 public: |
25 explicit Authenticator(LoginStatusConsumer* consumer) | 25 explicit Authenticator(LoginStatusConsumer* consumer) |
26 : consumer_(consumer) { | 26 : consumer_(consumer) { |
27 } | 27 } |
28 virtual ~Authenticator() {} | 28 virtual ~Authenticator() {} |
29 | 29 |
30 // Given a |username| and |password|, this method attempts to authenticate | 30 // Given a |username| and |password|, this method attempts to authenticate |
31 // to login. | 31 // to login. |
| 32 // Optionally |login_token| and |login_captcha| could be provided. |
32 // Returns true if we kick off the attempt successfully and false if we can't. | 33 // Returns true if we kick off the attempt successfully and false if we can't. |
33 // Must be called on the FILE thread. | 34 // Must be called on the FILE thread. |
34 virtual bool AuthenticateToLogin(Profile* profile, | 35 virtual bool AuthenticateToLogin(Profile* profile, |
35 const std::string& username, | 36 const std::string& username, |
36 const std::string& password) = 0; | 37 const std::string& password, |
| 38 const std::string& login_token, |
| 39 const std::string& login_captcha) = 0; |
37 | 40 |
38 // Given a |username| and |password|, this method attempts to | 41 // Given a |username| and |password|, this method attempts to |
39 // authenticate to unlock the computer. | 42 // authenticate to unlock the computer. |
40 // Returns true if we kick off the attempt successfully and false if | 43 // Returns true if we kick off the attempt successfully and false if |
41 // we can't. Must be called on the FILE thread. | 44 // we can't. Must be called on the FILE thread. |
42 virtual bool AuthenticateToUnlock(const std::string& username, | 45 virtual bool AuthenticateToUnlock(const std::string& username, |
43 const std::string& password) = 0; | 46 const std::string& password) = 0; |
44 | 47 |
45 // Initiates off the record ("browse without signing in") login. | 48 // Initiates off the record ("browse without signing in") login. |
46 virtual void LoginOffTheRecord() = 0; | 49 virtual void LoginOffTheRecord() = 0; |
47 | 50 |
48 // These methods must be called on the UI thread, as they make DBus calls | 51 // These methods must be called on the UI thread, as they make DBus calls |
49 // and also call back to the login UI. | 52 // and also call back to the login UI. |
50 virtual void OnLoginSuccess(const std::string& credentials) = 0; | 53 virtual void OnLoginSuccess(const std::string& credentials) = 0; |
51 virtual void OnLoginFailure(const std::string& data) = 0; | 54 virtual void OnLoginFailure(const std::string& data) = 0; |
52 | 55 |
53 protected: | 56 protected: |
54 LoginStatusConsumer* consumer_; | 57 LoginStatusConsumer* consumer_; |
55 | 58 |
56 private: | 59 private: |
57 DISALLOW_COPY_AND_ASSIGN(Authenticator); | 60 DISALLOW_COPY_AND_ASSIGN(Authenticator); |
58 }; | 61 }; |
59 | 62 |
60 } // namespace chromeos | 63 } // namespace chromeos |
61 | 64 |
62 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ | 65 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ |
OLD | NEW |