| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> |
| 10 |
| 9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 10 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 12 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
| 11 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 13 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 12 #include "content/browser/webui/web_ui.h" | 14 #include "content/browser/webui/web_ui.h" |
| 13 | 15 |
| 14 namespace base { | 16 namespace base { |
| 15 class DictionaryValue; | 17 class DictionaryValue; |
| 16 class ListValue; | 18 class ListValue; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace chromeos { | 21 namespace chromeos { |
| 20 | 22 |
| 21 // An interface for WebUILoginDisplay to call SigninScreenHandler. | 23 // An interface for WebUILoginDisplay to call SigninScreenHandler. |
| 22 class LoginDisplayWebUIHandler { | 24 class LoginDisplayWebUIHandler { |
| 23 public: | 25 public: |
| 24 virtual void ClearAndEnablePassword() = 0; | 26 virtual void ClearAndEnablePassword() = 0; |
| 25 virtual void OnLoginSuccess(const std::string& username) = 0; | 27 virtual void OnLoginSuccess(const std::string& username) = 0; |
| 26 virtual void OnUserRemoved(const std::string& username) = 0; | 28 virtual void OnUserRemoved(const std::string& username) = 0; |
| 27 virtual void ShowError(int login_attempts, | 29 virtual void ShowError(int login_attempts, |
| 28 const std::string& error_text, | 30 const std::string& error_text, |
| 29 const std::string& help_link_text, | 31 const std::string& help_link_text, |
| 30 HelpAppLauncher::HelpTopic help_topic_id) = 0; | 32 HelpAppLauncher::HelpTopic help_topic_id) = 0; |
| 33 protected: |
| 34 virtual ~LoginDisplayWebUIHandler() {} |
| 31 }; | 35 }; |
| 32 | 36 |
| 33 // An interface for SigninScreenHandler to call WebUILoginDisplay. | 37 // An interface for SigninScreenHandler to call WebUILoginDisplay. |
| 34 class SigninScreenHandlerDelegate { | 38 class SigninScreenHandlerDelegate { |
| 35 public: | 39 public: |
| 36 // Confirms sign up by provided |username| and |password| specified. | 40 // Confirms sign up by provided |username| and |password| specified. |
| 37 // Used for new user login via GAIA extension. | 41 // Used for new user login via GAIA extension. |
| 38 virtual void CompleteLogin(const std::string& username, | 42 virtual void CompleteLogin(const std::string& username, |
| 39 const std::string& password) = 0; | 43 const std::string& password) = 0; |
| 40 | 44 |
| 41 // Sign in using |username| and |password| specified. | 45 // Sign in using |username| and |password| specified. |
| 42 // Used for both known and new users. | 46 // Used for both known and new users. |
| 43 virtual void Login(const std::string& username, | 47 virtual void Login(const std::string& username, |
| 44 const std::string& password) = 0; | 48 const std::string& password) = 0; |
| 45 | 49 |
| 46 // Sign in into Guest session. | 50 // Sign in into Guest session. |
| 47 virtual void LoginAsGuest() = 0; | 51 virtual void LoginAsGuest() = 0; |
| 48 | 52 |
| 53 // Create a new Google account. |
| 54 virtual void CreateAccount() = 0; |
| 55 |
| 49 // Attempts to remove given user. | 56 // Attempts to remove given user. |
| 50 virtual void RemoveUser(const std::string& username) = 0; | 57 virtual void RemoveUser(const std::string& username) = 0; |
| 51 | 58 |
| 52 // Shows Enterprise Enrollment screen. | 59 // Shows Enterprise Enrollment screen. |
| 53 virtual void ShowEnterpriseEnrollmentScreen() = 0; | 60 virtual void ShowEnterpriseEnrollmentScreen() = 0; |
| 54 | 61 |
| 55 // Let the delegate know about the handler it is supposed to be using. | 62 // Let the delegate know about the handler it is supposed to be using. |
| 56 virtual void SetWebUIHandler(LoginDisplayWebUIHandler* webui_handler) = 0; | 63 virtual void SetWebUIHandler(LoginDisplayWebUIHandler* webui_handler) = 0; |
| 64 |
| 65 protected: |
| 66 virtual ~SigninScreenHandlerDelegate() {} |
| 57 }; | 67 }; |
| 58 | 68 |
| 59 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay | 69 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay |
| 60 // and LoginDisplay. | 70 // and LoginDisplay. |
| 61 class SigninScreenHandler : public BaseScreenHandler, | 71 class SigninScreenHandler : public BaseScreenHandler, |
| 62 public LoginDisplayWebUIHandler { | 72 public LoginDisplayWebUIHandler { |
| 63 public: | 73 public: |
| 64 SigninScreenHandler(); | 74 SigninScreenHandler(); |
| 65 virtual ~SigninScreenHandler(); | 75 virtual ~SigninScreenHandler(); |
| 66 | 76 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 117 |
| 108 // Handles 'showAddUser' request to show proper sign-in screen. | 118 // Handles 'showAddUser' request to show proper sign-in screen. |
| 109 void HandleShowAddUser(const base::ListValue* args); | 119 void HandleShowAddUser(const base::ListValue* args); |
| 110 | 120 |
| 111 // Handles Enterprise Enrollment screen toggling. | 121 // Handles Enterprise Enrollment screen toggling. |
| 112 void HandleToggleEnrollmentScreen(const base::ListValue* args); | 122 void HandleToggleEnrollmentScreen(const base::ListValue* args); |
| 113 | 123 |
| 114 // Handles 'launchHelpApp' request. | 124 // Handles 'launchHelpApp' request. |
| 115 void HandleLaunchHelpApp(const base::ListValue* args); | 125 void HandleLaunchHelpApp(const base::ListValue* args); |
| 116 | 126 |
| 127 // Handle 'createAccount' request. |
| 128 void HandleCreateAccount(const base::ListValue* args); |
| 129 |
| 117 // Sends user list to account picker. | 130 // Sends user list to account picker. |
| 118 void SendUserList(bool animated); | 131 void SendUserList(bool animated); |
| 119 | 132 |
| 120 // A delegate that glues this handler with backend LoginDisplay. | 133 // A delegate that glues this handler with backend LoginDisplay. |
| 121 SigninScreenHandlerDelegate* delegate_; | 134 SigninScreenHandlerDelegate* delegate_; |
| 122 | 135 |
| 123 // Whether screen should be shown right after initialization. | 136 // Whether screen should be shown right after initialization. |
| 124 bool show_on_init_; | 137 bool show_on_init_; |
| 125 | 138 |
| 126 // Keeps whether screen should be shown for OOBE. | 139 // Keeps whether screen should be shown for OOBE. |
| 127 bool oobe_ui_; | 140 bool oobe_ui_; |
| 128 | 141 |
| 129 // True if new user sign in flow is driven by the extension. | 142 // True if new user sign in flow is driven by the extension. |
| 130 bool extension_driven_; | 143 bool extension_driven_; |
| 131 | 144 |
| 132 // Help application used for help dialogs. | 145 // Help application used for help dialogs. |
| 133 scoped_refptr<HelpAppLauncher> help_app_; | 146 scoped_refptr<HelpAppLauncher> help_app_; |
| 134 | 147 |
| 135 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); | 148 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); |
| 136 }; | 149 }; |
| 137 | 150 |
| 138 } // namespace chromeos | 151 } // namespace chromeos |
| 139 | 152 |
| 140 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ | 153 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ |
| OLD | NEW |