| 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> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "chrome/browser/browsing_data_remover.h" |
| 12 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 13 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
| 13 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 14 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 14 #include "content/browser/webui/web_ui.h" | 15 #include "content/browser/webui/web_ui.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class DictionaryValue; | 18 class DictionaryValue; |
| 18 class ListValue; | 19 class ListValue; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace chromeos { | 22 namespace chromeos { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // Let the delegate know about the handler it is supposed to be using. | 63 // Let the delegate know about the handler it is supposed to be using. |
| 63 virtual void SetWebUIHandler(LoginDisplayWebUIHandler* webui_handler) = 0; | 64 virtual void SetWebUIHandler(LoginDisplayWebUIHandler* webui_handler) = 0; |
| 64 | 65 |
| 65 protected: | 66 protected: |
| 66 virtual ~SigninScreenHandlerDelegate() {} | 67 virtual ~SigninScreenHandlerDelegate() {} |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay | 70 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay |
| 70 // and LoginDisplay. | 71 // and LoginDisplay. |
| 71 class SigninScreenHandler : public BaseScreenHandler, | 72 class SigninScreenHandler : public BaseScreenHandler, |
| 72 public LoginDisplayWebUIHandler { | 73 public LoginDisplayWebUIHandler, |
| 74 public BrowsingDataRemover::Observer { |
| 73 public: | 75 public: |
| 74 SigninScreenHandler(); | 76 SigninScreenHandler(); |
| 75 virtual ~SigninScreenHandler(); | 77 virtual ~SigninScreenHandler(); |
| 76 | 78 |
| 77 // Shows the sign in screen. |oobe_ui| indicates whether the signin | 79 // Shows the sign in screen. |oobe_ui| indicates whether the signin |
| 78 // screen is for OOBE or usual sign-in flow. | 80 // screen is for OOBE or usual sign-in flow. |
| 79 void Show(bool oobe_ui); | 81 void Show(bool oobe_ui); |
| 80 | 82 |
| 81 private: | 83 private: |
| 82 // BaseScreenHandler implementation: | 84 // BaseScreenHandler implementation: |
| 83 virtual void GetLocalizedStrings( | 85 virtual void GetLocalizedStrings( |
| 84 base::DictionaryValue* localized_strings) OVERRIDE; | 86 base::DictionaryValue* localized_strings) OVERRIDE; |
| 85 virtual void Initialize() OVERRIDE; | 87 virtual void Initialize() OVERRIDE; |
| 86 | 88 |
| 87 // WebUIMessageHandler implementation: | 89 // WebUIMessageHandler implementation: |
| 88 virtual void RegisterMessages() OVERRIDE; | 90 virtual void RegisterMessages() OVERRIDE; |
| 89 | 91 |
| 90 // BaseLoginUIHandler implementation. | 92 // BaseLoginUIHandler implementation. |
| 91 virtual void ClearAndEnablePassword() OVERRIDE; | 93 virtual void ClearAndEnablePassword() OVERRIDE; |
| 92 virtual void OnLoginSuccess(const std::string& username) OVERRIDE; | 94 virtual void OnLoginSuccess(const std::string& username) OVERRIDE; |
| 93 virtual void OnUserRemoved(const std::string& username) OVERRIDE; | 95 virtual void OnUserRemoved(const std::string& username) OVERRIDE; |
| 94 virtual void ShowError(int login_attempts, | 96 virtual void ShowError(int login_attempts, |
| 95 const std::string& error_text, | 97 const std::string& error_text, |
| 96 const std::string& help_link_text, | 98 const std::string& help_link_text, |
| 97 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; | 99 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; |
| 98 | 100 |
| 101 // BrowsingDataRemover::Observer overrides. |
| 102 virtual void OnBrowsingDataRemoverDone() OVERRIDE; |
| 103 |
| 99 // Handles confirmation message of user authentication that was performed by | 104 // Handles confirmation message of user authentication that was performed by |
| 100 // the authentication extension. | 105 // the authentication extension. |
| 101 void HandleCompleteLogin(const base::ListValue* args); | 106 void HandleCompleteLogin(const base::ListValue* args); |
| 102 | 107 |
| 103 // Handles get existing user list request when populating account picker. | 108 // Handles get existing user list request when populating account picker. |
| 104 void HandleGetUsers(const base::ListValue* args); | 109 void HandleGetUsers(const base::ListValue* args); |
| 105 | 110 |
| 106 // Handles authentication request when signing in an existing user. | 111 // Handles authentication request when signing in an existing user. |
| 107 void HandleAuthenticateUser(const base::ListValue* args); | 112 void HandleAuthenticateUser(const base::ListValue* args); |
| 108 | 113 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 123 | 128 |
| 124 // Handles 'launchHelpApp' request. | 129 // Handles 'launchHelpApp' request. |
| 125 void HandleLaunchHelpApp(const base::ListValue* args); | 130 void HandleLaunchHelpApp(const base::ListValue* args); |
| 126 | 131 |
| 127 // Handle 'createAccount' request. | 132 // Handle 'createAccount' request. |
| 128 void HandleCreateAccount(const base::ListValue* args); | 133 void HandleCreateAccount(const base::ListValue* args); |
| 129 | 134 |
| 130 // Sends user list to account picker. | 135 // Sends user list to account picker. |
| 131 void SendUserList(bool animated); | 136 void SendUserList(bool animated); |
| 132 | 137 |
| 138 // Kick off cookie / local storage cleanup. |
| 139 void StartClearingCookies(); |
| 140 |
| 133 // A delegate that glues this handler with backend LoginDisplay. | 141 // A delegate that glues this handler with backend LoginDisplay. |
| 134 SigninScreenHandlerDelegate* delegate_; | 142 SigninScreenHandlerDelegate* delegate_; |
| 135 | 143 |
| 136 // Whether screen should be shown right after initialization. | 144 // Whether screen should be shown right after initialization. |
| 137 bool show_on_init_; | 145 bool show_on_init_; |
| 138 | 146 |
| 139 // Keeps whether screen should be shown for OOBE. | 147 // Keeps whether screen should be shown for OOBE. |
| 140 bool oobe_ui_; | 148 bool oobe_ui_; |
| 141 | 149 |
| 142 // True if new user sign in flow is driven by the extension. | 150 // True if new user sign in flow is driven by the extension. |
| 143 bool extension_driven_; | 151 bool extension_driven_; |
| 144 | 152 |
| 153 std::string email_; |
| 145 // Help application used for help dialogs. | 154 // Help application used for help dialogs. |
| 146 scoped_refptr<HelpAppLauncher> help_app_; | 155 scoped_refptr<HelpAppLauncher> help_app_; |
| 147 | 156 |
| 148 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); | 157 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); |
| 149 }; | 158 }; |
| 150 | 159 |
| 151 } // namespace chromeos | 160 } // namespace chromeos |
| 152 | 161 |
| 153 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ | 162 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ |
| OLD | NEW |