OLD | NEW |
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" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/chromeos/boot_times_loader.h" | 17 #include "chrome/browser/chromeos/boot_times_loader.h" |
18 #include "chrome/browser/chromeos/login/login_utils.h" | 18 #include "chrome/browser/chromeos/login/login_utils.h" |
19 #include "chrome/browser/chromeos/login/managed/locally_managed_user_login_flow.
h" | 19 #include "chrome/browser/chromeos/login/managed/locally_managed_user_login_flow.
h" |
20 #include "chrome/browser/chromeos/login/screen_locker.h" | 20 #include "chrome/browser/chromeos/login/screen_locker.h" |
21 #include "chrome/browser/chromeos/login/user_manager.h" | 21 #include "chrome/browser/chromeos/login/user_manager.h" |
22 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 22 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 23 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
23 #include "chrome/browser/chromeos/settings/cros_settings.h" | 24 #include "chrome/browser/chromeos/settings/cros_settings.h" |
24 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 25 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
25 #include "chrome/browser/policy/browser_policy_connector.h" | 26 #include "chrome/browser/policy/browser_policy_connector.h" |
26 #include "chrome/browser/profiles/profile.h" | |
27 #include "chrome/browser/profiles/profile_manager.h" | |
28 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
29 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
30 #include "chromeos/dbus/dbus_thread_manager.h" | 29 #include "chromeos/dbus/dbus_thread_manager.h" |
31 #include "chromeos/dbus/session_manager_client.h" | 30 #include "chromeos/dbus/session_manager_client.h" |
32 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
33 #include "content/public/browser/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
34 #include "content/public/browser/notification_types.h" | 33 #include "content/public/browser/notification_types.h" |
35 #include "content/public/browser/user_metrics.h" | 34 #include "content/public/browser/user_metrics.h" |
36 #include "google_apis/gaia/gaia_auth_util.h" | 35 #include "google_apis/gaia/gaia_auth_util.h" |
37 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 void LoginPerformer::ResolveScreenUnlocked() { | 473 void LoginPerformer::ResolveScreenUnlocked() { |
475 DVLOG(1) << "Screen unlocked"; | 474 DVLOG(1) << "Screen unlocked"; |
476 registrar_.RemoveAll(); | 475 registrar_.RemoveAll(); |
477 // 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. |
478 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 477 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
479 } | 478 } |
480 | 479 |
481 void LoginPerformer::StartLoginCompletion() { | 480 void LoginPerformer::StartLoginCompletion() { |
482 DVLOG(1) << "Login completion started"; | 481 DVLOG(1) << "Login completion started"; |
483 BootTimesLoader::Get()->AddLoginTimeMarker("AuthStarted", false); | 482 BootTimesLoader::Get()->AddLoginTimeMarker("AuthStarted", false); |
484 Profile* profile = g_browser_process->profile_manager()->GetDefaultProfile(); | 483 Profile* profile = ProfileHelper::GetSigninProfile(); |
485 | 484 |
486 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 485 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
487 BrowserThread::PostTask( | 486 BrowserThread::PostTask( |
488 BrowserThread::UI, FROM_HERE, | 487 BrowserThread::UI, FROM_HERE, |
489 base::Bind(&Authenticator::CompleteLogin, authenticator_.get(), | 488 base::Bind(&Authenticator::CompleteLogin, authenticator_.get(), |
490 profile, | 489 profile, |
491 user_context_)); | 490 user_context_)); |
492 | 491 |
493 user_context_.password.clear(); | 492 user_context_.password.clear(); |
494 user_context_.auth_code.clear(); | 493 user_context_.auth_code.clear(); |
495 } | 494 } |
496 | 495 |
497 void LoginPerformer::StartAuthentication() { | 496 void LoginPerformer::StartAuthentication() { |
498 DVLOG(1) << "Auth started"; | 497 DVLOG(1) << "Auth started"; |
499 BootTimesLoader::Get()->AddLoginTimeMarker("AuthStarted", false); | 498 BootTimesLoader::Get()->AddLoginTimeMarker("AuthStarted", false); |
500 Profile* profile; | 499 Profile* profile = ProfileHelper::GetSigninProfile(); |
501 { | |
502 // This should be the first place where GetDefaultProfile() is called with | |
503 // logged_in_ = true. This will trigger a call to Profile::CreateProfile() | |
504 // which requires IO access. | |
505 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
506 profile = g_browser_process->profile_manager()->GetDefaultProfile(); | |
507 } | |
508 if (delegate_) { | 500 if (delegate_) { |
509 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 501 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
510 BrowserThread::PostTask( | 502 BrowserThread::PostTask( |
511 BrowserThread::UI, FROM_HERE, | 503 BrowserThread::UI, FROM_HERE, |
512 base::Bind(&Authenticator::AuthenticateToLogin, authenticator_.get(), | 504 base::Bind(&Authenticator::AuthenticateToLogin, authenticator_.get(), |
513 profile, | 505 profile, |
514 user_context_, | 506 user_context_, |
515 std::string(), | 507 std::string(), |
516 std::string())); | 508 std::string())); |
517 // Make unobtrusive online check. It helps to determine password change | 509 // Make unobtrusive online check. It helps to determine password change |
(...skipping 10 matching lines...) Expand all Loading... |
528 profile, | 520 profile, |
529 user_context_, | 521 user_context_, |
530 std::string(), | 522 std::string(), |
531 std::string())); | 523 std::string())); |
532 } | 524 } |
533 user_context_.password.clear(); | 525 user_context_.password.clear(); |
534 user_context_.auth_code.clear(); | 526 user_context_.auth_code.clear(); |
535 } | 527 } |
536 | 528 |
537 } // namespace chromeos | 529 } // namespace chromeos |
OLD | NEW |