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_CHROME_LOGIN_PERFORMER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_CHROME_LOGIN_PERFORMER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_CHROME_LOGIN_PERFORMER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_CHROME_LOGIN_PERFORMER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.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 "chrome/browser/chromeos/policy/wildcard_login_checker.h" | 13 #include "chrome/browser/chromeos/policy/wildcard_login_checker.h" |
14 #include "chromeos/login/auth/auth_status_consumer.h" | 14 #include "chromeos/login/auth/auth_status_consumer.h" |
15 #include "chromeos/login/auth/authenticator.h" | 15 #include "chromeos/login/auth/authenticator.h" |
16 #include "chromeos/login/auth/extended_authenticator.h" | 16 #include "chromeos/login/auth/extended_authenticator.h" |
17 #include "chromeos/login/auth/login_performer.h" | 17 #include "chromeos/login/auth/login_performer.h" |
18 #include "chromeos/login/auth/online_attempt_host.h" | 18 #include "chromeos/login/auth/online_attempt_host.h" |
19 #include "chromeos/login/auth/user_context.h" | 19 #include "chromeos/login/auth/user_context.h" |
20 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
22 #include "google_apis/gaia/google_service_auth_error.h" | 22 #include "google_apis/gaia/google_service_auth_error.h" |
23 | 23 |
24 namespace policy { | 24 namespace policy { |
25 class WildcardLoginChecker; | 25 class WildcardLoginChecker; |
26 } | 26 } |
27 | 27 |
| 28 namespace user_manager { |
| 29 class UserID; |
| 30 } |
| 31 |
28 namespace chromeos { | 32 namespace chromeos { |
29 | 33 |
30 // This class implements chrome-specific elements of Login Performer. | 34 // This class implements chrome-specific elements of Login Performer. |
31 | 35 |
32 class ChromeLoginPerformer : public LoginPerformer { | 36 class ChromeLoginPerformer : public LoginPerformer { |
33 public: | 37 public: |
34 explicit ChromeLoginPerformer(Delegate* delegate); | 38 explicit ChromeLoginPerformer(Delegate* delegate); |
35 ~ChromeLoginPerformer() override; | 39 ~ChromeLoginPerformer() override; |
36 | 40 |
37 protected: | 41 protected: |
38 bool RunTrustedCheck(const base::Closure& callback) override; | 42 bool RunTrustedCheck(const base::Closure& callback) override; |
39 void DidRunTrustedCheck(const base::Closure& callback); | 43 void DidRunTrustedCheck(const base::Closure& callback); |
40 bool IsUserWhitelisted(const std::string& user_id, | 44 bool IsUserWhitelisted(const user_manager::UserID& user_id, |
41 bool* wildcard_match) override; | 45 bool* wildcard_match) override; |
42 | 46 |
43 void RunOnlineWhitelistCheck(const std::string& user_id, | 47 void RunOnlineWhitelistCheck(const user_manager::UserID& user_id, |
44 bool wildcard_match, | 48 bool wildcard_match, |
45 const std::string& refresh_token, | 49 const std::string& refresh_token, |
46 const base::Closure& success_callback, | 50 const base::Closure& success_callback, |
47 const base::Closure& failure_callback) override; | 51 const base::Closure& failure_callback) override; |
48 bool AreSupervisedUsersAllowed() override; | 52 bool AreSupervisedUsersAllowed() override; |
49 | 53 |
50 bool UseExtendedAuthenticatorForSupervisedUser( | 54 bool UseExtendedAuthenticatorForSupervisedUser( |
51 const UserContext& user_context) override; | 55 const UserContext& user_context) override; |
52 | 56 |
53 UserContext TransformSupervisedKey(const UserContext& context) override; | 57 UserContext TransformSupervisedKey(const UserContext& context) override; |
54 | 58 |
55 void SetupSupervisedUserFlow(const std::string& user_id) override; | 59 void SetupSupervisedUserFlow(const user_manager::UserID& user_id) override; |
56 | 60 |
57 void SetupEasyUnlockUserFlow(const std::string& user_id) override; | 61 void SetupEasyUnlockUserFlow(const user_manager::UserID& user_id) override; |
58 | 62 |
59 scoped_refptr<Authenticator> CreateAuthenticator() override; | 63 scoped_refptr<Authenticator> CreateAuthenticator() override; |
60 bool CheckPolicyForUser(const std::string& user_id) override; | 64 bool CheckPolicyForUser(const user_manager::UserID& user_id) override; |
61 content::BrowserContext* GetSigninContext() override; | 65 content::BrowserContext* GetSigninContext() override; |
62 net::URLRequestContextGetter* GetSigninRequestContext() override; | 66 net::URLRequestContextGetter* GetSigninRequestContext() override; |
63 | 67 |
64 private: | 68 private: |
65 void OnlineWildcardLoginCheckCompleted( | 69 void OnlineWildcardLoginCheckCompleted( |
66 const base::Closure& success_callback, | 70 const base::Closure& success_callback, |
67 const base::Closure& failure_callback, | 71 const base::Closure& failure_callback, |
68 policy::WildcardLoginChecker::Result result); | 72 policy::WildcardLoginChecker::Result result); |
69 | 73 |
70 // Used to verify logins that matched wildcard on the login whitelist. | 74 // Used to verify logins that matched wildcard on the login whitelist. |
71 scoped_ptr<policy::WildcardLoginChecker> wildcard_login_checker_; | 75 scoped_ptr<policy::WildcardLoginChecker> wildcard_login_checker_; |
72 base::WeakPtrFactory<ChromeLoginPerformer> weak_factory_; | 76 base::WeakPtrFactory<ChromeLoginPerformer> weak_factory_; |
73 | 77 |
74 DISALLOW_COPY_AND_ASSIGN(ChromeLoginPerformer); | 78 DISALLOW_COPY_AND_ASSIGN(ChromeLoginPerformer); |
75 }; | 79 }; |
76 | 80 |
77 } // namespace chromeos | 81 } // namespace chromeos |
78 | 82 |
79 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_CHROME_LOGIN_PERFORMER_H_ | 83 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_CHROME_LOGIN_PERFORMER_H_ |
OLD | NEW |