Index: chrome/browser/ui/ash/lock_screen_client_chromeos.cc |
diff --git a/chrome/browser/ui/ash/lock_screen_client_chromeos.cc b/chrome/browser/ui/ash/lock_screen_client_chromeos.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..42aa7054d5c56304b1669e8debc4444ea8513222 |
--- /dev/null |
+++ b/chrome/browser/ui/ash/lock_screen_client_chromeos.cc |
@@ -0,0 +1,48 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ui/ash/lock_screen_client_chromeos.h" |
+ |
+#include "ash/public/interfaces/constants.mojom.h" |
+#include "chrome/browser/chromeos/login/lock/screen_locker.h" |
+#include "content/public/common/service_manager_connection.h" |
+#include "services/service_manager/public/cpp/connector.h" |
+ |
+namespace { |
+LockScreenClientChromeOS* g_instance = nullptr; |
+} // namespace |
+ |
+LockScreenClientChromeOS::LockScreenClientChromeOS() : binding_(this) { |
+ content::ServiceManagerConnection::GetForProcess() |
+ ->GetConnector() |
+ ->BindInterface(ash::mojom::kServiceName, &lock_screen_); |
+ // Register this object as the client interface implementation. |
+ lock_screen_->SetClient(binding_.CreateInterfacePtrAndBind()); |
+ |
+ DCHECK(!g_instance); |
+ g_instance = this; |
+} |
+ |
+LockScreenClientChromeOS::~LockScreenClientChromeOS() { |
+ DCHECK_EQ(this, g_instance); |
+ g_instance = nullptr; |
+} |
+ |
+// static |
+LockScreenClientChromeOS* LockScreenClientChromeOS::Get() { |
+ return g_instance; |
+} |
+ |
+void LockScreenClientChromeOS::AuthenticateUser(const AccountId& account_id, |
+ const std::string& password, |
+ bool authenticated_by_pin) { |
+ // TODO(xiaoyinh@): Complete the implementation below. |
+ // It should be similar as SigninScreenHandler::HandleAuthenticateUser. |
+ chromeos::UserContext user_context(account_id); |
+ chromeos::ScreenLocker::default_screen_locker()->Authenticate(user_context); |
+} |
+ |
+void LockScreenClientChromeOS::ShowSignInError() { |
+ lock_screen_->ShowSignInError(); |
+} |