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 "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 10 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
11 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 11 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
12 #include "content/browser/webui/web_ui.h" | 12 #include "content/browser/webui/web_ui.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class DictionaryValue; | 15 class DictionaryValue; |
16 class ListValue; | 16 class ListValue; |
17 } | 17 } |
18 | 18 |
19 namespace chromeos { | 19 namespace chromeos { |
20 | 20 |
21 // An interface for WebUILoginDisplay to call SigninScreenHandler. | 21 // An interface for WebUILoginDisplay to call SigninScreenHandler. |
22 class LoginDisplayWebUIHandler { | 22 class LoginDisplayWebUIHandler { |
23 public: | 23 public: |
24 virtual void ClearAndEnablePassword() = 0; | 24 virtual void ClearAndEnablePassword() = 0; |
25 virtual void OnLoginSuccess(const std::string& username) = 0; | 25 virtual void OnLoginSuccess(const std::string& username) = 0; |
26 virtual void ShowError(const std::string& error_text, | 26 virtual void OnUserRemoved(const std::string& username) = 0; |
| 27 virtual void ShowError(int login_attempts, |
| 28 const std::string& error_text, |
27 const std::string& help_link_text, | 29 const std::string& help_link_text, |
28 HelpAppLauncher::HelpTopic help_topic_id) = 0; | 30 HelpAppLauncher::HelpTopic help_topic_id) = 0; |
29 }; | 31 }; |
30 | 32 |
31 // An interface for SigninScreenHandler to call WebUILoginDisplay. | 33 // An interface for SigninScreenHandler to call WebUILoginDisplay. |
32 class SigninScreenHandlerDelegate { | 34 class SigninScreenHandlerDelegate { |
33 public: | 35 public: |
34 // Confirms sign up by provided |username| and |password| specified. | 36 // Confirms sign up by provided |username| and |password| specified. |
35 // Used for new user login via GAIA extension. | 37 // Used for new user login via GAIA extension. |
36 virtual void CompleteLogin(const std::string& username, | 38 virtual void CompleteLogin(const std::string& username, |
37 const std::string& password) = 0; | 39 const std::string& password) = 0; |
38 | 40 |
39 // Sign in using |username| and |password| specified. | 41 // Sign in using |username| and |password| specified. |
40 // Used for both known and new users. | 42 // Used for both known and new users. |
41 virtual void Login(const std::string& username, | 43 virtual void Login(const std::string& username, |
42 const std::string& password) = 0; | 44 const std::string& password) = 0; |
43 | 45 |
44 // Sign in into Guest session. | 46 // Sign in into Guest session. |
45 virtual void LoginAsGuest() = 0; | 47 virtual void LoginAsGuest() = 0; |
46 | 48 |
| 49 // Attempts to remove given user. |
| 50 virtual void RemoveUser(const std::string& username) = 0; |
| 51 |
47 // Shows Enterprise Enrollment screen. | 52 // Shows Enterprise Enrollment screen. |
48 virtual void ShowEnterpriseEnrollmentScreen() = 0; | 53 virtual void ShowEnterpriseEnrollmentScreen() = 0; |
49 | 54 |
50 // Let the delegate know about the handler it is supposed to be using. | 55 // Let the delegate know about the handler it is supposed to be using. |
51 virtual void SetWebUIHandler(LoginDisplayWebUIHandler* webui_handler) = 0; | 56 virtual void SetWebUIHandler(LoginDisplayWebUIHandler* webui_handler) = 0; |
52 }; | 57 }; |
53 | 58 |
54 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay | 59 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay |
55 // and LoginDisplay. | 60 // and LoginDisplay. |
56 class SigninScreenHandler : public BaseScreenHandler, | 61 class SigninScreenHandler : public BaseScreenHandler, |
(...skipping 11 matching lines...) Expand all Loading... |
68 virtual void GetLocalizedStrings( | 73 virtual void GetLocalizedStrings( |
69 base::DictionaryValue* localized_strings) OVERRIDE; | 74 base::DictionaryValue* localized_strings) OVERRIDE; |
70 virtual void Initialize() OVERRIDE; | 75 virtual void Initialize() OVERRIDE; |
71 | 76 |
72 // WebUIMessageHandler implementation: | 77 // WebUIMessageHandler implementation: |
73 virtual void RegisterMessages() OVERRIDE; | 78 virtual void RegisterMessages() OVERRIDE; |
74 | 79 |
75 // BaseLoginUIHandler implementation. | 80 // BaseLoginUIHandler implementation. |
76 virtual void ClearAndEnablePassword() OVERRIDE; | 81 virtual void ClearAndEnablePassword() OVERRIDE; |
77 virtual void OnLoginSuccess(const std::string& username) OVERRIDE; | 82 virtual void OnLoginSuccess(const std::string& username) OVERRIDE; |
78 virtual void ShowError(const std::string& error_text, | 83 virtual void OnUserRemoved(const std::string& username) OVERRIDE; |
| 84 virtual void ShowError(int login_attempts, |
| 85 const std::string& error_text, |
79 const std::string& help_link_text, | 86 const std::string& help_link_text, |
80 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; | 87 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; |
81 | 88 |
82 // Handles confirmation message of user authentication that was performed by | 89 // Handles confirmation message of user authentication that was performed by |
83 // the authentication extension. | 90 // the authentication extension. |
84 void HandleCompleteLogin(const base::ListValue* args); | 91 void HandleCompleteLogin(const base::ListValue* args); |
85 | 92 |
86 // Handles get existing user list request when populating account picker. | 93 // Handles get existing user list request when populating account picker. |
87 void HandleGetUsers(const base::ListValue* args); | 94 void HandleGetUsers(const base::ListValue* args); |
88 | 95 |
(...skipping 12 matching lines...) Expand all Loading... |
101 // Handles 'showAddUser' request to show proper sign-in screen. | 108 // Handles 'showAddUser' request to show proper sign-in screen. |
102 void HandleShowAddUser(const base::ListValue* args); | 109 void HandleShowAddUser(const base::ListValue* args); |
103 | 110 |
104 // Handles Enterprise Enrollment screen toggling. | 111 // Handles Enterprise Enrollment screen toggling. |
105 void HandleToggleEnrollmentScreen(const base::ListValue* args); | 112 void HandleToggleEnrollmentScreen(const base::ListValue* args); |
106 | 113 |
107 // Handles 'launchHelpApp' request. | 114 // Handles 'launchHelpApp' request. |
108 void HandleLaunchHelpApp(const base::ListValue* args); | 115 void HandleLaunchHelpApp(const base::ListValue* args); |
109 | 116 |
110 // Sends user list to account picker. | 117 // Sends user list to account picker. |
111 void SendUserList(); | 118 void SendUserList(bool animated); |
112 | 119 |
113 // A delegate that glues this handler with backend LoginDisplay. | 120 // A delegate that glues this handler with backend LoginDisplay. |
114 SigninScreenHandlerDelegate* delegate_; | 121 SigninScreenHandlerDelegate* delegate_; |
115 | 122 |
116 // Whether screen should be shown right after initialization. | 123 // Whether screen should be shown right after initialization. |
117 bool show_on_init_; | 124 bool show_on_init_; |
118 | 125 |
119 // Keeps whether screen should be shown for OOBE. | 126 // Keeps whether screen should be shown for OOBE. |
120 bool oobe_ui_; | 127 bool oobe_ui_; |
121 | 128 |
122 // True if new user sign in flow is driven by the extension. | 129 // True if new user sign in flow is driven by the extension. |
123 bool extension_driven_; | 130 bool extension_driven_; |
124 | 131 |
125 // Help application used for help dialogs. | 132 // Help application used for help dialogs. |
126 scoped_refptr<HelpAppLauncher> help_app_; | 133 scoped_refptr<HelpAppLauncher> help_app_; |
127 | 134 |
128 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); | 135 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); |
129 }; | 136 }; |
130 | 137 |
131 } // namespace chromeos | 138 } // namespace chromeos |
132 | 139 |
133 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ | 140 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ |
OLD | NEW |