Chromium Code Reviews| 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 // Let the delegate know about the handler it is supposed to be using. | |
| 33 virtual void SetWebUIHandler(LoginDisplayWebUIHandler* webui_handler) = 0; | |
|
Nikita (slow)
2011/07/15 18:52:07
nit: move after LoginAsGuest() so that methods are
xiyuan
2011/07/15 20:38:29
Done.
| |
| 34 | |
| 35 // Sign in using |username| and |password| specified. | |
| 36 // Used for both known and new users. | |
| 37 virtual void Login(const std::string& username, | |
| 38 const std::string& password) = 0; | |
| 39 | |
| 40 // Sign in into Guest session. | |
| 41 virtual void LoginAsGuest() = 0; | |
| 42 }; | |
| 43 | |
| 44 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay | |
| 45 // and LoginDisplay. | |
| 46 class SigninScreenHandler : public BaseScreenHandler, | |
| 47 public LoginDisplayWebUIHandler { | |
| 23 public: | 48 public: |
| 24 SigninScreenHandler(); | 49 SigninScreenHandler(); |
| 25 | 50 |
| 26 // Shows the sign in screen. | 51 // Shows the sign in screen. |
| 27 void Show(); | 52 void Show(); |
| 28 | 53 |
| 29 private: | 54 private: |
| 30 // OobeMessageHandler implementation: | 55 // BaseScreenHandler implementation: |
| 31 virtual void GetLocalizedStrings( | 56 virtual void GetLocalizedStrings( |
| 32 base::DictionaryValue* localized_strings) OVERRIDE; | 57 base::DictionaryValue* localized_strings) OVERRIDE; |
| 33 virtual void Initialize() OVERRIDE; | 58 virtual void Initialize() OVERRIDE; |
| 34 | 59 |
| 35 // WebUIMessageHandler implementation: | 60 // WebUIMessageHandler implementation: |
| 36 virtual void RegisterMessages() OVERRIDE; | 61 virtual void RegisterMessages() OVERRIDE; |
| 37 | 62 |
| 38 // BaseLoginUIHandler implementation. | 63 // BaseLoginUIHandler implementation. |
| 39 virtual void ClearAndEnablePassword() OVERRIDE; | 64 virtual void ClearAndEnablePassword() OVERRIDE; |
| 40 virtual void ShowError(const std::string& error_text, | 65 virtual void ShowError(const std::string& error_text, |
| 41 const std::string& help_link_text, | 66 const std::string& help_link_text, |
| 42 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; | 67 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; |
| 43 | 68 |
| 44 // Handles authenticate user request from javascript. | 69 // Callbacks from javascript. |
| 70 void HandleGetUsers(const base::ListValue* args); | |
| 45 void HandleAuthenticateUser(const base::ListValue* args); | 71 void HandleAuthenticateUser(const base::ListValue* args); |
| 72 void HandleLaunchIncognito(const base::ListValue* args); | |
| 73 void HandleShutdownSystem(const base::ListValue* args); | |
| 74 void HandleRemoveUser(const base::ListValue* args); | |
| 46 | 75 |
| 47 // A delegate that glues this handler with backend LoginDisplay. | 76 // A delegate that glues this handler with backend LoginDisplay. |
| 48 LoginUIHandlerDelegate* delegate_; | 77 SigninScreenHandlerDelegate* delegate_; |
| 49 | 78 |
| 50 // Keeps whether screen should be shown right after initialization. | 79 // Whether screen should be shown right after initialization. |
| 51 bool show_on_init_; | 80 bool show_on_init_; |
| 52 | 81 |
| 53 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); | 82 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); |
| 54 }; | 83 }; |
| 55 | 84 |
| 56 } // namespae chromeoc | 85 } // namespae chromeoc |
| 57 | 86 |
| 58 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ | 87 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ |
| OLD | NEW |