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

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller.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
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/existing_user_controller.h" 5 #include "chrome/browser/chromeos/login/existing_user_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 const char kSettingsSyncLoginURL[] = "chrome://settings/personal"; 43 const char kSettingsSyncLoginURL[] = "chrome://settings/personal";
44 44
45 // URL that will be opened on when user logs in first time on the device. 45 // URL that will be opened on when user logs in first time on the device.
46 const char kGetStartedURL[] = 46 const char kGetStartedURL[] =
47 "chrome-extension://cbmhffdpiobpchciemffincgahkkljig/index.html"; 47 "chrome-extension://cbmhffdpiobpchciemffincgahkkljig/index.html";
48 48
49 // URL for account creation. 49 // URL for account creation.
50 const char kCreateAccountURL[] = 50 const char kCreateAccountURL[] =
51 "https://www.google.com/accounts/NewAccount?service=mail"; 51 "https://www.google.com/accounts/NewAccount?service=mail";
52 52
53 // Landing URL when launching Guest mode to fix captive portal.
54 const char kCaptivePortalLaunchURL[] = "http://www.google.com/";
55
53 // Used to handle the asynchronous response of deleting a cryptohome directory. 56 // Used to handle the asynchronous response of deleting a cryptohome directory.
54 class RemoveAttempt : public CryptohomeLibrary::Delegate { 57 class RemoveAttempt : public CryptohomeLibrary::Delegate {
55 public: 58 public:
56 explicit RemoveAttempt(const std::string& user_email) 59 explicit RemoveAttempt(const std::string& user_email)
57 : user_email_(user_email) { 60 : user_email_(user_email) {
58 if (CrosLibrary::Get()->EnsureLoaded()) { 61 if (CrosLibrary::Get()->EnsureLoaded()) {
59 CrosLibrary::Get()->GetCryptohomeLibrary()->AsyncRemove( 62 CrosLibrary::Get()->GetCryptohomeLibrary()->AsyncRemove(
60 user_email_, this); 63 user_email_, this);
61 } 64 }
62 } 65 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 //////////////////////////////////////////////////////////////////////////////// 195 ////////////////////////////////////////////////////////////////////////////////
193 // ExistingUserController, LoginDisplay::Delegate implementation: 196 // ExistingUserController, LoginDisplay::Delegate implementation:
194 // 197 //
195 198
196 void ExistingUserController::CreateAccount() { 199 void ExistingUserController::CreateAccount() {
197 guest_mode_url_ = 200 guest_mode_url_ =
198 google_util::AppendGoogleLocaleParam(GURL(kCreateAccountURL)); 201 google_util::AppendGoogleLocaleParam(GURL(kCreateAccountURL));
199 LoginAsGuest(); 202 LoginAsGuest();
200 } 203 }
201 204
205 void ExistingUserController::FixCaptivePortal() {
206 guest_mode_url_ = GURL(kCaptivePortalLaunchURL);
207 LoginAsGuest();
208 }
209
202 void ExistingUserController::Login(const std::string& username, 210 void ExistingUserController::Login(const std::string& username,
203 const std::string& password) { 211 const std::string& password) {
204 if (username.empty() || password.empty()) 212 if (username.empty() || password.empty())
205 return; 213 return;
206 SetStatusAreaEnabled(false); 214 SetStatusAreaEnabled(false);
207 // Disable clicking on other windows. 215 // Disable clicking on other windows.
208 login_display_->SetUIEnabled(false); 216 login_display_->SetUIEnabled(false);
209 217
210 BootTimesLoader::Get()->RecordLoginAttempted(); 218 BootTimesLoader::Get()->RecordLoginAttempted();
211 219
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 window->SetIsAlwaysOnTop(true); 329 window->SetIsAlwaysOnTop(true);
322 window->Show(); 330 window->Show();
323 } else { 331 } else {
324 LOG(WARNING) << "No captcha image url was found?"; 332 LOG(WARNING) << "No captcha image url was found?";
325 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); 333 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error);
326 } 334 }
327 } else if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED && 335 } else if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED &&
328 failure.error().state() == 336 failure.error().state() ==
329 GoogleServiceAuthError::HOSTED_NOT_ALLOWED) { 337 GoogleServiceAuthError::HOSTED_NOT_ALLOWED) {
330 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED, error); 338 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED, error);
339 } else if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED &&
340 failure.error().state() ==
341 GoogleServiceAuthError::SERVICE_UNAVAILABLE) {
342 // SERVICE_UNAVAILABLE is generated in 2 cases:
343 // 1. ClientLogin returns ServiceUnavailable code.
344 // 2. Internet connectivity may be behind the captive portal.
345 // Suggesting user to try sign in to a portal in Guest mode.
346 ShowError(IDS_LOGIN_ERROR_CAPTIVE_PORTAL, error);
331 } else { 347 } else {
332 if (!UserManager::Get()->IsKnownUser(last_login_attempt_username_)) 348 if (!UserManager::Get()->IsKnownUser(last_login_attempt_username_))
333 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error); 349 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error);
334 else 350 else
335 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error); 351 ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error);
336 } 352 }
337 } 353 }
338 354
339 // Reenable clicking on other windows and status area. 355 // Reenable clicking on other windows and status area.
340 login_display_->SetUIEnabled(true); 356 login_display_->SetUIEnabled(true);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 help_topic_id = login_performer_->login_timed_out() ? 538 help_topic_id = login_performer_->login_timed_out() ?
523 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE : 539 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE :
524 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; 540 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT;
525 break; 541 break;
526 } 542 }
527 543
528 login_display_->ShowError(error_id, num_login_attempts_, help_topic_id); 544 login_display_->ShowError(error_id, num_login_attempts_, help_topic_id);
529 } 545 }
530 546
531 } // namespace chromeos 547 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/existing_user_controller.h ('k') | chrome/browser/chromeos/login/login_display.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698