OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/ui/ash/lock_screen_client.h" | 5 #include "chrome/browser/ui/ash/lock_screen_client.h" |
6 | 6 |
7 #include "ash/public/interfaces/constants.mojom.h" | 7 #include "ash/public/interfaces/constants.mojom.h" |
8 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 8 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
9 #include "content/public/common/service_manager_connection.h" | 9 #include "content/public/common/service_manager_connection.h" |
10 #include "services/service_manager/public/cpp/connector.h" | 10 #include "services/service_manager/public/cpp/connector.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 g_instance = nullptr; | 32 g_instance = nullptr; |
33 } | 33 } |
34 | 34 |
35 // static | 35 // static |
36 LockScreenClient* LockScreenClient::Get() { | 36 LockScreenClient* LockScreenClient::Get() { |
37 return g_instance; | 37 return g_instance; |
38 } | 38 } |
39 | 39 |
40 void LockScreenClient::AuthenticateUser(const AccountId& account_id, | 40 void LockScreenClient::AuthenticateUser(const AccountId& account_id, |
41 const std::string& hashed_password, | 41 const std::string& hashed_password, |
42 bool authenticated_by_pin) { | 42 bool authenticated_by_pin, |
| 43 AuthenticateUserCallback callback) { |
43 // TODO(xiaoyinh): Complete the implementation below. | 44 // TODO(xiaoyinh): Complete the implementation below. |
44 // It should be similar as SigninScreenHandler::HandleAuthenticateUser. | 45 // It should be similar as SigninScreenHandler::HandleAuthenticateUser. |
45 chromeos::UserContext user_context(account_id); | 46 chromeos::UserContext user_context(account_id); |
46 chromeos::Key key(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, | 47 chromeos::Key key(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, |
47 std::string(), hashed_password); | 48 std::string(), hashed_password); |
48 user_context.SetKey(key); | 49 user_context.SetKey(key); |
49 user_context.SetIsUsingPin(authenticated_by_pin); | 50 user_context.SetIsUsingPin(authenticated_by_pin); |
50 chromeos::ScreenLocker::default_screen_locker()->Authenticate(user_context); | 51 chromeos::ScreenLocker::default_screen_locker()->Authenticate( |
| 52 user_context, std::move(callback)); |
| 53 } |
| 54 |
| 55 void LockScreenClient::ShowLockScreen( |
| 56 ash::mojom::LockScreen::ShowLockScreenCallback on_shown) { |
| 57 lock_screen_->ShowLockScreen(std::move(on_shown)); |
51 } | 58 } |
52 | 59 |
53 void LockScreenClient::AttemptUnlock(const AccountId& account_id) { | 60 void LockScreenClient::AttemptUnlock(const AccountId& account_id) { |
54 if (!delegate_) | 61 if (!delegate_) |
55 return; | 62 return; |
56 delegate_->HandleAttemptUnlock(account_id); | 63 delegate_->HandleAttemptUnlock(account_id); |
57 } | 64 } |
58 | 65 |
59 void LockScreenClient::HardlockPod(const AccountId& account_id) { | 66 void LockScreenClient::HardlockPod(const AccountId& account_id) { |
60 if (!delegate_) | 67 if (!delegate_) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 104 } |
98 | 105 |
99 void LockScreenClient::LoadUsers(std::unique_ptr<base::ListValue> users_list, | 106 void LockScreenClient::LoadUsers(std::unique_ptr<base::ListValue> users_list, |
100 bool show_guest) { | 107 bool show_guest) { |
101 lock_screen_->LoadUsers(std::move(users_list), show_guest); | 108 lock_screen_->LoadUsers(std::move(users_list), show_guest); |
102 } | 109 } |
103 | 110 |
104 void LockScreenClient::SetDelegate(Delegate* delegate) { | 111 void LockScreenClient::SetDelegate(Delegate* delegate) { |
105 delegate_ = delegate; | 112 delegate_ = delegate; |
106 } | 113 } |
OLD | NEW |