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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_CHROME_LOGIN_PERFORMER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_CHROME_LOGIN_PERFORMER_H_
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/chromeos/policy/wildcard_login_checker.h"
14 #include "chromeos/login/auth/auth_status_consumer.h"
15 #include "chromeos/login/auth/authenticator.h"
16 #include "chromeos/login/auth/extended_authenticator.h"
17 #include "chromeos/login/auth/login_performer.h"
18 #include "chromeos/login/auth/user_context.h"
19 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h"
21 #include "google_apis/gaia/google_service_auth_error.h"
24 class WildcardLoginChecker
;
29 // This class implements chrome-specific elements of Login Performer.
31 class ChromeLoginPerformer
: public LoginPerformer
{
33 explicit ChromeLoginPerformer(Delegate
* delegate
);
34 ~ChromeLoginPerformer() override
;
36 bool IsUserWhitelisted(const std::string
& user_id
,
37 bool* wildcard_match
) override
;
40 bool RunTrustedCheck(const base::Closure
& callback
) override
;
41 void DidRunTrustedCheck(const base::Closure
& callback
);
43 void RunOnlineWhitelistCheck(const std::string
& user_id
,
45 const std::string
& refresh_token
,
46 const base::Closure
& success_callback
,
47 const base::Closure
& failure_callback
) override
;
48 bool AreSupervisedUsersAllowed() override
;
50 bool UseExtendedAuthenticatorForSupervisedUser(
51 const UserContext
& user_context
) override
;
53 UserContext
TransformSupervisedKey(const UserContext
& context
) override
;
55 void SetupSupervisedUserFlow(const std::string
& user_id
) override
;
57 void SetupEasyUnlockUserFlow(const std::string
& user_id
) override
;
59 scoped_refptr
<Authenticator
> CreateAuthenticator() override
;
60 bool CheckPolicyForUser(const std::string
& user_id
) override
;
61 content::BrowserContext
* GetSigninContext() override
;
62 net::URLRequestContextGetter
* GetSigninRequestContext() override
;
65 void OnlineWildcardLoginCheckCompleted(
66 const base::Closure
& success_callback
,
67 const base::Closure
& failure_callback
,
68 policy::WildcardLoginChecker::Result result
);
70 // Used to verify logins that matched wildcard on the login whitelist.
71 scoped_ptr
<policy::WildcardLoginChecker
> wildcard_login_checker_
;
72 base::WeakPtrFactory
<ChromeLoginPerformer
> weak_factory_
;
74 DISALLOW_COPY_AND_ASSIGN(ChromeLoginPerformer
);
77 } // namespace chromeos
79 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_CHROME_LOGIN_PERFORMER_H_