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

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

Issue 290483003: Tame the proliferation of UserContext constructors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/auth/login_performer.h" 5 #include "chrome/browser/chromeos/login/auth/login_performer.h"
6 6
7 #include <string>
8
9 #include "base/bind.h" 7 #include "base/bind.h"
10 #include "base/logging.h" 8 #include "base/logging.h"
11 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
12 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
13 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
14 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
15 #include "base/threading/thread_restrictions.h" 13 #include "base/threading/thread_restrictions.h"
16 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/chrome_notification_types.h" 15 #include "chrome/browser/chrome_notification_types.h"
18 #include "chrome/browser/chromeos/boot_times_loader.h" 16 #include "chrome/browser/chromeos/boot_times_loader.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 DVLOG(1) << "Login completion started"; 329 DVLOG(1) << "Login completion started";
332 BootTimesLoader::Get()->AddLoginTimeMarker("AuthStarted", false); 330 BootTimesLoader::Get()->AddLoginTimeMarker("AuthStarted", false);
333 Profile* profile = ProfileHelper::GetSigninProfile(); 331 Profile* profile = ProfileHelper::GetSigninProfile();
334 332
335 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); 333 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this);
336 BrowserThread::PostTask( 334 BrowserThread::PostTask(
337 BrowserThread::UI, FROM_HERE, 335 BrowserThread::UI, FROM_HERE,
338 base::Bind(&Authenticator::CompleteLogin, authenticator_.get(), 336 base::Bind(&Authenticator::CompleteLogin, authenticator_.get(),
339 profile, 337 profile,
340 user_context_)); 338 user_context_));
341 339 user_context_.ClearSecrets();
342 user_context_.SetPassword(std::string());
343 user_context_.SetAuthCode(std::string());
344 } 340 }
345 341
346 void LoginPerformer::StartAuthentication() { 342 void LoginPerformer::StartAuthentication() {
347 DVLOG(1) << "Auth started"; 343 DVLOG(1) << "Auth started";
348 BootTimesLoader::Get()->AddLoginTimeMarker("AuthStarted", false); 344 BootTimesLoader::Get()->AddLoginTimeMarker("AuthStarted", false);
349 Profile* profile = ProfileHelper::GetSigninProfile(); 345 Profile* profile = ProfileHelper::GetSigninProfile();
350 if (delegate_) { 346 if (delegate_) {
351 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); 347 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this);
352 BrowserThread::PostTask( 348 BrowserThread::PostTask(
353 BrowserThread::UI, FROM_HERE, 349 BrowserThread::UI, FROM_HERE,
354 base::Bind(&Authenticator::AuthenticateToLogin, authenticator_.get(), 350 base::Bind(&Authenticator::AuthenticateToLogin, authenticator_.get(),
355 profile, 351 profile,
356 user_context_)); 352 user_context_));
357 // Make unobtrusive online check. It helps to determine password change 353 // Make unobtrusive online check. It helps to determine password change
358 // state in the case when offline login fails. 354 // state in the case when offline login fails.
359 online_attempt_host_.Check(profile, user_context_); 355 online_attempt_host_.Check(profile, user_context_);
360 } else { 356 } else {
361 NOTREACHED(); 357 NOTREACHED();
362 } 358 }
363 user_context_.SetPassword(std::string()); 359 user_context_.ClearSecrets();
364 user_context_.SetAuthCode(std::string());
365 } 360 }
366 361
367 void LoginPerformer::OnlineWildcardLoginCheckCompleted( 362 void LoginPerformer::OnlineWildcardLoginCheckCompleted(
368 policy::WildcardLoginChecker::Result result) { 363 policy::WildcardLoginChecker::Result result) {
369 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { 364 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) {
370 StartLoginCompletion(); 365 StartLoginCompletion();
371 } else { 366 } else {
372 if (delegate_) 367 if (delegate_)
373 delegate_->WhiteListCheckFailed(user_context_.GetUserID()); 368 delegate_->WhiteListCheckFailed(user_context_.GetUserID());
374 } 369 }
375 } 370 }
376 371
377 } // namespace chromeos 372 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/auth/extended_authenticator.cc ('k') | chrome/browser/chromeos/login/auth/mock_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698