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

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

Issue 10213003: chromeos: Break WebUILoginDisplay and SigninScreenHandler coupling on destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/ui/webui/chromeos/login/signin_screen_handler.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/accessibility/accessibility_util.h" 7 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
8 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 8 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
9 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 9 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
10 #include "chrome/browser/chromeos/login/webui_login_view.h" 10 #include "chrome/browser/chromeos/login/webui_login_view.h"
11 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chrome/browser/ui/browser_window.h" 12 #include "chrome/browser/ui/browser_window.h"
13 #include "grit/chromium_strings.h" 13 #include "grit/chromium_strings.h"
14 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
17 17
18 namespace chromeos { 18 namespace chromeos {
19 19
20 // WebUILoginDisplay, public: -------------------------------------------------- 20 // WebUILoginDisplay, public: --------------------------------------------------
21 21
22 WebUILoginDisplay::~WebUILoginDisplay() { 22 WebUILoginDisplay::~WebUILoginDisplay() {
23 if (webui_handler_)
24 webui_handler_->ResetSigninScreenHandlerDelegate();
23 } 25 }
24 26
25 // LoginDisplay implementation: ------------------------------------------------ 27 // LoginDisplay implementation: ------------------------------------------------
26 28
27 WebUILoginDisplay::WebUILoginDisplay(LoginDisplay::Delegate* delegate) 29 WebUILoginDisplay::WebUILoginDisplay(LoginDisplay::Delegate* delegate)
28 : LoginDisplay(delegate, gfx::Rect()), 30 : LoginDisplay(delegate, gfx::Rect()),
29 show_guest_(false), 31 show_guest_(false),
30 show_new_user_(false), 32 show_new_user_(false),
31 webui_handler_(NULL) { 33 webui_handler_(NULL) {
32 } 34 }
(...skipping 19 matching lines...) Expand all
52 void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) { 54 void WebUILoginDisplay::OnBeforeUserRemoved(const std::string& username) {
53 for (UserList::iterator it = users_.begin(); it != users_.end(); ++it) { 55 for (UserList::iterator it = users_.begin(); it != users_.end(); ++it) {
54 if ((*it)->email() == username) { 56 if ((*it)->email() == username) {
55 users_.erase(it); 57 users_.erase(it);
56 break; 58 break;
57 } 59 }
58 } 60 }
59 } 61 }
60 62
61 void WebUILoginDisplay::OnUserImageChanged(const User& user) { 63 void WebUILoginDisplay::OnUserImageChanged(const User& user) {
62 DCHECK(webui_handler_); 64 DCHECK(webui_handler_);
altimofeev 2012/04/25 16:32:27 please handle webui_handler_== NULL case
xiyuan 2012/04/25 17:08:10 Done.
63 webui_handler_->OnUserImageChanged(user); 65 webui_handler_->OnUserImageChanged(user);
64 } 66 }
65 67
66 void WebUILoginDisplay::OnUserRemoved(const std::string& username) { 68 void WebUILoginDisplay::OnUserRemoved(const std::string& username) {
67 DCHECK(webui_handler_); 69 DCHECK(webui_handler_);
altimofeev 2012/04/25 16:32:27 ditto
xiyuan 2012/04/25 17:08:10 Done.
68 webui_handler_->OnUserRemoved(username); 70 webui_handler_->OnUserRemoved(username);
69 } 71 }
70 72
71 void WebUILoginDisplay::OnFadeOut() { 73 void WebUILoginDisplay::OnFadeOut() {
72 } 74 }
73 75
74 void WebUILoginDisplay::OnLoginSuccess(const std::string& username) { 76 void WebUILoginDisplay::OnLoginSuccess(const std::string& username) {
75 webui_handler_->OnLoginSuccess(username); 77 webui_handler_->OnLoginSuccess(username);
altimofeev 2012/04/25 16:32:27 ditto
xiyuan 2012/04/25 17:08:10 Done.
76 } 78 }
77 79
78 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) { 80 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) {
79 if (is_enabled) 81 if (is_enabled)
80 webui_handler_->ClearAndEnablePassword(); 82 webui_handler_->ClearAndEnablePassword();
altimofeev 2012/04/25 16:32:27 ditto
xiyuan 2012/04/25 17:08:10 Done.
81 } 83 }
82 84
83 void WebUILoginDisplay::SelectPod(int index) { 85 void WebUILoginDisplay::SelectPod(int index) {
84 } 86 }
85 87
86 void WebUILoginDisplay::ShowError(int error_msg_id, 88 void WebUILoginDisplay::ShowError(int error_msg_id,
87 int login_attempts, 89 int login_attempts,
88 HelpAppLauncher::HelpTopic help_topic_id) { 90 HelpAppLauncher::HelpTopic help_topic_id) {
89 VLOG(1) << "Show error, error_id: " << error_msg_id 91 VLOG(1) << "Show error, error_id: " << error_msg_id
90 << ", attempts:" << login_attempts 92 << ", attempts:" << login_attempts
91 << ", help_topic_id: " << help_topic_id; 93 << ", help_topic_id: " << help_topic_id;
92 DCHECK(webui_handler_); 94 DCHECK(webui_handler_);
altimofeev 2012/04/25 16:32:27 ditto
xiyuan 2012/04/25 17:08:10 Done.
93 95
94 std::string error_text; 96 std::string error_text;
95 switch (error_msg_id) { 97 switch (error_msg_id) {
96 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED: 98 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED:
97 error_text = l10n_util::GetStringFUTF8( 99 error_text = l10n_util::GetStringFUTF8(
98 error_msg_id, l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); 100 error_msg_id, l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME));
99 break; 101 break;
100 case IDS_LOGIN_ERROR_CAPTIVE_PORTAL: 102 case IDS_LOGIN_ERROR_CAPTIVE_PORTAL:
101 error_text = l10n_util::GetStringFUTF8( 103 error_text = l10n_util::GetStringFUTF8(
102 error_msg_id, delegate()->GetConnectedNetworkName()); 104 error_msg_id, delegate()->GetConnectedNetworkName());
(...skipping 28 matching lines...) Expand all
131 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE); 133 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE);
132 break; 134 break;
133 } 135 }
134 136
135 webui_handler_->ShowError(login_attempts, error_text, help_link, 137 webui_handler_->ShowError(login_attempts, error_text, help_link,
136 help_topic_id); 138 help_topic_id);
137 accessibility::MaybeSpeak(error_text); 139 accessibility::MaybeSpeak(error_text);
138 } 140 }
139 141
140 void WebUILoginDisplay::ShowGaiaPasswordChanged(const std::string& username) { 142 void WebUILoginDisplay::ShowGaiaPasswordChanged(const std::string& username) {
141 webui_handler_->ShowGaiaPasswordChanged(username); 143 webui_handler_->ShowGaiaPasswordChanged(username);
altimofeev 2012/04/25 16:32:27 ditto
xiyuan 2012/04/25 17:08:10 Done.
142 } 144 }
143 145
144 // WebUILoginDisplay, SigninScreenHandlerDelegate implementation: -------------- 146 // WebUILoginDisplay, SigninScreenHandlerDelegate implementation: --------------
145 void WebUILoginDisplay::CompleteLogin(const std::string& username, 147 void WebUILoginDisplay::CompleteLogin(const std::string& username,
146 const std::string& password) { 148 const std::string& password) {
147 DCHECK(delegate_); 149 DCHECK(delegate_);
148 if (delegate_) 150 if (delegate_)
149 delegate_->CompleteLogin(username, password); 151 delegate_->CompleteLogin(username, password);
150 } 152 }
151 153
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 190 }
189 191
190 void WebUILoginDisplay::SetWebUIHandler( 192 void WebUILoginDisplay::SetWebUIHandler(
191 LoginDisplayWebUIHandler* webui_handler) { 193 LoginDisplayWebUIHandler* webui_handler) {
192 webui_handler_ = webui_handler; 194 webui_handler_ = webui_handler;
193 } 195 }
194 196
195 void WebUILoginDisplay::ShowSigninScreenForCreds( 197 void WebUILoginDisplay::ShowSigninScreenForCreds(
196 const std::string& username, 198 const std::string& username,
197 const std::string& password) { 199 const std::string& password) {
198 DCHECK(webui_handler_); 200 DCHECK(webui_handler_);
altimofeev 2012/04/25 16:32:27 ditto
xiyuan 2012/04/25 17:08:10 Done.
199 webui_handler_->ShowSigninScreenForCreds(username, password); 201 webui_handler_->ShowSigninScreenForCreds(username, password);
200 } 202 }
201 203
202 const UserList& WebUILoginDisplay::GetUsers() const { 204 const UserList& WebUILoginDisplay::GetUsers() const {
203 return users_; 205 return users_;
204 } 206 }
205 207
206 bool WebUILoginDisplay::IsShowGuest() const { 208 bool WebUILoginDisplay::IsShowGuest() const {
207 return show_guest_; 209 return show_guest_;
208 } 210 }
209 211
210 bool WebUILoginDisplay::IsShowUsers() const { 212 bool WebUILoginDisplay::IsShowUsers() const {
211 return show_users_; 213 return show_users_;
212 } 214 }
213 215
214 bool WebUILoginDisplay::IsShowNewUser() const { 216 bool WebUILoginDisplay::IsShowNewUser() const {
215 return show_new_user_; 217 return show_new_user_;
216 } 218 }
217 219
218 void WebUILoginDisplay::SetDisplayEmail(const std::string& email) { 220 void WebUILoginDisplay::SetDisplayEmail(const std::string& email) {
219 if (delegate_) 221 if (delegate_)
220 delegate_->SetDisplayEmail(email); 222 delegate_->SetDisplayEmail(email);
221 } 223 }
222 224
223 } // namespace chromeos 225 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698