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

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

Issue 2452983002: ChromeOS: This CL moves chromeos/login/user_names* to user_mananger. (Closed)
Patch Set: Update after review. Created 4 years, 1 month 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
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/existing_user_controller.h" 5 #include "chrome/browser/chromeos/login/existing_user_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" 46 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
47 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" 47 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h"
48 #include "chrome/common/channel_info.h" 48 #include "chrome/common/channel_info.h"
49 #include "chrome/common/chrome_switches.h" 49 #include "chrome/common/chrome_switches.h"
50 #include "chrome/common/url_constants.h" 50 #include "chrome/common/url_constants.h"
51 #include "chrome/grit/generated_resources.h" 51 #include "chrome/grit/generated_resources.h"
52 #include "chromeos/chromeos_switches.h" 52 #include "chromeos/chromeos_switches.h"
53 #include "chromeos/dbus/dbus_thread_manager.h" 53 #include "chromeos/dbus/dbus_thread_manager.h"
54 #include "chromeos/dbus/power_manager_client.h" 54 #include "chromeos/dbus/power_manager_client.h"
55 #include "chromeos/dbus/session_manager_client.h" 55 #include "chromeos/dbus/session_manager_client.h"
56 #include "chromeos/login/user_names.h"
57 #include "chromeos/settings/cros_settings_names.h" 56 #include "chromeos/settings/cros_settings_names.h"
58 #include "components/google/core/browser/google_util.h" 57 #include "components/google/core/browser/google_util.h"
59 #include "components/policy/core/common/cloud/cloud_policy_core.h" 58 #include "components/policy/core/common/cloud/cloud_policy_core.h"
60 #include "components/policy/core/common/cloud/cloud_policy_store.h" 59 #include "components/policy/core/common/cloud/cloud_policy_store.h"
61 #include "components/policy/core/common/policy_map.h" 60 #include "components/policy/core/common/policy_map.h"
62 #include "components/policy/core/common/policy_service.h" 61 #include "components/policy/core/common/policy_service.h"
63 #include "components/policy/core/common/policy_types.h" 62 #include "components/policy/core/common/policy_types.h"
64 #include "components/policy/policy_constants.h" 63 #include "components/policy/policy_constants.h"
65 #include "components/prefs/pref_service.h" 64 #include "components/prefs/pref_service.h"
66 #include "components/signin/core/account_id/account_id.h" 65 #include "components/signin/core/account_id/account_id.h"
67 #include "components/signin/core/browser/signin_client.h" 66 #include "components/signin/core/browser/signin_client.h"
68 #include "components/user_manager/known_user.h" 67 #include "components/user_manager/known_user.h"
69 #include "components/user_manager/user_manager.h" 68 #include "components/user_manager/user_manager.h"
69 #include "components/user_manager/user_names.h"
70 #include "components/user_manager/user_type.h" 70 #include "components/user_manager/user_type.h"
71 #include "components/version_info/version_info.h" 71 #include "components/version_info/version_info.h"
72 #include "content/public/browser/browser_thread.h" 72 #include "content/public/browser/browser_thread.h"
73 #include "content/public/browser/notification_service.h" 73 #include "content/public/browser/notification_service.h"
74 #include "content/public/browser/notification_types.h" 74 #include "content/public/browser/notification_types.h"
75 #include "content/public/browser/user_metrics.h" 75 #include "content/public/browser/user_metrics.h"
76 #include "google_apis/gaia/gaia_auth_util.h" 76 #include "google_apis/gaia/gaia_auth_util.h"
77 #include "google_apis/gaia/google_service_auth_error.h" 77 #include "google_apis/gaia/google_service_auth_error.h"
78 #include "net/http/http_auth_cache.h" 78 #include "net/http/http_auth_cache.h"
79 #include "net/http/http_network_session.h" 79 #include "net/http/http_network_session.h"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 404
405 // Use the same LoginPerformer for subsequent login as it has state 405 // Use the same LoginPerformer for subsequent login as it has state
406 // such as Authenticator instance. 406 // such as Authenticator instance.
407 if (!login_performer_.get() || num_login_attempts_ <= 1) { 407 if (!login_performer_.get() || num_login_attempts_ <= 1) {
408 // Only one instance of LoginPerformer should exist at a time. 408 // Only one instance of LoginPerformer should exist at a time.
409 login_performer_.reset(nullptr); 409 login_performer_.reset(nullptr);
410 login_performer_.reset(new ChromeLoginPerformer(this)); 410 login_performer_.reset(new ChromeLoginPerformer(this));
411 } 411 }
412 412
413 if (gaia::ExtractDomainName(user_context.GetAccountId().GetUserEmail()) == 413 if (gaia::ExtractDomainName(user_context.GetAccountId().GetUserEmail()) ==
414 chromeos::login::kSupervisedUserDomain) { 414 user_manager::kSupervisedUserDomain) {
415 login_performer_->LoginAsSupervisedUser(user_context); 415 login_performer_->LoginAsSupervisedUser(user_context);
416 } else { 416 } else {
417 login_performer_->PerformLogin(user_context, auth_mode); 417 login_performer_->PerformLogin(user_context, auth_mode);
418 RecordPasswordLoginEvent(user_context); 418 RecordPasswordLoginEvent(user_context);
419 } 419 }
420 SendAccessibilityAlert( 420 SendAccessibilityAlert(
421 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); 421 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN));
422 } 422 }
423 423
424 void ExistingUserController::MigrateUserData(const std::string& old_password) { 424 void ExistingUserController::MigrateUserData(const std::string& old_password) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 if (failure.reason() == AuthFailure::OWNER_REQUIRED) { 582 if (failure.reason() == AuthFailure::OWNER_REQUIRED) {
583 ShowError(IDS_LOGIN_ERROR_OWNER_REQUIRED, error); 583 ShowError(IDS_LOGIN_ERROR_OWNER_REQUIRED, error);
584 content::BrowserThread::PostDelayedTask( 584 content::BrowserThread::PostDelayedTask(
585 content::BrowserThread::UI, FROM_HERE, 585 content::BrowserThread::UI, FROM_HERE,
586 base::Bind(&SessionManagerClient::StopSession, 586 base::Bind(&SessionManagerClient::StopSession,
587 base::Unretained(DBusThreadManager::Get()-> 587 base::Unretained(DBusThreadManager::Get()->
588 GetSessionManagerClient())), 588 GetSessionManagerClient())),
589 base::TimeDelta::FromMilliseconds(kSafeModeRestartUiDelayMs)); 589 base::TimeDelta::FromMilliseconds(kSafeModeRestartUiDelayMs));
590 } else if (failure.reason() == AuthFailure::TPM_ERROR) { 590 } else if (failure.reason() == AuthFailure::TPM_ERROR) {
591 ShowTPMError(); 591 ShowTPMError();
592 } else if (last_login_attempt_account_id_ == login::GuestAccountId()) { 592 } else if (last_login_attempt_account_id_ == user_manager::GuestAccountId()) {
593 // Show no errors, just re-enable input. 593 // Show no errors, just re-enable input.
594 login_display_->ClearAndEnablePassword(); 594 login_display_->ClearAndEnablePassword();
595 StartPublicSessionAutoLoginTimer(); 595 StartPublicSessionAutoLoginTimer();
596 } else { 596 } else {
597 // Check networking after trying to login in case user is 597 // Check networking after trying to login in case user is
598 // cached locally or the local admin account. 598 // cached locally or the local admin account.
599 const bool is_known_user = user_manager::UserManager::Get()->IsKnownUser( 599 const bool is_known_user = user_manager::UserManager::Get()->IsKnownUser(
600 last_login_attempt_account_id_); 600 last_login_attempt_account_id_);
601 if (!network_state_helper_->IsConnected()) { 601 if (!network_state_helper_->IsConnected()) {
602 if (is_known_user) 602 if (is_known_user)
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 } 800 }
801 801
802 bool ExistingUserController::password_changed() const { 802 bool ExistingUserController::password_changed() const {
803 if (login_performer_) 803 if (login_performer_)
804 return login_performer_->password_changed(); 804 return login_performer_->password_changed();
805 805
806 return password_changed_; 806 return password_changed_;
807 } 807 }
808 808
809 void ExistingUserController::LoginAsGuest() { 809 void ExistingUserController::LoginAsGuest() {
810 PerformPreLoginActions( 810 PerformPreLoginActions(UserContext(user_manager::USER_TYPE_GUEST,
811 UserContext(user_manager::USER_TYPE_GUEST, login::GuestAccountId())); 811 user_manager::GuestAccountId()));
812 812
813 bool allow_guest; 813 bool allow_guest;
814 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); 814 cros_settings_->GetBoolean(kAccountsPrefAllowGuest, &allow_guest);
815 if (!allow_guest) { 815 if (!allow_guest) {
816 // Disallowed. The UI should normally not show the guest session button. 816 // Disallowed. The UI should normally not show the guest session button.
817 LOG(ERROR) << "Guest login attempt when guest mode is disallowed."; 817 LOG(ERROR) << "Guest login attempt when guest mode is disallowed.";
818 PerformLoginFinishedActions(true /* start public session timer */); 818 PerformLoginFinishedActions(true /* start public session timer */);
819 display_email_.clear(); 819 display_email_.clear();
820 return; 820 return;
821 } 821 }
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 } 1262 }
1263 1263
1264 // Otherwise, show the unrecoverable cryptohome error UI and ask user's 1264 // Otherwise, show the unrecoverable cryptohome error UI and ask user's
1265 // permission to collect a feedback. 1265 // permission to collect a feedback.
1266 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_CRYPTOHOME_FAILURE); 1266 RecordPasswordChangeFlow(LOGIN_PASSWORD_CHANGE_FLOW_CRYPTOHOME_FAILURE);
1267 VLOG(1) << "Show unrecoverable cryptohome error dialog."; 1267 VLOG(1) << "Show unrecoverable cryptohome error dialog.";
1268 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); 1268 login_display_->ShowUnrecoverableCrypthomeErrorDialog();
1269 } 1269 }
1270 1270
1271 } // namespace chromeos 1271 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698