| 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 "chrome/browser/ui/webui/chromeos/login/login_ui.h" | 9 #include "chrome/browser/ui/webui/chromeos/login/login_ui.h" |
| 10 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 10 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 11 #include "content/browser/webui/web_ui.h" | 11 #include "content/browser/webui/web_ui.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class DictionaryValue; | 14 class DictionaryValue; |
| 15 class ListValue; | 15 class ListValue; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace chromeos { | 18 namespace chromeos { |
| 19 | 19 |
| 20 // Signin screen handler. | 20 // An interface for WebUILoginDisplay to call SigninScreenHandler. |
| 21 class SigninScreenHandler : public OobeMessageHandler, | 21 class LoginDisplayWebUIHandler { |
| 22 public BaseLoginUIHandler { | 22 public: |
| 23 virtual void ClearAndEnablePassword() = 0; |
| 24 virtual void ShowError(const std::string& error_text, |
| 25 const std::string& help_link_text, |
| 26 HelpAppLauncher::HelpTopic help_topic_id) = 0; |
| 27 }; |
| 28 |
| 29 // An interface for SigninScreenHandler to call WebUILoginDisplay. |
| 30 class SigninScreenHandlerDelegate { |
| 31 public: |
| 32 // Confirms sign up by provided |username| and |password| specified. |
| 33 // Used for new user login via GAIA extension. |
| 34 virtual void CompleteLogin(const std::string& username, |
| 35 const std::string& password) = 0; |
| 36 |
| 37 // Sign in using |username| and |password| specified. |
| 38 // Used for both known and new users. |
| 39 virtual void Login(const std::string& username, |
| 40 const std::string& password) = 0; |
| 41 |
| 42 // Sign in into Guest session. |
| 43 virtual void LoginAsGuest() = 0; |
| 44 |
| 45 // Let the delegate know about the handler it is supposed to be using. |
| 46 virtual void SetWebUIHandler(LoginDisplayWebUIHandler* webui_handler) = 0; |
| 47 }; |
| 48 |
| 49 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay |
| 50 // and LoginDisplay. |
| 51 class SigninScreenHandler : public BaseScreenHandler, |
| 52 public LoginDisplayWebUIHandler { |
| 23 public: | 53 public: |
| 24 SigninScreenHandler(); | 54 SigninScreenHandler(); |
| 25 | 55 |
| 26 // Shows the sign in screen. | 56 // Shows the sign in screen. |
| 27 void Show(); | 57 void Show(); |
| 28 | 58 |
| 29 private: | 59 private: |
| 30 // OobeMessageHandler implementation: | 60 // BaseScreenHandler implementation: |
| 31 virtual void GetLocalizedStrings( | 61 virtual void GetLocalizedStrings( |
| 32 base::DictionaryValue* localized_strings) OVERRIDE; | 62 base::DictionaryValue* localized_strings) OVERRIDE; |
| 33 virtual void Initialize() OVERRIDE; | 63 virtual void Initialize() OVERRIDE; |
| 34 | 64 |
| 35 // WebUIMessageHandler implementation: | 65 // WebUIMessageHandler implementation: |
| 36 virtual void RegisterMessages() OVERRIDE; | 66 virtual void RegisterMessages() OVERRIDE; |
| 37 | 67 |
| 38 // BaseLoginUIHandler implementation. | 68 // BaseLoginUIHandler implementation. |
| 39 virtual void ClearAndEnablePassword() OVERRIDE; | 69 virtual void ClearAndEnablePassword() OVERRIDE; |
| 40 virtual void ShowError(const std::string& error_text, | 70 virtual void ShowError(const std::string& error_text, |
| 41 const std::string& help_link_text, | 71 const std::string& help_link_text, |
| 42 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; | 72 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; |
| 43 | 73 |
| 44 // Handles confirmation message of user authentication that was performed by | 74 // Handles confirmation message of user authentication that was performed by |
| 45 // the authentication extension. | 75 // the authentication extension. |
| 46 void HandleCompleteLogin(const base::ListValue* args); | 76 void HandleCompleteLogin(const base::ListValue* args); |
| 47 // Handles authenticate user request from javascript. | 77 |
| 78 // Handles get existing user list request when populating account picker. |
| 79 void HandleGetUsers(const base::ListValue* args); |
| 80 |
| 81 // Handles authentication request when signing in an existing user. |
| 48 void HandleAuthenticateUser(const base::ListValue* args); | 82 void HandleAuthenticateUser(const base::ListValue* args); |
| 49 | 83 |
| 84 // Handles entering bwsi mode request. |
| 85 void HandleLaunchIncognito(const base::ListValue* args); |
| 86 |
| 87 // Handles system shutdown request. |
| 88 void HandleShutdownSystem(const base::ListValue* args); |
| 89 |
| 90 // Handles remove user request. |
| 91 void HandleRemoveUser(const base::ListValue* args); |
| 92 |
| 50 // A delegate that glues this handler with backend LoginDisplay. | 93 // A delegate that glues this handler with backend LoginDisplay. |
| 51 LoginUIHandlerDelegate* delegate_; | 94 SigninScreenHandlerDelegate* delegate_; |
| 52 | 95 |
| 53 // Keeps whether screen should be shown right after initialization. | 96 // Whether screen should be shown right after initialization. |
| 54 bool show_on_init_; | 97 bool show_on_init_; |
| 55 | 98 |
| 56 // True if new user sign in flow is driven by the extension. | 99 // True if new user sign in flow is driven by the extension. |
| 57 bool extension_driven_; | 100 bool extension_driven_; |
| 58 | 101 |
| 59 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); | 102 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); |
| 60 }; | 103 }; |
| 61 | 104 |
| 62 } // namespae chromeoc | 105 } // namespae chromeoc |
| 63 | 106 |
| 64 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ | 107 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ |
| OLD | NEW |