 Chromium Code Reviews
 Chromium Code Reviews Issue 2923773003:
  Adding mojo calls for several lock screen related operations.  (Closed)
    
  
    Issue 2923773003:
  Adding mojo calls for several lock screen related operations.  (Closed) 
  | Index: chrome/browser/ui/ash/lock_screen_client.cc | 
| diff --git a/chrome/browser/ui/ash/lock_screen_client.cc b/chrome/browser/ui/ash/lock_screen_client.cc | 
| index 802366a54de0a058d1117cac72a254155cd61a44..6ef93d6730961fd968e14ec96bd91189ec804328 100644 | 
| --- a/chrome/browser/ui/ash/lock_screen_client.cc | 
| +++ b/chrome/browser/ui/ash/lock_screen_client.cc | 
| @@ -4,8 +4,12 @@ | 
| #include "chrome/browser/ui/ash/lock_screen_client.h" | 
| +#include <utility> | 
| + | 
| #include "ash/public/interfaces/constants.mojom.h" | 
| #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 
| +#include "chrome/browser/chromeos/login/reauth_stats.h" | 
| +#include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 
| #include "content/public/common/service_manager_connection.h" | 
| #include "services/service_manager/public/cpp/connector.h" | 
| @@ -43,15 +47,10 @@ void LockScreenClient::AuthenticateUser(const AccountId& account_id, | 
| const std::string& hashed_password, | 
| bool authenticated_by_pin, | 
| AuthenticateUserCallback callback) { | 
| - // TODO(xiaoyinh): Complete the implementation below. | 
| - // It should be similar as SigninScreenHandler::HandleAuthenticateUser. | 
| - chromeos::UserContext user_context(account_id); | 
| - chromeos::Key key(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, | 
| - std::string(), hashed_password); | 
| - user_context.SetKey(key); | 
| - user_context.SetIsUsingPin(authenticated_by_pin); | 
| - chromeos::ScreenLocker::default_screen_locker()->Authenticate( | 
| - user_context, std::move(callback)); | 
| + if (!delegate_) | 
| + return; | 
| + delegate_->HandleAuthenticateUser(account_id, hashed_password, | 
| + authenticated_by_pin, std::move(callback)); | 
| } | 
| void LockScreenClient::ShowLockScreen( | 
| @@ -77,6 +76,32 @@ void LockScreenClient::RecordClickOnLockIcon(const AccountId& account_id) { | 
| delegate_->HandleRecordClickOnLockIcon(account_id); | 
| } | 
| +void LockScreenClient::OnFocusPod(const AccountId& account_id) { | 
| + if (!delegate_) | 
| 
James Cook
2017/06/13 00:58:04
optional: If all these methods do is forward thing
 
xiaoyinh(OOO Sep 11-29)
2017/06/13 18:36:56
Done.
 | 
| + return; | 
| + delegate_->HandleOnFocusPod(account_id); | 
| +} | 
| + | 
| +void LockScreenClient::OnNoPodFocused() { | 
| + if (!delegate_) | 
| + return; | 
| + delegate_->HandleOnNoPodFocused(); | 
| +} | 
| 
James Cook
2017/06/13 00:58:04
It's a little odd that every mojo method here just
 
xiaoyinh(OOO Sep 11-29)
2017/06/13 18:36:56
Thanks for the suggestion. Do you mean to have 2 s
 
James Cook
2017/06/13 20:38:34
It's just something to think about. I established
 | 
| + | 
| +void LockScreenClient::LoadWallpaper(const AccountId& account_id) { | 
| + chromeos::WallpaperManager::Get()->SetUserWallpaperDelayed(account_id); | 
| +} | 
| + | 
| +void LockScreenClient::SignOutUser() { | 
| + chromeos::ScreenLocker::default_screen_locker()->Signout(); | 
| +} | 
| + | 
| +void LockScreenClient::OnMaxIncorrectPasswordAttempted( | 
| + const AccountId& account_id) { | 
| + RecordReauthReason(account_id, | 
| + chromeos::ReauthReason::INCORRECT_PASSWORD_ENTERED); | 
| +} | 
| + | 
| void LockScreenClient::ShowErrorMessage(int32_t login_attempts, | 
| const std::string& error_text, | 
| const std::string& help_link_text, | 
| @@ -110,6 +135,11 @@ void LockScreenClient::LoadUsers(std::unique_ptr<base::ListValue> users_list, | 
| lock_screen_->LoadUsers(std::move(users_list), show_guest); | 
| } | 
| +void LockScreenClient::SetPinEnabledForUser(const AccountId& account_id, | 
| + bool is_enabled) { | 
| + lock_screen_->SetPinEnabledForUser(account_id, is_enabled); | 
| +} | 
| + | 
| void LockScreenClient::SetDelegate(Delegate* delegate) { | 
| delegate_ = delegate; | 
| } |