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 #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 "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class Authenticator : public base::RefCountedThreadSafe<Authenticator> { | 24 class Authenticator : public base::RefCountedThreadSafe<Authenticator> { |
25 public: | 25 public: |
26 // A domain which requires special-case parsing in canonicalization. | 26 // A domain which requires special-case parsing in canonicalization. |
27 static const char kSpecialCaseDomain[]; | 27 static const char kSpecialCaseDomain[]; |
28 | 28 |
29 explicit Authenticator(LoginStatusConsumer* consumer); | 29 explicit Authenticator(LoginStatusConsumer* consumer); |
30 virtual ~Authenticator(); | 30 virtual ~Authenticator(); |
31 | 31 |
32 // Given externally authenticated |username| and |password|, this method | 32 // Given externally authenticated |username| and |password|, this method |
33 // attempts to complete authentication process. | 33 // attempts to complete authentication process. |
34 // Returns true if the attempt gets sent successfully and false if not. | 34 virtual void CompleteLogin(Profile* profile, |
35 virtual bool CompleteLogin(Profile* profile, | |
36 const std::string& username, | 35 const std::string& username, |
37 const std::string& password) = 0; | 36 const std::string& password) = 0; |
38 | 37 |
39 // Given a |username| and |password|, this method attempts to authenticate | 38 // Given a |username| and |password|, this method attempts to authenticate |
40 // to login. | 39 // to login. |
41 // Optionally |login_token| and |login_captcha| could be provided. | 40 // Optionally |login_token| and |login_captcha| could be provided. |
42 // Returns true if we kick off the attempt successfully and false if we can't. | |
43 // Must be called on the UI thread. | 41 // Must be called on the UI thread. |
44 virtual bool AuthenticateToLogin(Profile* profile, | 42 virtual void AuthenticateToLogin(Profile* profile, |
45 const std::string& username, | 43 const std::string& username, |
46 const std::string& password, | 44 const std::string& password, |
47 const std::string& login_token, | 45 const std::string& login_token, |
48 const std::string& login_captcha) = 0; | 46 const std::string& login_captcha) = 0; |
49 | 47 |
50 // Given a |username| and |password|, this method attempts to | 48 // Given a |username| and |password|, this method attempts to |
51 // authenticate to unlock the computer. | 49 // authenticate to unlock the computer. |
52 // Returns true if we kick off the attempt successfully and false if | 50 // Must be called on the UI thread. |
53 // we can't. Must be called on the UI thread. | 51 virtual void AuthenticateToUnlock(const std::string& username, |
54 virtual bool AuthenticateToUnlock(const std::string& username, | |
55 const std::string& password) = 0; | 52 const std::string& password) = 0; |
56 | 53 |
57 // Initiates incognito ("browse without signing in") login. | 54 // Initiates incognito ("browse without signing in") login. |
58 virtual void LoginOffTheRecord() = 0; | 55 virtual void LoginOffTheRecord() = 0; |
59 | 56 |
60 // |credentials| are the tokens that we get back from the ClientLogin API. | 57 // |credentials| are the tokens that we get back from the ClientLogin API. |
61 // |request_pending| is true if we still plan to call consumer_ with the | 58 // |request_pending| is true if we still plan to call consumer_ with the |
62 // results of more requests. | 59 // results of more requests. |
63 // Must be called on the UI thread. | 60 // Must be called on the UI thread. |
64 virtual void OnLoginSuccess( | 61 virtual void OnLoginSuccess( |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 LoginStatusConsumer* consumer_; | 116 LoginStatusConsumer* consumer_; |
120 Profile* authentication_profile_; | 117 Profile* authentication_profile_; |
121 | 118 |
122 private: | 119 private: |
123 DISALLOW_COPY_AND_ASSIGN(Authenticator); | 120 DISALLOW_COPY_AND_ASSIGN(Authenticator); |
124 }; | 121 }; |
125 | 122 |
126 } // namespace chromeos | 123 } // namespace chromeos |
127 | 124 |
128 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ | 125 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTHENTICATOR_H_ |
OLD | NEW |