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

Side by Side Diff: chrome/browser/chromeos/login/webui_login_display.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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/webui_login_display.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "chrome/browser/chromeos/login/login_display.h" 14 #include "chrome/browser/chromeos/login/login_display.h"
15 #include "chrome/browser/chromeos/login/user_manager.h" 15 #include "chrome/browser/chromeos/login/user_manager.h"
16 #include "chrome/browser/ui/webui/chromeos/login/login_ui.h" 16 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
17 #include "views/widget/widget.h" 17 #include "views/widget/widget.h"
18 18
19 namespace gfx { 19 namespace gfx {
20 class Rect; 20 class Rect;
21 } // namespace gfx 21 } // namespace gfx
22 22
23 namespace chromeos { 23 namespace chromeos {
24 // WebUI-based login UI implementation. 24 // WebUI-based login UI implementation.
25 // This class is a Singleton. It allows the LoginDisplayHost and LoginUIHandler 25 // This class is a Singleton. It allows the LoginDisplayHost and LoginUIHandler
26 // to access it without having to be coupled with each other. It is created with 26 // to access it without having to be coupled with each other. It is created with
27 // NULL for the delegate and a 0-size rectangle for the background 27 // NULL for the delegate and a 0-size rectangle for the background
28 // bounds. Before use these values should be set to a sane value. When done with 28 // bounds. Before use these values should be set to a sane value. When done with
29 // the object, the ExistingUserController should call Destroy and not free the 29 // the object, the ExistingUserController should call Destroy and not free the
30 // pointer, where as accessing classes should do nothing with the pointer. 30 // pointer, where as accessing classes should do nothing with the pointer.
31 // 31 //
32 // Expected order of commands to setup for LoginDisplayHost: 32 // Expected order of commands to setup for LoginDisplayHost:
33 // WebUILoginDisplay::GetInstance(); 33 // WebUILoginDisplay::GetInstance();
34 // set_delegate(delegate); 34 // set_delegate(delegate);
35 // set_background_bounds(background_bounds()); 35 // set_background_bounds(background_bounds());
36 // Init(); 36 // Init();
37 // 37 //
38 // Expected order of commands to setup for LoginUIHandler: 38 // Expected order of commands to setup for LoginUIHandler:
39 // WebUILoginDisplay::GetInstance(); 39 // WebUILoginDisplay::GetInstance();
40 // set_login_handler(this); 40 // set_login_handler(this);
41 41
42 class WebUILoginDisplay : public LoginDisplay, 42 class WebUILoginDisplay : public LoginDisplay,
43 public LoginUIHandlerDelegate { 43 public SigninScreenHandlerDelegate {
44 public: 44 public:
45 virtual ~WebUILoginDisplay(); 45 virtual ~WebUILoginDisplay();
46 46
47 // Singleton implementation: 47 // Singleton implementation:
48 static WebUILoginDisplay* GetInstance(); 48 static WebUILoginDisplay* GetInstance();
49 49
50 // Wrapper used to help in routing keyboard key presses into the login 50 // Wrapper used to help in routing keyboard key presses into the login
51 // screen. This gets the Login Window widget from the Singleton, so that other 51 // screen. This gets the Login Window widget from the Singleton, so that other
52 // classes don't need to know we are a Singleton 52 // classes don't need to know we are a Singleton
53 static views::Widget* GetLoginWindow(); 53 static views::Widget* GetLoginWindow();
54 views::Widget* LoginWindow(); 54 views::Widget* LoginWindow();
55 55
56 // LoginDisplay implementation: 56 // LoginDisplay implementation:
57 virtual void Destroy() OVERRIDE; 57 virtual void Destroy() OVERRIDE;
58 virtual void Init(const std::vector<UserManager::User>& users, 58 virtual void Init(const std::vector<UserManager::User>& users,
59 bool show_guest, 59 bool show_guest,
60 bool show_new_user) OVERRIDE; 60 bool show_new_user) OVERRIDE;
61 virtual void OnBeforeUserRemoved(const std::string& username) OVERRIDE; 61 virtual void OnBeforeUserRemoved(const std::string& username) OVERRIDE;
62 virtual void OnUserImageChanged(UserManager::User* user) OVERRIDE; 62 virtual void OnUserImageChanged(UserManager::User* user) OVERRIDE;
63 virtual void OnUserRemoved(const std::string& username) OVERRIDE; 63 virtual void OnUserRemoved(const std::string& username) OVERRIDE;
64 virtual void OnFadeOut() OVERRIDE; 64 virtual void OnFadeOut() OVERRIDE;
65 virtual void SetUIEnabled(bool is_enabled) OVERRIDE; 65 virtual void SetUIEnabled(bool is_enabled) OVERRIDE;
66 virtual void SelectPod(int index) OVERRIDE; 66 virtual void SelectPod(int index) OVERRIDE;
67 virtual void ShowError(int error_msg_id, 67 virtual void ShowError(int error_msg_id,
68 int login_attempts, 68 int login_attempts,
69 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; 69 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE;
70 70
71 // LoginUIHandlerDelegate 71 // SigninScreenHandlerDelegate implementation:
72 virtual void CompleteLogin(const std::string& username, 72 virtual void CompleteLogin(const std::string& username,
73 const std::string& password) OVERRIDE; 73 const std::string& password) OVERRIDE;
74 virtual void Login(const std::string& username, 74 virtual void Login(const std::string& username,
75 const std::string& password) OVERRIDE; 75 const std::string& password) OVERRIDE;
76 virtual void LoginAsGuest() OVERRIDE; 76 virtual void LoginAsGuest() OVERRIDE;
77 virtual void SetWebUIHandler(
78 LoginDisplayWebUIHandler* webui_handler) OVERRIDE;
77 79
78 void set_login_window(views::Widget* login_window) { 80 void set_login_window(views::Widget* login_window) {
79 login_window_ = login_window; 81 login_window_ = login_window;
80 } 82 }
81 83
82 private: 84 private:
83 // Singleton implementation: 85 // Singleton implementation:
84 friend struct DefaultSingletonTraits<WebUILoginDisplay>; 86 friend struct DefaultSingletonTraits<WebUILoginDisplay>;
85 WebUILoginDisplay(); 87 WebUILoginDisplay();
86 88
87 // Set of Users in the systemvisible UserControllers. 89 // Set of Users in the systemvisible UserControllers.
88 std::vector<UserManager::User> users_; 90 std::vector<UserManager::User> users_;
89 91
90 // Container of the screen we are displaying 92 // Container of the screen we are displaying
91 views::Widget* login_window_; 93 views::Widget* login_window_;
92 94
95 // Reference to the WebUI handling layer for the login screen
96 LoginDisplayWebUIHandler* webui_handler_;
97
93 DISALLOW_COPY_AND_ASSIGN(WebUILoginDisplay); 98 DISALLOW_COPY_AND_ASSIGN(WebUILoginDisplay);
94 }; 99 };
95 100
96 } // namespace chromeos 101 } // namespace chromeos
97 102
98 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ 103 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/webui_login_display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698