OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_AUTH_ONLINE_ATTEMPT_HOST_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 virtual void OnChecked(const std::string &username, bool success) = 0; | 29 virtual void OnChecked(const std::string &username, bool success) = 0; |
30 }; | 30 }; |
31 | 31 |
32 explicit OnlineAttemptHost(Delegate *delegate); | 32 explicit OnlineAttemptHost(Delegate *delegate); |
33 virtual ~OnlineAttemptHost(); | 33 virtual ~OnlineAttemptHost(); |
34 | 34 |
35 // Checks user credentials using an online attempt. Calls callback with the | 35 // Checks user credentials using an online attempt. Calls callback with the |
36 // check result (whether authentication was successful). Note, only one | 36 // check result (whether authentication was successful). Note, only one |
37 // checking at a time (the newest call stops the old one, if called with | 37 // checking at a time (the newest call stops the old one, if called with |
38 // another username and password combination). | 38 // another username and password combination). |
39 void Check(Profile* profile, | 39 void Check(Profile* profile, const UserContext& user_context); |
40 const UserContext& user_context); | |
41 | 40 |
42 // Resets the checking process. | 41 // Resets the checking process. |
43 void Reset(); | 42 void Reset(); |
44 | 43 |
45 // AuthAttemptStateResolver overrides. | 44 // AuthAttemptStateResolver overrides. |
46 // Executed on IO thread. | 45 // Executed on IO thread. |
47 virtual void Resolve() OVERRIDE; | 46 virtual void Resolve() OVERRIDE; |
48 | 47 |
49 // Does an actual resolve on UI thread. | 48 // Does an actual resolve on UI thread. |
50 void ResolveOnUIThread(bool success); | 49 void ResolveOnUIThread(bool success); |
51 | 50 |
52 private: | 51 private: |
53 Delegate* delegate_; | 52 Delegate* delegate_; |
54 std::string current_attempt_hash_; | 53 std::string current_attempt_hash_; |
55 std::string current_username_; | 54 std::string current_username_; |
56 scoped_ptr<OnlineAttempt> online_attempt_; | 55 scoped_ptr<OnlineAttempt> online_attempt_; |
57 scoped_ptr<AuthAttemptState> state_; | 56 scoped_ptr<AuthAttemptState> state_; |
58 base::WeakPtrFactory<OnlineAttemptHost> weak_ptr_factory_; | 57 base::WeakPtrFactory<OnlineAttemptHost> weak_ptr_factory_; |
59 | 58 |
60 DISALLOW_COPY_AND_ASSIGN(OnlineAttemptHost); | 59 DISALLOW_COPY_AND_ASSIGN(OnlineAttemptHost); |
61 }; | 60 }; |
62 | 61 |
63 } // namespace chromeos | 62 } // namespace chromeos |
64 | 63 |
65 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ | 64 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ |
66 | 65 |
OLD | NEW |