| 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 18 matching lines...) Expand all Loading... |
| 29 g_instance = nullptr; | 29 g_instance = nullptr; |
| 30 } | 30 } |
| 31 | 31 |
| 32 // static | 32 // static |
| 33 LockScreenClient* LockScreenClient::Get() { | 33 LockScreenClient* LockScreenClient::Get() { |
| 34 return g_instance; | 34 return g_instance; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void LockScreenClient::AuthenticateUser(const AccountId& account_id, | 37 void LockScreenClient::AuthenticateUser(const AccountId& account_id, |
| 38 const std::string& hashed_password, | 38 const std::string& hashed_password, |
| 39 bool authenticated_by_pin) { | 39 bool authenticated_by_pin, |
| 40 AuthenticateUserCallback callback) { |
| 40 // TODO(xiaoyinh): Complete the implementation below. | 41 // TODO(xiaoyinh): Complete the implementation below. |
| 41 // It should be similar as SigninScreenHandler::HandleAuthenticateUser. | 42 // It should be similar as SigninScreenHandler::HandleAuthenticateUser. |
| 42 chromeos::UserContext user_context(account_id); | 43 chromeos::UserContext user_context(account_id); |
| 43 chromeos::Key key(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, | 44 chromeos::Key key(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, |
| 44 std::string(), hashed_password); | 45 std::string(), hashed_password); |
| 45 user_context.SetKey(key); | 46 user_context.SetKey(key); |
| 46 user_context.SetIsUsingPin(authenticated_by_pin); | 47 user_context.SetIsUsingPin(authenticated_by_pin); |
| 47 chromeos::ScreenLocker::default_screen_locker()->Authenticate(user_context); | 48 chromeos::ScreenLocker::default_screen_locker()->Authenticate( |
| 49 user_context, std::move(callback)); |
| 50 } |
| 51 |
| 52 void LockScreenClient::ShowLockScreen( |
| 53 ash::mojom::LockScreen::ShowLockScreenCallback on_shown) { |
| 54 lock_screen_->ShowLockScreen(std::move(on_shown)); |
| 48 } | 55 } |
| 49 | 56 |
| 50 void LockScreenClient::ShowErrorMessage(int32_t login_attempts, | 57 void LockScreenClient::ShowErrorMessage(int32_t login_attempts, |
| 51 const std::string& error_text, | 58 const std::string& error_text, |
| 52 const std::string& help_link_text, | 59 const std::string& help_link_text, |
| 53 int32_t help_topic_id) { | 60 int32_t help_topic_id) { |
| 54 lock_screen_->ShowErrorMessage(login_attempts, error_text, help_link_text, | 61 lock_screen_->ShowErrorMessage(login_attempts, error_text, help_link_text, |
| 55 help_topic_id); | 62 help_topic_id); |
| 56 } | 63 } |
| 57 | 64 |
| 58 void LockScreenClient::ClearErrors() { | 65 void LockScreenClient::ClearErrors() { |
| 59 lock_screen_->ClearErrors(); | 66 lock_screen_->ClearErrors(); |
| 60 } | 67 } |
| OLD | NEW |