Index: chrome/browser/chromeos/login/auth/chrome_login_performer.h |
diff --git a/chrome/browser/chromeos/login/auth/login_performer.h b/chrome/browser/chromeos/login/auth/chrome_login_performer.h |
similarity index 26% |
copy from chrome/browser/chromeos/login/auth/login_performer.h |
copy to chrome/browser/chromeos/login/auth/chrome_login_performer.h |
index 00d6ace8ff9ee88253efcf8d2648e6b2b17f86e8..05f39372cdb2e42aeab0ffc4461c969290aa6a67 100644 |
--- a/chrome/browser/chromeos/login/auth/login_performer.h |
+++ b/chrome/browser/chromeos/login/auth/chrome_login_performer.h |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_LOGIN_PERFORMER_H_ |
-#define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_LOGIN_PERFORMER_H_ |
+#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_CHROME_LOGIN_PERFORMER_H_ |
+#define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_CHROME_LOGIN_PERFORMER_H_ |
#include <string> |
@@ -14,6 +14,7 @@ |
#include "chromeos/login/auth/auth_status_consumer.h" |
#include "chromeos/login/auth/authenticator.h" |
#include "chromeos/login/auth/extended_authenticator.h" |
+#include "chromeos/login/auth/login_performer.h" |
#include "chromeos/login/auth/online_attempt_host.h" |
#include "chromeos/login/auth/user_context.h" |
#include "content/public/browser/notification_observer.h" |
@@ -34,135 +35,50 @@ namespace chromeos { |
// If auth is succeeded, cookie fetcher is executed, LP instance deletes itself. |
// |
// If |delegate_| is not NULL it will handle error messages, password input. |
-class LoginPerformer : public AuthStatusConsumer, |
- public OnlineAttemptHost::Delegate { |
+class ChromeLoginPerformer : public LoginPerformer { |
public: |
- typedef enum AuthorizationMode { |
- // Authorization performed internally by Chrome. |
- AUTH_MODE_INTERNAL, |
- // Authorization performed by an extension. |
- AUTH_MODE_EXTENSION |
- } AuthorizationMode; |
- |
- // Delegate class to get notifications from the LoginPerformer. |
- class Delegate : public AuthStatusConsumer { |
- public: |
- virtual ~Delegate() {} |
- virtual void WhiteListCheckFailed(const std::string& email) = 0; |
- virtual void PolicyLoadFailed() = 0; |
- virtual void OnOnlineChecked(const std::string& email, bool success) = 0; |
- }; |
- |
- explicit LoginPerformer(Delegate* delegate); |
- virtual ~LoginPerformer(); |
- |
- // AuthStatusConsumer implementation: |
- virtual void OnAuthFailure(const AuthFailure& error) override; |
- virtual void OnRetailModeAuthSuccess( |
- const UserContext& user_context) override; |
- virtual void OnAuthSuccess(const UserContext& user_context) override; |
- virtual void OnOffTheRecordAuthSuccess() override; |
- virtual void OnPasswordChangeDetected() override; |
- |
- // Performs a login for |user_context|. |
- // If auth_mode is AUTH_MODE_EXTENSION, there are no further auth checks, |
- // AUTH_MODE_INTERNAL will perform auth checks. |
- void PerformLogin(const UserContext& user_context, |
- AuthorizationMode auth_mode); |
- |
- // Performs supervised user login with a given |user_context|. |
- void LoginAsSupervisedUser(const UserContext& user_context); |
- |
- // Performs retail mode login. |
- void LoginRetailMode(); |
- |
- // Performs actions to prepare guest mode login. |
- void LoginOffTheRecord(); |
- |
- // Performs public session login with a given |user_context|. |
- void LoginAsPublicSession(const UserContext& user_context); |
- |
- // Performs a login into the kiosk mode account with |app_user_id|. |
- void LoginAsKioskAccount(const std::string& app_user_id, |
- bool use_guest_mount); |
- |
- // Migrates cryptohome using |old_password| specified. |
- void RecoverEncryptedData(const std::string& old_password); |
- |
- // Reinitializes cryptohome with the new password. |
- void ResyncEncryptedData(); |
- |
- // Returns latest auth error. |
- const GoogleServiceAuthError& error() const { |
- return last_login_failure_.error(); |
- } |
- |
- // True if password change has been detected. |
- bool password_changed() { return password_changed_; } |
- |
- // Number of times we've been called with OnPasswordChangeDetected(). |
- // If user enters incorrect old password, same LoginPerformer instance will |
- // be called so callback count makes it possible to distinguish initial |
- // "password changed detected" event from further attempts to enter old |
- // password for cryptohome migration (when > 1). |
- int password_changed_callback_count() { |
- return password_changed_callback_count_; |
- } |
- |
- void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
- |
- AuthorizationMode auth_mode() const { return auth_mode_; } |
+ explicit ChromeLoginPerformer(Delegate* delegate); |
+ virtual ~ChromeLoginPerformer(); |
protected: |
- // Implements OnlineAttemptHost::Delegate. |
- virtual void OnChecked(const std::string& username, bool success) override; |
+ virtual bool RunTrustedCheck(const base::Closure& callback) OVERRIDE; |
+ void DidRunTrustedCheck(const base::Closure& callback); |
+ virtual bool IsUserWhitelisted(const std::string& username, |
+ bool* wildcard_match) OVERRIDE; |
- private: |
- // Starts login completion of externally authenticated user. |
- void StartLoginCompletion(); |
- |
- // Starts authentication. |
- void StartAuthentication(); |
- |
- // Completion callback for the online wildcard login check for enterprise |
- // devices. Continues the login process or signals whitelist check failure |
- // depending on the value of |result|. |
- void OnlineWildcardLoginCheckCompleted( |
- policy::WildcardLoginChecker::Result result); |
- |
- // Used for logging in. |
- scoped_refptr<Authenticator> authenticator_; |
- scoped_refptr<ExtendedAuthenticator> extended_authenticator_; |
+ virtual void RunOnlineWhitelistCheck( |
+ const std::string& username, |
+ bool wildcard_match, |
+ const base::Closure& success_callback, |
+ const base::Closure& failure_callback) OVERRIDE; |
+ virtual bool AreSupervisedUsersAllowed() OVERRIDE; |
- // Used to make auxiliary online check. |
- OnlineAttemptHost online_attempt_host_; |
+ virtual bool UseExtendedAuthenticatorForSupervisedUser( |
+ const UserContext& user_context) OVERRIDE; |
- // Represents last login failure that was encountered when communicating to |
- // sign-in server. AuthFailure.LoginFailureNone() by default. |
- AuthFailure last_login_failure_; |
+ virtual UserContext TransformSupervisedKey( |
+ const UserContext& context) OVERRIDE; |
- // User credentials for the current login attempt. |
- UserContext user_context_; |
+ virtual void SetupSupervisedUserFlow(const std::string& user_id) OVERRIDE; |
- // Notifications receiver. |
- Delegate* delegate_; |
+ virtual scoped_refptr<Authenticator> CreateAuthenticator() OVERRIDE; |
+ virtual bool CheckPolicyForUser(const std::string& username) OVERRIDE; |
+ virtual Profile* GetSigninProfile() OVERRIDE; |
+ virtual net::URLRequestContextGetter* GetSigninRequestContext() OVERRIDE; |
- // True if password change has been detected. |
- // Once correct password is entered homedir migration is executed. |
- bool password_changed_; |
- int password_changed_callback_count_; |
- |
- // Authorization mode type. |
- AuthorizationMode auth_mode_; |
+ private: |
+ void OnlineWildcardLoginCheckCompleted( |
+ const base::Closure& success_callback, |
+ const base::Closure& failure_callback, |
+ policy::WildcardLoginChecker::Result result); |
// Used to verify logins that matched wildcard on the login whitelist. |
scoped_ptr<policy::WildcardLoginChecker> wildcard_login_checker_; |
+ base::WeakPtrFactory<ChromeLoginPerformer> weak_factory_; |
- base::WeakPtrFactory<LoginPerformer> weak_factory_; |
- |
- DISALLOW_COPY_AND_ASSIGN(LoginPerformer); |
+ DISALLOW_COPY_AND_ASSIGN(ChromeLoginPerformer); |
}; |
} // namespace chromeos |
-#endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_LOGIN_PERFORMER_H_ |
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_CHROME_LOGIN_PERFORMER_H_ |