Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/screens/user_selection_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/command_line.h" | |
| 13 #include "base/location.h" | 14 #include "base/location.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 16 #include "base/values.h" | 17 #include "base/values.h" |
| 17 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/browser_process_platform_part.h" | 19 #include "chrome/browser/browser_process_platform_part.h" |
| 19 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 20 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 20 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h" | 21 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h" |
| 21 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" | 22 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" |
| 22 #include "chrome/browser/chromeos/login/reauth_stats.h" | 23 #include "chrome/browser/chromeos/login/reauth_stats.h" |
| 23 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 24 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 24 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" | 25 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" |
| 25 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 26 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 26 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 27 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 27 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 28 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 28 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 29 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 29 #include "chrome/browser/signin/easy_unlock_service.h" | 30 #include "chrome/browser/signin/easy_unlock_service.h" |
| 30 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 31 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
| 31 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 32 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 32 #include "chrome/grit/generated_resources.h" | 33 #include "chrome/grit/generated_resources.h" |
| 34 #include "chromeos/chromeos_switches.h" | |
| 33 #include "chromeos/cryptohome/cryptohome_parameters.h" | 35 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 34 #include "chromeos/dbus/cryptohome_client.h" | 36 #include "chromeos/dbus/cryptohome_client.h" |
| 35 #include "chromeos/dbus/dbus_method_call_status.h" | 37 #include "chromeos/dbus/dbus_method_call_status.h" |
| 36 #include "chromeos/dbus/dbus_thread_manager.h" | 38 #include "chromeos/dbus/dbus_thread_manager.h" |
| 39 #include "components/arc/arc_util.h" | |
| 37 #include "components/prefs/pref_service.h" | 40 #include "components/prefs/pref_service.h" |
| 38 #include "components/proximity_auth/screenlock_bridge.h" | 41 #include "components/proximity_auth/screenlock_bridge.h" |
| 39 #include "components/signin/core/account_id/account_id.h" | 42 #include "components/signin/core/account_id/account_id.h" |
| 40 #include "components/user_manager/known_user.h" | 43 #include "components/user_manager/known_user.h" |
| 41 #include "components/user_manager/user_manager.h" | 44 #include "components/user_manager/user_manager.h" |
| 42 #include "components/user_manager/user_type.h" | 45 #include "components/user_manager/user_type.h" |
| 43 #include "ui/base/l10n/l10n_util.h" | 46 #include "ui/base/l10n/l10n_util.h" |
| 44 #include "ui/base/user_activity/user_activity_detector.h" | 47 #include "ui/base/user_activity/user_activity_detector.h" |
| 45 | 48 |
| 46 namespace chromeos { | 49 namespace chromeos { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 return false; | 135 return false; |
| 133 | 136 |
| 134 quick_unlock::QuickUnlockStorage* quick_unlock_storage = | 137 quick_unlock::QuickUnlockStorage* quick_unlock_storage = |
| 135 quick_unlock::QuickUnlockFactory::GetForUser(user); | 138 quick_unlock::QuickUnlockFactory::GetForUser(user); |
| 136 if (!quick_unlock_storage) | 139 if (!quick_unlock_storage) |
| 137 return false; | 140 return false; |
| 138 | 141 |
| 139 return quick_unlock_storage->IsFingerprintAuthenticationAvailable(); | 142 return quick_unlock_storage->IsFingerprintAuthenticationAvailable(); |
| 140 } | 143 } |
| 141 | 144 |
| 145 // Returns true if dircrypto migration check should be performed. | |
| 146 bool ShouldCheckNeedDircryptoMigration() { | |
| 147 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 148 switches::kDisableEncryptionMigration) && | |
| 149 arc::IsArcAvailable(); | |
|
hidehiko
2017/05/02 05:58:57
Just clarification:
Is it ok to pass this flow in
xiyuan
2017/05/02 06:06:04
I skipped the ARC++ KIOSK test because the banner
| |
| 150 } | |
| 151 | |
| 142 } // namespace | 152 } // namespace |
| 143 | 153 |
| 144 // Helper class to call cryptohome to check whether a user needs dircrypto | 154 // Helper class to call cryptohome to check whether a user needs dircrypto |
| 145 // migration. The check results are cached to limit calls to cryptohome. | 155 // migration. The check results are cached to limit calls to cryptohome. |
| 146 class UserSelectionScreen::DircryptoMigrationChecker { | 156 class UserSelectionScreen::DircryptoMigrationChecker { |
| 147 public: | 157 public: |
| 148 explicit DircryptoMigrationChecker(UserSelectionScreen* owner) | 158 explicit DircryptoMigrationChecker(UserSelectionScreen* owner) |
| 149 : owner_(owner), weak_ptr_factory_(this) {} | 159 : owner_(owner), weak_ptr_factory_(this) {} |
| 150 ~DircryptoMigrationChecker() = default; | 160 ~DircryptoMigrationChecker() = default; |
| 151 | 161 |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 if (!token_handle_util_.get()) { | 539 if (!token_handle_util_.get()) { |
| 530 token_handle_util_.reset(new TokenHandleUtil()); | 540 token_handle_util_.reset(new TokenHandleUtil()); |
| 531 } | 541 } |
| 532 | 542 |
| 533 if (token_handle_util_->HasToken(account_id)) { | 543 if (token_handle_util_->HasToken(account_id)) { |
| 534 token_handle_util_->CheckToken( | 544 token_handle_util_->CheckToken( |
| 535 account_id, base::Bind(&UserSelectionScreen::OnUserStatusChecked, | 545 account_id, base::Bind(&UserSelectionScreen::OnUserStatusChecked, |
| 536 weak_factory_.GetWeakPtr())); | 546 weak_factory_.GetWeakPtr())); |
| 537 } | 547 } |
| 538 | 548 |
| 539 // Run dircrypto migration check only on the login screen. | 549 // Run dircrypto migration check only on the login screen when necessary. |
| 540 if (display_type_ == OobeUI::kLoginDisplay) { | 550 if (display_type_ == OobeUI::kLoginDisplay && |
| 551 ShouldCheckNeedDircryptoMigration()) { | |
| 541 if (!dircrypto_migration_checker_) { | 552 if (!dircrypto_migration_checker_) { |
| 542 dircrypto_migration_checker_ = | 553 dircrypto_migration_checker_ = |
| 543 base::MakeUnique<DircryptoMigrationChecker>(this); | 554 base::MakeUnique<DircryptoMigrationChecker>(this); |
| 544 } | 555 } |
| 545 dircrypto_migration_checker_->Check(account_id); | 556 dircrypto_migration_checker_->Check(account_id); |
|
Junichi Uekawa
2017/05/02 05:02:24
From what I can see from src/chrome/browser/chrome
xiyuan
2017/05/02 05:48:57
Correct. The CL is needed because cryptohomed does
| |
| 546 } | 557 } |
| 547 } | 558 } |
| 548 | 559 |
| 549 void UserSelectionScreen::OnUserStatusChecked( | 560 void UserSelectionScreen::OnUserStatusChecked( |
| 550 const AccountId& account_id, | 561 const AccountId& account_id, |
| 551 TokenHandleUtil::TokenHandleStatus status) { | 562 TokenHandleUtil::TokenHandleStatus status) { |
| 552 if (status == TokenHandleUtil::INVALID) { | 563 if (status == TokenHandleUtil::INVALID) { |
| 553 RecordReauthReason(account_id, ReauthReason::INVALID_TOKEN_HANDLE); | 564 RecordReauthReason(account_id, ReauthReason::INVALID_TOKEN_HANDLE); |
| 554 token_handle_util_->MarkHandleInvalid(account_id); | 565 token_handle_util_->MarkHandleInvalid(account_id); |
| 555 SetAuthType(account_id, ONLINE_SIGN_IN, base::string16()); | 566 SetAuthType(account_id, ONLINE_SIGN_IN, base::string16()); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 // The user profile should exist if and only if this is the lock screen. | 690 // The user profile should exist if and only if this is the lock screen. |
| 680 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); | 691 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); |
| 681 | 692 |
| 682 if (!profile) | 693 if (!profile) |
| 683 profile = profile_helper->GetSigninProfile(); | 694 profile = profile_helper->GetSigninProfile(); |
| 684 | 695 |
| 685 return EasyUnlockService::Get(profile); | 696 return EasyUnlockService::Get(profile); |
| 686 } | 697 } |
| 687 | 698 |
| 688 } // namespace chromeos | 699 } // namespace chromeos |
| OLD | NEW |