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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/login_ui.h

Issue 7382001: [ChromeOS] WebUI OOBE/Login refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync and merge 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_LOGIN_UI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_LOGIN_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_LOGIN_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_LOGIN_UI_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/chromeos/login/help_app_launcher.h" 12 #include "chrome/browser/chromeos/login/help_app_launcher.h"
13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
14 #include "chrome/browser/ui/webui/chrome_web_ui.h" 13 #include "chrome/browser/ui/webui/chrome_web_ui.h"
15 14
15 class RefCountedMemory;
16 class Profile; 16 class Profile;
17 17
18 namespace chromeos { 18 namespace chromeos {
19 19
20 class HTMLOperationsInterface;
21
22 // Boilerplate class that is used to associate the LoginUI code with the URL
23 // "chrome://login"
24 class LoginUIHTMLSource : public ChromeURLDataManager::DataSource {
25 public:
26 explicit LoginUIHTMLSource(MessageLoop* message_loop);
27 virtual ~LoginUIHTMLSource();
28
29 virtual void StartDataRequest(const std::string& path,
30 bool is_incognito,
31 int request_id);
32 virtual std::string GetMimeType(const std::string&) const;
33
34 private:
35 scoped_ptr<HTMLOperationsInterface> html_operations_;
36
37 DISALLOW_COPY_AND_ASSIGN(LoginUIHTMLSource);
38 };
39
40 // An interface between WebUILoginDisplay and LoginUIHandler.
41 class BaseLoginUIHandler {
42 public:
43 virtual void ClearAndEnablePassword() = 0;
44 virtual void ShowError(const std::string& error_text,
45 const std::string& help_link_text,
46 HelpAppLauncher::HelpTopic help_topic_id) = 0;
47 };
48
49 class LoginUIHandlerDelegate {
50 public:
51 LoginUIHandlerDelegate()
52 : login_handler_(NULL) { }
53
54 // Sign in using |username| and |password| specified.
55 // Used for both known and new users.
56 virtual void Login(const std::string& username,
57 const std::string& password) = 0;
58
59 // Confirms sign up by provided |username| and |password| specified.
60 // Used for new user login via GAIA extension.
61 virtual void CompleteLogin(const std::string& username,
62 const std::string& password) = 0;
63
64 // Sign in into Guest session.
65 virtual void LoginAsGuest() = 0;
66
67 // Let the delegate know about the handler it is supposed to be using.
68 virtual void set_login_handler(BaseLoginUIHandler* login_handler);
69
70 protected:
71 // Reference to the WebUI handling layer for the login screen
72 BaseLoginUIHandler* login_handler_;
73
74 virtual ~LoginUIHandlerDelegate();
75 };
76
77 // Main LoginUI handling function. It handles the WebUI hooks that are supplied
78 // for the login page to use for authentication.
79 class LoginUIHandler : public WebUIMessageHandler,
80 public BaseLoginUIHandler {
81 public:
82 LoginUIHandler();
83 virtual ~LoginUIHandler();
84
85 // WebUIMessageHandler implementation.
86 virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
87 virtual void RegisterMessages() OVERRIDE;
88
89 protected:
90 LoginUIHandlerDelegate* delegate_;
91
92 private:
93 // BaseLoginUIHandler implementation.
94 virtual void ClearAndEnablePassword() OVERRIDE;
95 virtual void ShowError(const std::string& error_text,
96 const std::string& help_link_text,
97 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE;
98
99 // Callbacks from javascript.
100 void HandleGetUsers(const base::ListValue* args);
101 void HandleAuthenticateUser(const base::ListValue* args);
102 void HandleLaunchIncognito(const base::ListValue* args);
103 void HandleShutdownSystem(const base::ListValue* args);
104 void HandleRemoveUser(const base::ListValue* args);
105
106 DISALLOW_COPY_AND_ASSIGN(LoginUIHandler);
107 };
108
109 // Boilerplate class that is used to associate the LoginUI code with the WebUI 20 // Boilerplate class that is used to associate the LoginUI code with the WebUI
110 // code. 21 // code.
111 class LoginUI : public ChromeWebUI { 22 class LoginUI : public ChromeWebUI {
112 public: 23 public:
113 explicit LoginUI(TabContents* contents); 24 explicit LoginUI(TabContents* contents);
114 25
115 // Return the URL for a given search term. 26 // Return the URL for a given search term.
116 static const GURL GetLoginURLWithSearchText(const string16& text); 27 static const GURL GetLoginURLWithSearchText(const string16& text);
117 28
118 static RefCountedMemory* GetFaviconResourceBytes(); 29 static RefCountedMemory* GetFaviconResourceBytes();
119 30
120 private: 31 private:
121 DISALLOW_COPY_AND_ASSIGN(LoginUI); 32 DISALLOW_COPY_AND_ASSIGN(LoginUI);
122 }; 33 };
123 34
124 } // namespace chromeos 35 } // namespace chromeos
125 36
126 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_LOGIN_UI_H_ 37 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_LOGIN_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h ('k') | chrome/browser/ui/webui/chromeos/login/login_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698