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

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

Issue 7461142: [ChromeOS] Assorted WebUI login fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comment in #1 Created 9 years, 4 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 #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/login/webui_login_view.h" 7 #include "chrome/browser/chromeos/login/webui_login_view.h"
8 #include "chrome/browser/chromeos/wm_ipc.h" 8 #include "chrome/browser/chromeos/wm_ipc.h"
9 #include "chrome/browser/profiles/profile_manager.h" 9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 delegate_ = NULL; 43 delegate_ = NULL;
44 } 44 }
45 45
46 // TODO(rharrison): Add mechanism to pass in the show_guest and show_new_user 46 // TODO(rharrison): Add mechanism to pass in the show_guest and show_new_user
47 // values. 47 // values.
48 void WebUILoginDisplay::Init(const std::vector<UserManager::User>& users, 48 void WebUILoginDisplay::Init(const std::vector<UserManager::User>& users,
49 bool show_guest, 49 bool show_guest,
50 bool show_new_user) { 50 bool show_new_user) {
51 // Testing that the delegate has been set. 51 // Testing that the delegate has been set.
52 DCHECK(delegate_); 52 DCHECK(delegate_);
53
53 users_ = users; 54 users_ = users;
55 show_guest_ = show_guest;
56 show_new_user_ = show_new_user;
54 } 57 }
55 58
56 void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) { 59 void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) {
57 // TODO(rharrison): Figure out if I need to split anything between this and 60 // TODO(rharrison): Figure out if I need to split anything between this and
58 // OnUserRemoved 61 // OnUserRemoved
59 } 62 }
60 63
61 void WebUILoginDisplay::OnUserImageChanged(UserManager::User* user) { 64 void WebUILoginDisplay::OnUserImageChanged(UserManager::User* user) {
62 // TODO(rharrison): Update the user in the user vector 65 // TODO(rharrison): Update the user in the user vector
63 // TODO(rharrison): Push the change to WebUI Login screen 66 // TODO(rharrison): Push the change to WebUI Login screen
64 } 67 }
65 68
66 void WebUILoginDisplay::OnUserRemoved(const std::string& username) { 69 void WebUILoginDisplay::OnUserRemoved(const std::string& username) {
67 // TODO(rharrison): Remove the user from the user vector 70 DCHECK(webui_handler_);
68 // TODO(rharrison): Push the change to WebUI Login screen 71
72 for (std::vector<UserManager::User>::iterator it = users_.begin();
73 it != users_.end();
74 ++it) {
75 if (it->email() == username) {
76 users_.erase(it);
77 break;
78 }
79 }
80
81 webui_handler_->OnUserRemoved(username);
69 } 82 }
70 83
71 void WebUILoginDisplay::OnFadeOut() { 84 void WebUILoginDisplay::OnFadeOut() {
72 } 85 }
73 86
74 void WebUILoginDisplay::OnLoginSuccess(const std::string& username) { 87 void WebUILoginDisplay::OnLoginSuccess(const std::string& username) {
75 webui_handler_->OnLoginSuccess(username); 88 webui_handler_->OnLoginSuccess(username);
76 } 89 }
77 90
78 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) { 91 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 break; 132 break;
120 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED: 133 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED:
121 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE); 134 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE);
122 break; 135 break;
123 default: 136 default:
124 if (login_attempts > 1) 137 if (login_attempts > 1)
125 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE); 138 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE);
126 break; 139 break;
127 } 140 }
128 141
129 webui_handler_->ShowError(error_text, help_link, help_topic_id); 142 webui_handler_->ShowError(login_attempts, error_text, help_link,
143 help_topic_id);
130 } 144 }
131 145
132 // WebUILoginDisplay, SigninScreenHandlerDelegate implementation: -------------- 146 // WebUILoginDisplay, SigninScreenHandlerDelegate implementation: --------------
133 void WebUILoginDisplay::SetWebUIHandler(
134 LoginDisplayWebUIHandler* webui_handler) {
135 webui_handler_ = webui_handler;
136 }
137
138 void WebUILoginDisplay::ShowEnterpriseEnrollmentScreen() {
139 delegate_->OnStartEnterpriseEnrollment();
140 }
141
142 void WebUILoginDisplay::CompleteLogin(const std::string& username, 147 void WebUILoginDisplay::CompleteLogin(const std::string& username,
143 const std::string& password) { 148 const std::string& password) {
144 DCHECK(delegate_); 149 DCHECK(delegate_);
145 delegate_->CompleteLogin(username, password); 150 delegate_->CompleteLogin(username, password);
146 } 151 }
147 152
148 void WebUILoginDisplay::Login(const std::string& username, 153 void WebUILoginDisplay::Login(const std::string& username,
149 const std::string& password) { 154 const std::string& password) {
150 DCHECK(delegate_); 155 DCHECK(delegate_);
151 delegate_->Login(username, password); 156 delegate_->Login(username, password);
152 } 157 }
153 158
154 void WebUILoginDisplay::LoginAsGuest() { 159 void WebUILoginDisplay::LoginAsGuest() {
155 DCHECK(delegate_); 160 DCHECK(delegate_);
156 delegate_->LoginAsGuest(); 161 delegate_->LoginAsGuest();
157 } 162 }
158 163
164 void WebUILoginDisplay::RemoveUser(const std::string& username) {
165 UserManager::Get()->RemoveUser(username, this);
166 }
167
168 void WebUILoginDisplay::ShowEnterpriseEnrollmentScreen() {
169 delegate_->OnStartEnterpriseEnrollment();
170 }
171
172 void WebUILoginDisplay::SetWebUIHandler(
173 LoginDisplayWebUIHandler* webui_handler) {
174 webui_handler_ = webui_handler;
175 }
176
159 // WebUILoginDisplay, private: ------------------------------------------------- 177 // WebUILoginDisplay, private: -------------------------------------------------
160 178
161 // Singleton implementation: --------------------------------------------------- 179 // Singleton implementation: ---------------------------------------------------
162 180
163 WebUILoginDisplay::WebUILoginDisplay() 181 WebUILoginDisplay::WebUILoginDisplay()
164 : LoginDisplay(NULL, gfx::Rect()), 182 : LoginDisplay(NULL, gfx::Rect()),
183 show_guest_(false),
184 show_new_user_(false),
165 login_window_(NULL), 185 login_window_(NULL),
166 webui_handler_(NULL) { 186 webui_handler_(NULL) {
167 } 187 }
168 188
169 } // namespace chromeos 189 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/webui_login_display.h ('k') | chrome/browser/resources/chromeos/login/bubble.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698