Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: chrome/browser/ui/ash/lock_screen_client_chromeos.cc

Issue 2876673002: mojo api for view based lockscreen (Closed)
Patch Set: comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..8b64774c90b3822a46fed4f354f3bda957b595dc
--- /dev/null
+++ b/chrome/browser/ui/ash/lock_screen_client_chromeos.cc
@@ -0,0 +1,57 @@
+// 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& hashed_password,
+ bool authenticated_by_pin) {
+ // 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.
+ // 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);
+}
+
+void LockScreenClientChromeOS::ShowErrorMessage() {
+ lock_screen_->ShowErrorMessage();
+}
+
+void LockScreenClientChromeOS::ClearErrors() {
+ lock_screen_->ClearErrors();
+}

Powered by Google App Engine
This is Rietveld 408576698