 Chromium Code Reviews
 Chromium Code Reviews Issue 2876673002:
  mojo api for view based lockscreen  (Closed)
    
  
    Issue 2876673002:
  mojo api for view based lockscreen  (Closed) 
  | OLD | NEW | 
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/ash/lock_screen_client_chromeos.h" | |
| 6 | |
| 7 #include "ash/public/interfaces/constants.mojom.h" | |
| 8 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | |
| 9 #include "content/public/common/service_manager_connection.h" | |
| 10 #include "services/service_manager/public/cpp/connector.h" | |
| 11 | |
| 12 namespace { | |
| 13 LockScreenClientChromeOS* g_instance = nullptr; | |
| 14 } // namespace | |
| 15 | |
| 16 LockScreenClientChromeOS::LockScreenClientChromeOS() : binding_(this) { | |
| 17 content::ServiceManagerConnection::GetForProcess() | |
| 18 ->GetConnector() | |
| 19 ->BindInterface(ash::mojom::kServiceName, &lock_screen_); | |
| 20 // Register this object as the client interface implementation. | |
| 21 lock_screen_->SetClient(binding_.CreateInterfacePtrAndBind()); | |
| 22 | |
| 23 DCHECK(!g_instance); | |
| 24 g_instance = this; | |
| 25 } | |
| 26 | |
| 27 LockScreenClientChromeOS::~LockScreenClientChromeOS() { | |
| 28 DCHECK_EQ(this, g_instance); | |
| 29 g_instance = nullptr; | |
| 30 } | |
| 31 | |
| 32 // static | |
| 33 LockScreenClientChromeOS* LockScreenClientChromeOS::Get() { | |
| 34 return g_instance; | |
| 35 } | |
| 36 | |
| 37 void LockScreenClientChromeOS::AuthenticateUser( | |
| 38 const AccountId& account_id, | |
| 39 const std::string& hashed_password, | |
| 40 bool authenticated_by_pin) { | |
| 41 // TODO(xiaoyinh@): Complete the implementation below. | |
| 
James Cook
2017/05/15 21:15:01
super-nit: No "@" in todos. :-)
 
xiaoyinh(OOO Sep 11-29)
2017/05/16 17:32:50
Done.
 | |
| 42 // It should be similar as SigninScreenHandler::HandleAuthenticateUser. | |
| 43 chromeos::UserContext user_context(account_id); | |
| 44 chromeos::Key key(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, | |
| 45 std::string(), hashed_password); | |
| 46 user_context.SetKey(key); | |
| 47 user_context.SetIsUsingPin(authenticated_by_pin); | |
| 48 chromeos::ScreenLocker::default_screen_locker()->Authenticate(user_context); | |
| 49 } | |
| 50 | |
| 51 void LockScreenClientChromeOS::ShowErrorMessage() { | |
| 52 lock_screen_->ShowErrorMessage(); | |
| 53 } | |
| 54 | |
| 55 void LockScreenClientChromeOS::ClearErrors() { | |
| 56 lock_screen_->ClearErrors(); | |
| 57 } | |
| OLD | NEW |