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

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: for comments in #1 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 if (webui_handler_)
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 if (webui_handler_)
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 if (webui_handler_)
78 webui_handler_->OnLoginSuccess(username);
76 } 79 }
77 80
78 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) { 81 void WebUILoginDisplay::SetUIEnabled(bool is_enabled) {
79 if (is_enabled) 82 if (webui_handler_ && is_enabled)
80 webui_handler_->ClearAndEnablePassword(); 83 webui_handler_->ClearAndEnablePassword();
81 } 84 }
82 85
83 void WebUILoginDisplay::SelectPod(int index) { 86 void WebUILoginDisplay::SelectPod(int index) {
84 } 87 }
85 88
86 void WebUILoginDisplay::ShowError(int error_msg_id, 89 void WebUILoginDisplay::ShowError(int error_msg_id,
87 int login_attempts, 90 int login_attempts,
88 HelpAppLauncher::HelpTopic help_topic_id) { 91 HelpAppLauncher::HelpTopic help_topic_id) {
89 VLOG(1) << "Show error, error_id: " << error_msg_id 92 VLOG(1) << "Show error, error_id: " << error_msg_id
90 << ", attempts:" << login_attempts 93 << ", attempts:" << login_attempts
91 << ", help_topic_id: " << help_topic_id; 94 << ", help_topic_id: " << help_topic_id;
92 DCHECK(webui_handler_); 95 if (!webui_handler_)
96 return;
93 97
94 std::string error_text; 98 std::string error_text;
95 switch (error_msg_id) { 99 switch (error_msg_id) {
96 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED: 100 case IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED:
97 error_text = l10n_util::GetStringFUTF8( 101 error_text = l10n_util::GetStringFUTF8(
98 error_msg_id, l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); 102 error_msg_id, l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME));
99 break; 103 break;
100 case IDS_LOGIN_ERROR_CAPTIVE_PORTAL: 104 case IDS_LOGIN_ERROR_CAPTIVE_PORTAL:
101 error_text = l10n_util::GetStringFUTF8( 105 error_text = l10n_util::GetStringFUTF8(
102 error_msg_id, delegate()->GetConnectedNetworkName()); 106 error_msg_id, delegate()->GetConnectedNetworkName());
(...skipping 28 matching lines...) Expand all
131 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE); 135 help_link = l10n_util::GetStringUTF8(IDS_LEARN_MORE);
132 break; 136 break;
133 } 137 }
134 138
135 webui_handler_->ShowError(login_attempts, error_text, help_link, 139 webui_handler_->ShowError(login_attempts, error_text, help_link,
136 help_topic_id); 140 help_topic_id);
137 accessibility::MaybeSpeak(error_text); 141 accessibility::MaybeSpeak(error_text);
138 } 142 }
139 143
140 void WebUILoginDisplay::ShowGaiaPasswordChanged(const std::string& username) { 144 void WebUILoginDisplay::ShowGaiaPasswordChanged(const std::string& username) {
141 webui_handler_->ShowGaiaPasswordChanged(username); 145 if (webui_handler_)
146 webui_handler_->ShowGaiaPasswordChanged(username);
142 } 147 }
143 148
144 // WebUILoginDisplay, SigninScreenHandlerDelegate implementation: -------------- 149 // WebUILoginDisplay, SigninScreenHandlerDelegate implementation: --------------
145 void WebUILoginDisplay::CompleteLogin(const std::string& username, 150 void WebUILoginDisplay::CompleteLogin(const std::string& username,
146 const std::string& password) { 151 const std::string& password) {
147 DCHECK(delegate_); 152 DCHECK(delegate_);
148 if (delegate_) 153 if (delegate_)
149 delegate_->CompleteLogin(username, password); 154 delegate_->CompleteLogin(username, password);
150 } 155 }
151 156
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 193 }
189 194
190 void WebUILoginDisplay::SetWebUIHandler( 195 void WebUILoginDisplay::SetWebUIHandler(
191 LoginDisplayWebUIHandler* webui_handler) { 196 LoginDisplayWebUIHandler* webui_handler) {
192 webui_handler_ = webui_handler; 197 webui_handler_ = webui_handler;
193 } 198 }
194 199
195 void WebUILoginDisplay::ShowSigninScreenForCreds( 200 void WebUILoginDisplay::ShowSigninScreenForCreds(
196 const std::string& username, 201 const std::string& username,
197 const std::string& password) { 202 const std::string& password) {
198 DCHECK(webui_handler_); 203 if (webui_handler_)
199 webui_handler_->ShowSigninScreenForCreds(username, password); 204 webui_handler_->ShowSigninScreenForCreds(username, password);
200 } 205 }
201 206
202 const UserList& WebUILoginDisplay::GetUsers() const { 207 const UserList& WebUILoginDisplay::GetUsers() const {
203 return users_; 208 return users_;
204 } 209 }
205 210
206 bool WebUILoginDisplay::IsShowGuest() const { 211 bool WebUILoginDisplay::IsShowGuest() const {
207 return show_guest_; 212 return show_guest_;
208 } 213 }
209 214
210 bool WebUILoginDisplay::IsShowUsers() const { 215 bool WebUILoginDisplay::IsShowUsers() const {
211 return show_users_; 216 return show_users_;
212 } 217 }
213 218
214 bool WebUILoginDisplay::IsShowNewUser() const { 219 bool WebUILoginDisplay::IsShowNewUser() const {
215 return show_new_user_; 220 return show_new_user_;
216 } 221 }
217 222
218 void WebUILoginDisplay::SetDisplayEmail(const std::string& email) { 223 void WebUILoginDisplay::SetDisplayEmail(const std::string& email) {
219 if (delegate_) 224 if (delegate_)
220 delegate_->SetDisplayEmail(email); 225 delegate_->SetDisplayEmail(email);
221 } 226 }
222 227
223 } // namespace chromeos 228 } // 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