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

Unified Diff: chrome/browser/chromeos/login/webui_login_display.h

Issue 8395042: [cros,de-hack] Get rid of singleton for the WebUILoginScreen. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: comment nit Created 9 years, 2 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/chromeos/login/webui_login_display.h
diff --git a/chrome/browser/chromeos/login/webui_login_display.h b/chrome/browser/chromeos/login/webui_login_display.h
index 699697235717bf34e70e5f9856969f9023f702a2..bc687261b2224edf3070e245242288faadec8513 100644
--- a/chrome/browser/chromeos/login/webui_login_display.h
+++ b/chrome/browser/chromeos/login/webui_login_display.h
@@ -10,7 +10,6 @@
#include <vector>
#include "base/memory/scoped_ptr.h"
-#include "base/memory/singleton.h"
#include "chrome/browser/chromeos/login/login_display.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
@@ -22,39 +21,13 @@ class Rect;
namespace chromeos {
// WebUI-based login UI implementation.
-// This class is a Singleton. It allows the LoginDisplayHost and LoginUIHandler
-// to access it without having to be coupled with each other. It is created with
-// NULL for the delegate and a 0-size rectangle for the background
-// bounds. Before use these values should be set to a sane value. When done with
-// the object, the ExistingUserController should call Destroy and not free the
-// pointer, where as accessing classes should do nothing with the pointer.
-//
-// Expected order of commands to setup for LoginDisplayHost:
-// WebUILoginDisplay::GetInstance();
-// set_delegate(delegate);
-// set_background_bounds(background_bounds());
-// Init();
-//
-// Expected order of commands to setup for LoginUIHandler:
-// WebUILoginDisplay::GetInstance();
-// set_login_handler(this);
-
class WebUILoginDisplay : public LoginDisplay,
public SigninScreenHandlerDelegate {
public:
+ explicit WebUILoginDisplay(LoginDisplay::Delegate* delegate);
virtual ~WebUILoginDisplay();
- // Singleton implementation:
- static WebUILoginDisplay* GetInstance();
-
- // Wrapper used to help in routing keyboard key presses into the login
- // screen. This gets the Login Window widget from the Singleton, so that other
- // classes don't need to know we are a Singleton
- static views::Widget* GetLoginWindow();
- views::Widget* LoginWindow();
-
// LoginDisplay implementation:
- virtual void Destroy() OVERRIDE;
virtual void Init(const std::vector<UserManager::User>& users,
bool show_guest,
bool show_new_user) OVERRIDE;
@@ -83,28 +56,11 @@ class WebUILoginDisplay : public LoginDisplay,
LoginDisplayWebUIHandler* webui_handler) OVERRIDE;
virtual void ShowSigninScreenForCreds(const std::string& username,
const std::string& password);
-
- void set_login_window(views::Widget* login_window) {
- login_window_ = login_window;
- }
-
- const std::vector<UserManager::User>& users() const {
- return users_;
- }
-
- bool show_guest() const {
- return show_guest_;
- }
-
- bool show_new_user() const {
- return show_new_user_;
- }
+ virtual const std::vector<UserManager::User>& GetUsers() const OVERRIDE;
+ virtual bool IsShowGuest() const OVERRIDE;
+ virtual bool IsShowNewUser() const OVERRIDE;
private:
- // Singleton implementation:
- friend struct DefaultSingletonTraits<WebUILoginDisplay>;
- WebUILoginDisplay();
-
// Set of Users that are visible.
std::vector<UserManager::User> users_;
@@ -114,9 +70,6 @@ class WebUILoginDisplay : public LoginDisplay,
// Whether to show add new user.
bool show_new_user_;
- // Container of the screen we are displaying
- views::Widget* login_window_;
-
// Reference to the WebUI handling layer for the login screen
LoginDisplayWebUIHandler* webui_handler_;
« no previous file with comments | « chrome/browser/chromeos/login/views_login_display_host.cc ('k') | chrome/browser/chromeos/login/webui_login_display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698