Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Unified Diff: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h

Issue 7382001: [ChromeOS] WebUI OOBE/Login refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
index 819396d463140e2a65849e9889a326a216f58650..4c7aa4d3ae82c7b5e05be8a673255898c87844c2 100644
--- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
@@ -7,7 +7,7 @@
#pragma once
#include "chrome/browser/ui/webui/chromeos/login/login_ui.h"
-#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
+#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
#include "content/browser/webui/web_ui.h"
namespace base {
@@ -17,9 +17,43 @@ class ListValue;
namespace chromeos {
-// Signin screen handler.
-class SigninScreenHandler : public OobeMessageHandler,
- public BaseLoginUIHandler {
+// An interface for WebUILoginDisplay to call SigninScreenHandler.
+class LoginDisplayWebUIHandler {
+ public:
+ virtual void ClearAndEnablePassword() = 0;
+ virtual void ShowError(const std::string& error_text,
+ const std::string& help_link_text,
+ HelpAppLauncher::HelpTopic help_topic_id) = 0;
+};
+
+// An interface for SigninScreenHandler to call WebUILoginDisplay.
Nikita (slow) 2011/07/15 07:11:02 nit: It has private data members so technically it
xiyuan 2011/07/15 18:26:23 You are right. Made it an interface.
+class SigninScreenHandlerDelegate {
+ public:
+ SigninScreenHandlerDelegate()
+ : webui_handler_(NULL) { }
+
+ // Sign in using |username| and |password| specified.
+ // Used for both known and new users.
+ virtual void Login(const std::string& username,
+ const std::string& password) = 0;
+
+ // Sign in into Guest session.
+ virtual void LoginAsGuest() = 0;
+
+ // Let the delegate know about the handler it is supposed to be using.
+ void set_webui_handler(LoginDisplayWebUIHandler* webui_handler);
Nikita (slow) 2011/07/15 07:11:02 nit: Setter implementation should be located in .h
xiyuan 2011/07/15 18:26:23 Renamed to SetWebUIHandler and made it pure virtua
+
+ protected:
+ // Reference to the WebUI handling layer for the login screen
+ LoginDisplayWebUIHandler* webui_handler_;
+
+ virtual ~SigninScreenHandlerDelegate();
+};
+
+// A class that handles the WebUI hooks in sign-in screen in OobeDisplay
+// and LoginDisplay.
+class SigninScreenHandler : public BaseScreenHandler,
+ public LoginDisplayWebUIHandler {
public:
SigninScreenHandler();
@@ -27,7 +61,7 @@ class SigninScreenHandler : public OobeMessageHandler,
void Show();
private:
- // OobeMessageHandler implementation:
+ // BaseScreenHandler implementation:
virtual void GetLocalizedStrings(
base::DictionaryValue* localized_strings) OVERRIDE;
virtual void Initialize() OVERRIDE;
@@ -41,13 +75,17 @@ class SigninScreenHandler : public OobeMessageHandler,
const std::string& help_link_text,
HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE;
- // Handles authenticate user request from javascript.
+ // Callbacks from javascript.
+ void HandleGetUsers(const base::ListValue* args);
void HandleAuthenticateUser(const base::ListValue* args);
+ void HandleLaunchIncognito(const base::ListValue* args);
+ void HandleShutdownSystem(const base::ListValue* args);
+ void HandleRemoveUser(const base::ListValue* args);
// A delegate that glues this handler with backend LoginDisplay.
- LoginUIHandlerDelegate* delegate_;
+ SigninScreenHandlerDelegate* delegate_;
- // Keeps whether screen should be shown right after initialization.
+ // Whether screen should be shown right after initialization.
bool show_on_init_;
DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler);

Powered by Google App Engine
This is Rietveld 408576698