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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
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/login_performer.h" 5 #include "chrome/browser/chromeos/login/login_performer.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 initial_online_auth_pending_ = false; 103 initial_online_auth_pending_ = false;
104 104
105 // Offline auth - OK, online auth - failed. 105 // Offline auth - OK, online auth - failed.
106 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED) { 106 if (failure.reason() == LoginFailure::NETWORK_AUTH_FAILED) {
107 ResolveInitialNetworkAuthFailure(); 107 ResolveInitialNetworkAuthFailure();
108 } else if (failure.reason() == LoginFailure::LOGIN_TIMED_OUT) { 108 } else if (failure.reason() == LoginFailure::LOGIN_TIMED_OUT) {
109 VLOG(1) << "Online login timed out. " 109 VLOG(1) << "Online login timed out. "
110 << "Granting user access based on offline auth only."; 110 << "Granting user access based on offline auth only.";
111 // ScreenLock is not active, it's ok to delete itself. 111 // ScreenLock is not active, it's ok to delete itself.
112 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 112 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
113 } else { 113 } else {
114 // COULD_NOT_MOUNT_CRYPTOHOME, COULD_NOT_MOUNT_TMPFS: 114 // COULD_NOT_MOUNT_CRYPTOHOME, COULD_NOT_MOUNT_TMPFS:
115 // happens during offline auth only. 115 // happens during offline auth only.
116 // UNLOCK_FAILED is used during normal screen lock case. 116 // UNLOCK_FAILED is used during normal screen lock case.
117 // TODO(nkostylev) DATA_REMOVAL_FAILED - ? 117 // TODO(nkostylev) DATA_REMOVAL_FAILED - ?
118 NOTREACHED(); 118 NOTREACHED();
119 } 119 }
120 } 120 }
121 121
122 void LoginPerformer::OnRetailModeLoginSuccess( 122 void LoginPerformer::OnRetailModeLoginSuccess(
(...skipping 20 matching lines...) Expand all
143 143
144 VLOG(1) << "LoginSuccess hash: " << user_context.username_hash 144 VLOG(1) << "LoginSuccess hash: " << user_context.username_hash
145 << ", pending_requests " << pending_requests; 145 << ", pending_requests " << pending_requests;
146 DCHECK(delegate_); 146 DCHECK(delegate_);
147 // After delegate_->OnLoginSuccess(...) is called, delegate_ releases 147 // After delegate_->OnLoginSuccess(...) is called, delegate_ releases
148 // LoginPerformer ownership. LP now manages it's lifetime on its own. 148 // LoginPerformer ownership. LP now manages it's lifetime on its own.
149 // 2 things could make it exist longer: 149 // 2 things could make it exist longer:
150 // 1. ScreenLock active (pending correct new password input) 150 // 1. ScreenLock active (pending correct new password input)
151 // 2. Pending online auth request. 151 // 2. Pending online auth request.
152 if (!pending_requests) 152 if (!pending_requests)
153 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 153 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
154 else 154 else
155 initial_online_auth_pending_ = true; 155 initial_online_auth_pending_ = true;
156 156
157 delegate_->OnLoginSuccess(user_context, 157 delegate_->OnLoginSuccess(user_context,
158 pending_requests, 158 pending_requests,
159 using_oauth); 159 using_oauth);
160 } 160 }
161 161
162 void LoginPerformer::OnOffTheRecordLoginSuccess() { 162 void LoginPerformer::OnOffTheRecordLoginSuccess() {
163 content::RecordAction( 163 content::RecordAction(
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 case GoogleServiceAuthError::CONNECTION_FAILED: 369 case GoogleServiceAuthError::CONNECTION_FAILED:
370 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: 370 case GoogleServiceAuthError::SERVICE_UNAVAILABLE:
371 case GoogleServiceAuthError::TWO_FACTOR: 371 case GoogleServiceAuthError::TWO_FACTOR:
372 case GoogleServiceAuthError::REQUEST_CANCELED: 372 case GoogleServiceAuthError::REQUEST_CANCELED:
373 // Offline auth already done. Online auth will be done next time 373 // Offline auth already done. Online auth will be done next time
374 // or once user accesses web property. 374 // or once user accesses web property.
375 VLOG(1) << "Granting user access based on offline auth only. " 375 VLOG(1) << "Granting user access based on offline auth only. "
376 << "Online login failed with " 376 << "Online login failed with "
377 << last_login_failure_.error().state(); 377 << last_login_failure_.error().state();
378 // Resolving initial online auth failure, no ScreenLock is active. 378 // Resolving initial online auth failure, no ScreenLock is active.
379 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 379 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
380 return; 380 return;
381 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS: 381 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS:
382 // Offline auth OK, so it might be the case of changed password. 382 // Offline auth OK, so it might be the case of changed password.
383 password_changed_ = true; 383 password_changed_ = true;
384 case GoogleServiceAuthError::USER_NOT_SIGNED_UP: 384 case GoogleServiceAuthError::USER_NOT_SIGNED_UP:
385 case GoogleServiceAuthError::ACCOUNT_DELETED: 385 case GoogleServiceAuthError::ACCOUNT_DELETED:
386 case GoogleServiceAuthError::ACCOUNT_DISABLED: 386 case GoogleServiceAuthError::ACCOUNT_DISABLED:
387 // Access not granted. User has to sign out. 387 // Access not granted. User has to sign out.
388 // Request screen lock & show error message there. 388 // Request screen lock & show error message there.
389 case GoogleServiceAuthError::CAPTCHA_REQUIRED: 389 case GoogleServiceAuthError::CAPTCHA_REQUIRED:
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 467
468 void LoginPerformer::ResolveScreenLocked() { 468 void LoginPerformer::ResolveScreenLocked() {
469 DVLOG(1) << "Screen locked"; 469 DVLOG(1) << "Screen locked";
470 ResolveLockNetworkAuthFailure(); 470 ResolveLockNetworkAuthFailure();
471 } 471 }
472 472
473 void LoginPerformer::ResolveScreenUnlocked() { 473 void LoginPerformer::ResolveScreenUnlocked() {
474 DVLOG(1) << "Screen unlocked"; 474 DVLOG(1) << "Screen unlocked";
475 registrar_.RemoveAll(); 475 registrar_.RemoveAll();
476 // If screen was unlocked that was for a reason, should delete itself now. 476 // If screen was unlocked that was for a reason, should delete itself now.
477 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 477 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
478 } 478 }
479 479
480 void LoginPerformer::StartLoginCompletion() { 480 void LoginPerformer::StartLoginCompletion() {
481 DVLOG(1) << "Login completion started"; 481 DVLOG(1) << "Login completion started";
482 BootTimesLoader::Get()->AddLoginTimeMarker("AuthStarted", false); 482 BootTimesLoader::Get()->AddLoginTimeMarker("AuthStarted", false);
483 Profile* profile = ProfileHelper::GetSigninProfile(); 483 Profile* profile = ProfileHelper::GetSigninProfile();
484 484
485 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); 485 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this);
486 BrowserThread::PostTask( 486 BrowserThread::PostTask(
487 BrowserThread::UI, FROM_HERE, 487 BrowserThread::UI, FROM_HERE,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 profile, 520 profile,
521 user_context_, 521 user_context_,
522 std::string(), 522 std::string(),
523 std::string())); 523 std::string()));
524 } 524 }
525 user_context_.password.clear(); 525 user_context_.password.clear();
526 user_context_.auth_code.clear(); 526 user_context_.auth_code.clear();
527 } 527 }
528 528
529 } // namespace chromeos 529 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698