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

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

Issue 6469027: [cros] Report captive portal message when we suspect that might be the case. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 10 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 | « chrome/browser/chromeos/login/views_login_display.h ('k') | no next file » | 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) 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/views_login_display.h" 5 #include "chrome/browser/chromeos/login/views_login_display.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "chrome/browser/chromeos/login/help_app_launcher.h" 10 #include "chrome/browser/chromeos/login/help_app_launcher.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 if (is_enabled) 186 if (is_enabled)
187 controllers_[selected_view_index_]->ClearAndEnablePassword(); 187 controllers_[selected_view_index_]->ClearAndEnablePassword();
188 } 188 }
189 189
190 void ViewsLoginDisplay::ShowError(int error_msg_id, 190 void ViewsLoginDisplay::ShowError(int error_msg_id,
191 int login_attempts, 191 int login_attempts,
192 HelpAppLauncher::HelpTopic help_topic_id) { 192 HelpAppLauncher::HelpTopic help_topic_id) {
193 ClearErrors(); 193 ClearErrors();
194 string16 error_text; 194 string16 error_text;
195 error_msg_id_ = error_msg_id;
195 help_topic_id_ = help_topic_id; 196 help_topic_id_ = help_topic_id;
196 197
197 // GetStringF fails on debug build if there's no replacement in the string. 198 // GetStringF fails on debug build if there's no replacement in the string.
198 if (error_msg_id == IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED) { 199 if (error_msg_id == IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED) {
199 error_text = l10n_util::GetStringFUTF16( 200 error_text = l10n_util::GetStringFUTF16(
200 error_msg_id, l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); 201 error_msg_id, l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME));
201 } else { 202 } else {
202 error_text = l10n_util::GetStringUTF16(error_msg_id); 203 error_text = l10n_util::GetStringUTF16(error_msg_id);
203 } 204 }
204 205
205 gfx::Rect bounds = 206 gfx::Rect bounds =
206 controllers_[selected_view_index_]->GetMainInputScreenBounds(); 207 controllers_[selected_view_index_]->GetMainInputScreenBounds();
207 BubbleBorder::ArrowLocation arrow; 208 BubbleBorder::ArrowLocation arrow;
208 if (controllers_[selected_view_index_]->is_new_user()) { 209 if (controllers_[selected_view_index_]->is_new_user()) {
209 arrow = BubbleBorder::LEFT_TOP; 210 arrow = BubbleBorder::LEFT_TOP;
210 } else { 211 } else {
211 // Point info bubble arrow to cursor position (approximately). 212 // Point info bubble arrow to cursor position (approximately).
212 bounds.set_width(kCursorOffset * 2); 213 bounds.set_width(kCursorOffset * 2);
213 arrow = BubbleBorder::BOTTOM_LEFT; 214 arrow = BubbleBorder::BOTTOM_LEFT;
214 } 215 }
215 216
216 string16 help_link; 217 string16 help_link;
217 if (error_msg_id == IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED || 218 if (error_msg_id == IDS_LOGIN_ERROR_CAPTIVE_PORTAL) {
218 login_attempts > 1) { 219 help_link = l10n_util::GetStringUTF16(IDS_LOGIN_FIX_CAPTIVE_PORTAL);
220 } else if (error_msg_id == IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED ||
221 login_attempts > 1) {
219 help_link = l10n_util::GetStringUTF16(IDS_LEARN_MORE); 222 help_link = l10n_util::GetStringUTF16(IDS_LEARN_MORE);
220 } 223 }
221 224
222 bubble_ = MessageBubble::Show( 225 bubble_ = MessageBubble::Show(
223 controllers_[selected_view_index_]->controls_window(), 226 controllers_[selected_view_index_]->controls_window(),
224 bounds, 227 bounds,
225 arrow, 228 arrow,
226 ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING), 229 ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING),
227 UTF16ToWide(error_text), 230 UTF16ToWide(error_text),
228 UTF16ToWide(help_link), 231 UTF16ToWide(help_link),
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 message.set_param(0, index); 283 message.set_param(0, index);
281 WmIpc::instance()->SendMessage(message); 284 WmIpc::instance()->SendMessage(message);
282 } 285 }
283 } 286 }
284 287
285 //////////////////////////////////////////////////////////////////////////////// 288 ////////////////////////////////////////////////////////////////////////////////
286 // ViewsLoginDisplay, views::MessageBubbleDelegate implementation: 289 // ViewsLoginDisplay, views::MessageBubbleDelegate implementation:
287 // 290 //
288 291
289 void ViewsLoginDisplay::OnHelpLinkActivated() { 292 void ViewsLoginDisplay::OnHelpLinkActivated() {
293 if (error_msg_id_ == IDS_LOGIN_ERROR_CAPTIVE_PORTAL) {
294 delegate()->FixCaptivePortal();
295 return;
296 }
290 if (!parent_window()) 297 if (!parent_window())
291 return; 298 return;
292 if (!help_app_.get()) 299 if (!help_app_.get())
293 help_app_.reset(new HelpAppLauncher(parent_window())); 300 help_app_.reset(new HelpAppLauncher(parent_window()));
294 help_app_->ShowHelpTopic(help_topic_id_); 301 help_app_->ShowHelpTopic(help_topic_id_);
295 } 302 }
296 303
297 //////////////////////////////////////////////////////////////////////////////// 304 ////////////////////////////////////////////////////////////////////////////////
298 // ViewsLoginDisplay, private: 305 // ViewsLoginDisplay, private:
299 // 306 //
300 307
301 UserController* ViewsLoginDisplay::GetUserControllerByEmail( 308 UserController* ViewsLoginDisplay::GetUserControllerByEmail(
302 const std::string& email) { 309 const std::string& email) {
303 std::vector<UserController*>::iterator i; 310 std::vector<UserController*>::iterator i;
304 for (i = controllers_.begin(); i != controllers_.end(); ++i) { 311 for (i = controllers_.begin(); i != controllers_.end(); ++i) {
305 if ((*i)->user().email() == email) 312 if ((*i)->user().email() == email)
306 return *i; 313 return *i;
307 } 314 }
308 for (i = invisible_controllers_.begin(); 315 for (i = invisible_controllers_.begin();
309 i != invisible_controllers_.end(); ++i) { 316 i != invisible_controllers_.end(); ++i) {
310 if ((*i)->user().email() == email) 317 if ((*i)->user().email() == email)
311 return *i; 318 return *i;
312 } 319 }
313 return NULL; 320 return NULL;
314 } 321 }
315 322
316 } // namespace chromeos 323 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/views_login_display.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698