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 "base/location.h" | 7 #include "base/location.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/browser_process_platform_part.h" | 12 #include "chrome/browser/browser_process_platform_part.h" |
13 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 13 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
14 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 14 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
15 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" | 15 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" |
16 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 16 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
17 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 17 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
19 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 19 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
20 #include "chrome/browser/profiles/profile.h" | |
21 #include "chrome/browser/profiles/profile_window.h" | |
20 #include "chrome/browser/signin/easy_unlock_service.h" | 22 #include "chrome/browser/signin/easy_unlock_service.h" |
21 #include "chrome/browser/signin/screenlock_bridge.h" | 23 #include "chrome/browser/signin/signin_manager_factory.h" |
22 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 24 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
23 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 25 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
26 #include "components/signin/content/screenlock_bridge.h" | |
27 #include "components/signin/core/browser/signin_manager_base.h" | |
24 #include "components/user_manager/user_id.h" | 28 #include "components/user_manager/user_id.h" |
25 #include "components/user_manager/user_manager.h" | 29 #include "components/user_manager/user_manager.h" |
26 #include "components/user_manager/user_type.h" | 30 #include "components/user_manager/user_type.h" |
27 #include "ui/base/user_activity/user_activity_detector.h" | 31 #include "ui/base/user_activity/user_activity_detector.h" |
28 | 32 |
29 namespace chromeos { | 33 namespace chromeos { |
30 | 34 |
31 namespace { | 35 namespace { |
32 | 36 |
33 // User dictionary keys. | 37 // User dictionary keys. |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
481 } | 485 } |
482 | 486 |
483 void UserSelectionScreen::EnableInput() { | 487 void UserSelectionScreen::EnableInput() { |
484 // If Easy Unlock fails to unlock the screen, re-enable the password input. | 488 // If Easy Unlock fails to unlock the screen, re-enable the password input. |
485 // This is only necessary on the lock screen, because the error handling for | 489 // This is only necessary on the lock screen, because the error handling for |
486 // the sign-in screen uses a different code path. | 490 // the sign-in screen uses a different code path. |
487 if (ScreenLocker::default_screen_locker()) | 491 if (ScreenLocker::default_screen_locker()) |
488 ScreenLocker::default_screen_locker()->EnableInput(); | 492 ScreenLocker::default_screen_locker()->EnableInput(); |
489 } | 493 } |
490 | 494 |
495 void UserSelectionScreen::Lock(content::BrowserContext* browser_context) { | |
496 profiles::LockProfile(Profile::FromBrowserContext(browser_context)); | |
497 } | |
498 | |
499 void UserSelectionScreen::Unlock(content::BrowserContext* browser_context) { | |
500 Profile* profile = Profile::FromBrowserContext(browser_context); | |
501 SigninManagerBase* signin_manager = | |
502 SigninManagerFactory::GetForProfile(profile); | |
Ilya Sherman
2015/04/21 23:02:39
This is not exactly equivalent to the previous imp
msarda
2015/04/22 16:42:42
Done.
| |
503 Unlock(signin_manager->GetAuthenticatedUsername()); | |
504 } | |
Ilya Sherman
2015/04/21 23:02:39
Rather than duplicating the implementations of the
msarda
2015/04/22 16:42:42
I considered using a client interface, however IMH
Ilya Sherman
2015/04/23 07:09:48
The component setup code could call a method to se
| |
505 | |
491 void UserSelectionScreen::Unlock(const std::string& user_email) { | 506 void UserSelectionScreen::Unlock(const std::string& user_email) { |
492 DCHECK_EQ(GetScreenType(), LOCK_SCREEN); | 507 DCHECK_EQ(GetScreenType(), LOCK_SCREEN); |
493 ScreenLocker::Hide(); | 508 ScreenLocker::Hide(); |
494 } | 509 } |
495 | 510 |
496 void UserSelectionScreen::AttemptEasySignin(const std::string& user_id, | 511 void UserSelectionScreen::AttemptEasySignin(const std::string& user_id, |
497 const std::string& secret, | 512 const std::string& secret, |
498 const std::string& key_label) { | 513 const std::string& key_label) { |
499 DCHECK_EQ(GetScreenType(), SIGNIN_SCREEN); | 514 DCHECK_EQ(GetScreenType(), SIGNIN_SCREEN); |
500 | 515 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 // The user profile should exist if and only if this is the lock screen. | 564 // The user profile should exist if and only if this is the lock screen. |
550 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); | 565 DCHECK_EQ(!!profile, GetScreenType() == LOCK_SCREEN); |
551 | 566 |
552 if (!profile) | 567 if (!profile) |
553 profile = profile_helper->GetSigninProfile(); | 568 profile = profile_helper->GetSigninProfile(); |
554 | 569 |
555 return EasyUnlockService::Get(profile); | 570 return EasyUnlockService::Get(profile); |
556 } | 571 } |
557 | 572 |
558 } // namespace chromeos | 573 } // namespace chromeos |
OLD | NEW |