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

Side by Side 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 unified diff | Download patch
OLDNEW
(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.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 LockScreenClient* g_instance = nullptr;
14 } // namespace
15
16 LockScreenClient::LockScreenClient() : 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 LockScreenClient::~LockScreenClient() {
28 DCHECK_EQ(this, g_instance);
29 g_instance = nullptr;
30 }
31
32 // static
33 LockScreenClient* LockScreenClient::Get() {
34 return g_instance;
35 }
36
37 void LockScreenClient::AuthenticateUser(const AccountId& account_id,
38 const std::string& hashed_password,
39 bool authenticated_by_pin) {
40 // TODO(xiaoyinh): Complete the implementation below.
41 // It should be similar as SigninScreenHandler::HandleAuthenticateUser.
42 chromeos::UserContext user_context(account_id);
43 chromeos::Key key(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF,
44 std::string(), hashed_password);
45 user_context.SetKey(key);
46 user_context.SetIsUsingPin(authenticated_by_pin);
47 chromeos::ScreenLocker::default_screen_locker()->Authenticate(user_context);
48 }
49
50 void LockScreenClient::ShowErrorMessage(int32_t login_attempts,
51 const std::string& error_text,
52 const std::string& help_link_text,
53 int32_t help_topic_id) {
54 lock_screen_->ShowErrorMessage(login_attempts, error_text, help_link_text,
55 help_topic_id);
56 }
57
58 void LockScreenClient::ClearErrors() {
59 lock_screen_->ClearErrors();
60 }
OLDNEW
« 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