| 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 CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ | 6 #define 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "chromeos/chromeos_export.h" |
| 13 #include "chromeos/login/auth/auth_attempt_state_resolver.h" | 14 #include "chromeos/login/auth/auth_attempt_state_resolver.h" |
| 14 #include "chromeos/login/auth/user_context.h" | 15 #include "chromeos/login/auth/user_context.h" |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 class BrowserContext; | 18 class BrowserContext; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace chromeos { | 21 namespace chromeos { |
| 21 | 22 |
| 22 class AuthAttemptState; | 23 class AuthAttemptState; |
| 23 class OnlineAttempt; | 24 class OnlineAttempt; |
| 24 class UserContext; | 25 class UserContext; |
| 25 | 26 |
| 26 // Helper class which hosts OnlineAttempt for online credentials checking. | 27 // Helper class which hosts OnlineAttempt for online credentials checking. |
| 27 class OnlineAttemptHost : public AuthAttemptStateResolver { | 28 class CHROMEOS_EXPORT OnlineAttemptHost : public AuthAttemptStateResolver { |
| 28 public: | 29 public: |
| 29 class Delegate { | 30 class Delegate { |
| 30 public: | 31 public: |
| 31 // Called after user_context were checked online. | 32 // Called after user_context were checked online. |
| 32 virtual void OnChecked(const std::string& username, bool success) = 0; | 33 virtual void OnChecked(const std::string& username, bool success) = 0; |
| 33 }; | 34 }; |
| 34 | 35 |
| 35 explicit OnlineAttemptHost(Delegate *delegate); | 36 explicit OnlineAttemptHost(Delegate* delegate); |
| 36 virtual ~OnlineAttemptHost(); | 37 virtual ~OnlineAttemptHost(); |
| 37 | 38 |
| 38 // Performs an online check of the credentials in |user_context| and invokes | 39 // Performs an online check of the credentials in |user_context| and invokes |
| 39 // the delegate's OnChecked() with the result. Note that only one check can be | 40 // the delegate's OnChecked() with the result. Note that only one check can be |
| 40 // in progress at any given time. If this method is invoked with a different | 41 // in progress at any given time. If this method is invoked with a different |
| 41 // |user_context| than a check currently in progress, the current check will | 42 // |user_context| than a check currently in progress, the current check will |
| 42 // be silently aborted. | 43 // be silently aborted. |
| 43 void Check(content::BrowserContext* auth_context, | 44 void Check(content::BrowserContext* auth_context, |
| 44 const UserContext& user_context); | 45 const UserContext& user_context); |
| 45 | 46 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 58 UserContext current_attempt_user_context_; | 59 UserContext current_attempt_user_context_; |
| 59 scoped_ptr<OnlineAttempt> online_attempt_; | 60 scoped_ptr<OnlineAttempt> online_attempt_; |
| 60 scoped_ptr<AuthAttemptState> state_; | 61 scoped_ptr<AuthAttemptState> state_; |
| 61 base::WeakPtrFactory<OnlineAttemptHost> weak_ptr_factory_; | 62 base::WeakPtrFactory<OnlineAttemptHost> weak_ptr_factory_; |
| 62 | 63 |
| 63 DISALLOW_COPY_AND_ASSIGN(OnlineAttemptHost); | 64 DISALLOW_COPY_AND_ASSIGN(OnlineAttemptHost); |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 } // namespace chromeos | 67 } // namespace chromeos |
| 67 | 68 |
| 68 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ | 69 #endif // CHROMEOS_LOGIN_AUTH_ONLINE_ATTEMPT_HOST_H_ |
| 69 | |
| OLD | NEW |