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/online_attempt_host.h"
19 #include "chromeos/login/auth/user_context.h"
20 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h"
22 #include "google_apis/gaia/google_service_auth_error.h"
25 class WildcardLoginChecker
;
30 // This class implements chrome-specific elements of Login Performer.
32 class ChromeLoginPerformer
: public LoginPerformer
{
34 explicit ChromeLoginPerformer(Delegate
* delegate
);
35 ~ChromeLoginPerformer() override
;
37 bool IsUserWhitelisted(const std::string
& user_id
,
38 bool* wildcard_match
) override
;
41 bool RunTrustedCheck(const base::Closure
& callback
) override
;
42 void DidRunTrustedCheck(const base::Closure
& callback
);
44 void RunOnlineWhitelistCheck(const std::string
& user_id
,
46 const std::string
& refresh_token
,
47 const base::Closure
& success_callback
,
48 const base::Closure
& failure_callback
) override
;
49 bool AreSupervisedUsersAllowed() override
;
51 bool UseExtendedAuthenticatorForSupervisedUser(
52 const UserContext
& user_context
) override
;
54 UserContext
TransformSupervisedKey(const UserContext
& context
) override
;
56 void SetupSupervisedUserFlow(const std::string
& user_id
) override
;
58 void SetupEasyUnlockUserFlow(const std::string
& user_id
) override
;
60 scoped_refptr
<Authenticator
> CreateAuthenticator() override
;
61 bool CheckPolicyForUser(const std::string
& user_id
) override
;
62 content::BrowserContext
* GetSigninContext() override
;
63 net::URLRequestContextGetter
* GetSigninRequestContext() override
;
66 void OnlineWildcardLoginCheckCompleted(
67 const base::Closure
& success_callback
,
68 const base::Closure
& failure_callback
,
69 policy::WildcardLoginChecker::Result result
);
71 // Used to verify logins that matched wildcard on the login whitelist.
72 scoped_ptr
<policy::WildcardLoginChecker
> wildcard_login_checker_
;
73 base::WeakPtrFactory
<ChromeLoginPerformer
> weak_factory_
;
75 DISALLOW_COPY_AND_ASSIGN(ChromeLoginPerformer
);
78 } // namespace chromeos
80 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_CHROME_LOGIN_PERFORMER_H_