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

Side by Side Diff: chrome/browser/chromeos/login/webui_login_display.cc

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, 1 month 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
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 #include "chrome/browser/chromeos/login/webui_login_display.h" 5 #include "chrome/browser/chromeos/login/webui_login_display.h"
6 6
7 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 7 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
8 #include "chrome/browser/chromeos/login/webui_login_view.h" 8 #include "chrome/browser/chromeos/login/webui_login_view.h"
9 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" 9 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h"
10 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
11 #include "chrome/browser/ui/browser_window.h" 11 #include "chrome/browser/ui/browser_window.h"
12 #include "grit/chromium_strings.h" 12 #include "grit/chromium_strings.h"
13 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
15 #include "views/widget/widget.h" 15 #include "views/widget/widget.h"
16 16
17 #if defined(TOOLKIT_USES_GTK) 17 #if defined(TOOLKIT_USES_GTK)
18 #include "chrome/browser/chromeos/wm_ipc.h" 18 #include "chrome/browser/chromeos/wm_ipc.h"
19 #endif 19 #endif
20 20
21 namespace chromeos { 21 namespace chromeos {
22 22
23 // WebUILoginDisplay, public: -------------------------------------------------- 23 // WebUILoginDisplay, public: --------------------------------------------------
24 24
25 WebUILoginDisplay::~WebUILoginDisplay() { 25 WebUILoginDisplay::~WebUILoginDisplay() {
26 } 26 }
27 27
28 // WebUILoginDisplay, Singleton implementation: --------------------------------
29
30 // static
31 WebUILoginDisplay* WebUILoginDisplay::GetInstance() {
32 return Singleton<WebUILoginDisplay>::get();
33 }
34
35 // LoginDisplay implementation: ------------------------------------------------ 28 // LoginDisplay implementation: ------------------------------------------------
36 29
37 // static 30 WebUILoginDisplay::WebUILoginDisplay(LoginDisplay::Delegate* delegate)
38 views::Widget* WebUILoginDisplay::GetLoginWindow() { 31 : LoginDisplay(delegate, gfx::Rect()),
39 return WebUILoginDisplay::GetInstance()->LoginWindow(); 32 show_guest_(false),
40 } 33 show_new_user_(false),
41 34 webui_handler_(NULL) {
42 views::Widget* WebUILoginDisplay::LoginWindow() {
43 return login_window_;
44 }
45
46 void WebUILoginDisplay::Destroy() {
47 background_bounds_ = gfx::Rect();
48 delegate_ = NULL;
49 } 35 }
50 36
51 void WebUILoginDisplay::Init(const std::vector<UserManager::User>& users, 37 void WebUILoginDisplay::Init(const std::vector<UserManager::User>& users,
52 bool show_guest, 38 bool show_guest,
53 bool show_new_user) { 39 bool show_new_user) {
54 // Testing that the delegate has been set. 40 // Testing that the delegate has been set.
55 DCHECK(delegate_); 41 DCHECK(delegate_);
56 42
57 users_ = users; 43 users_ = users;
58 show_guest_ = show_guest; 44 show_guest_ = show_guest;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 webui_handler_ = webui_handler; 183 webui_handler_ = webui_handler;
198 } 184 }
199 185
200 void WebUILoginDisplay::ShowSigninScreenForCreds( 186 void WebUILoginDisplay::ShowSigninScreenForCreds(
201 const std::string& username, 187 const std::string& username,
202 const std::string& password) { 188 const std::string& password) {
203 DCHECK(webui_handler_); 189 DCHECK(webui_handler_);
204 webui_handler_->ShowSigninScreenForCreds(username, password); 190 webui_handler_->ShowSigninScreenForCreds(username, password);
205 } 191 }
206 192
207 // WebUILoginDisplay, private: -------------------------------------------------
208 193
209 // Singleton implementation: --------------------------------------------------- 194 const std::vector<UserManager::User>& WebUILoginDisplay::GetUsers() const {
195 return users_;
196 }
210 197
211 WebUILoginDisplay::WebUILoginDisplay() 198 bool WebUILoginDisplay::IsShowGuest() const {
212 : LoginDisplay(NULL, gfx::Rect()), 199 return show_guest_;
213 show_guest_(false), 200 }
214 show_new_user_(false), 201
215 login_window_(NULL), 202 bool WebUILoginDisplay::IsShowNewUser() const {
216 webui_handler_(NULL) { 203 return show_new_user_;
217 } 204 }
218 205
219 } // namespace chromeos 206 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/webui_login_display.h ('k') | chrome/browser/chromeos/login/webui_login_display_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698