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

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

Issue 2876673002: mojo api for view based lockscreen (Closed)
Patch Set: Incorporate comments from patch set 8 and rebase 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.cc
diff --git a/chrome/browser/ui/ash/lock_screen_client.cc b/chrome/browser/ui/ash/lock_screen_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9d381c9239df2f98c79510deac16901b37868ab5
--- /dev/null
+++ b/chrome/browser/ui/ash/lock_screen_client.cc
@@ -0,0 +1,60 @@
+// 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.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 {
+LockScreenClient* g_instance = nullptr;
+} // namespace
+
+LockScreenClient::LockScreenClient() : 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;
+}
+
+LockScreenClient::~LockScreenClient() {
+ DCHECK_EQ(this, g_instance);
+ g_instance = nullptr;
+}
+
+// static
+LockScreenClient* LockScreenClient::Get() {
+ return g_instance;
+}
+
+void LockScreenClient::AuthenticateUser(const AccountId& account_id,
+ const std::string& hashed_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::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 LockScreenClient::ShowErrorMessage(int32_t login_attempts,
+ const std::string& error_text,
+ const std::string& help_link_text,
+ int32_t help_topic_id) {
+ lock_screen_->ShowErrorMessage(login_attempts, error_text, help_link_text,
+ help_topic_id);
+}
+
+void LockScreenClient::ClearErrors() {
+ lock_screen_->ClearErrors();
+}
« no previous file with comments | « chrome/browser/ui/ash/lock_screen_client.h ('k') | chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698