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

Side by Side Diff: chrome/browser/ui/ash/lock_screen_client.cc

Issue 2903353003: Adding mojo calls for easy unlock service (Closed)
Patch Set: comments and rebase Created 3 years, 6 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/ash/lock_screen_client.h" 5 #include "chrome/browser/ui/ash/lock_screen_client.h"
6 6
7 #include "ash/public/interfaces/constants.mojom.h" 7 #include "ash/public/interfaces/constants.mojom.h"
8 #include "chrome/browser/chromeos/login/lock/screen_locker.h" 8 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
9 #include "content/public/common/service_manager_connection.h" 9 #include "content/public/common/service_manager_connection.h"
10 #include "services/service_manager/public/cpp/connector.h" 10 #include "services/service_manager/public/cpp/connector.h"
11 11
12 namespace { 12 namespace {
13 LockScreenClient* g_instance = nullptr; 13 LockScreenClient* g_instance = nullptr;
14 } // namespace 14 } // namespace
15 15
16 LockScreenClient::Delegate::Delegate() = default;
17 LockScreenClient::Delegate::~Delegate() = default;
18
16 LockScreenClient::LockScreenClient() : binding_(this) { 19 LockScreenClient::LockScreenClient() : binding_(this) {
17 content::ServiceManagerConnection::GetForProcess() 20 content::ServiceManagerConnection::GetForProcess()
18 ->GetConnector() 21 ->GetConnector()
19 ->BindInterface(ash::mojom::kServiceName, &lock_screen_); 22 ->BindInterface(ash::mojom::kServiceName, &lock_screen_);
20 // Register this object as the client interface implementation. 23 // Register this object as the client interface implementation.
21 lock_screen_->SetClient(binding_.CreateInterfacePtrAndBind()); 24 lock_screen_->SetClient(binding_.CreateInterfacePtrAndBind());
22 25
23 DCHECK(!g_instance); 26 DCHECK(!g_instance);
24 g_instance = this; 27 g_instance = this;
25 } 28 }
(...skipping 14 matching lines...) Expand all
40 // TODO(xiaoyinh): Complete the implementation below. 43 // TODO(xiaoyinh): Complete the implementation below.
41 // It should be similar as SigninScreenHandler::HandleAuthenticateUser. 44 // It should be similar as SigninScreenHandler::HandleAuthenticateUser.
42 chromeos::UserContext user_context(account_id); 45 chromeos::UserContext user_context(account_id);
43 chromeos::Key key(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, 46 chromeos::Key key(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF,
44 std::string(), hashed_password); 47 std::string(), hashed_password);
45 user_context.SetKey(key); 48 user_context.SetKey(key);
46 user_context.SetIsUsingPin(authenticated_by_pin); 49 user_context.SetIsUsingPin(authenticated_by_pin);
47 chromeos::ScreenLocker::default_screen_locker()->Authenticate(user_context); 50 chromeos::ScreenLocker::default_screen_locker()->Authenticate(user_context);
48 } 51 }
49 52
53 void LockScreenClient::AttemptUnlock(const AccountId& account_id) {
54 if (!delegate_)
55 return;
56 delegate_->HandleAttemptUnlock(account_id);
57 }
58
59 void LockScreenClient::HardlockPod(const AccountId& account_id) {
60 if (!delegate_)
61 return;
62 delegate_->HandleHardlockPod(account_id);
63 }
64
65 void LockScreenClient::RecordClickOnLockIcon(const AccountId& account_id) {
66 if (!delegate_)
67 return;
68 delegate_->HandleRecordClickOnLockIcon(account_id);
69 }
70
50 void LockScreenClient::ShowErrorMessage(int32_t login_attempts, 71 void LockScreenClient::ShowErrorMessage(int32_t login_attempts,
51 const std::string& error_text, 72 const std::string& error_text,
52 const std::string& help_link_text, 73 const std::string& help_link_text,
53 int32_t help_topic_id) { 74 int32_t help_topic_id) {
54 lock_screen_->ShowErrorMessage(login_attempts, error_text, help_link_text, 75 lock_screen_->ShowErrorMessage(login_attempts, error_text, help_link_text,
55 help_topic_id); 76 help_topic_id);
56 } 77 }
57 78
58 void LockScreenClient::ClearErrors() { 79 void LockScreenClient::ClearErrors() {
59 lock_screen_->ClearErrors(); 80 lock_screen_->ClearErrors();
60 } 81 }
82
83 void LockScreenClient::ShowUserPodCustomIcon(
84 const AccountId& account_id,
85 ash::mojom::UserPodCustomIconOptionsPtr icon) {
86 lock_screen_->ShowUserPodCustomIcon(account_id, std::move(icon));
87 }
88
89 void LockScreenClient::HideUserPodCustomIcon(const AccountId& account_id) {
90 lock_screen_->HideUserPodCustomIcon(account_id);
91 }
92
93 void LockScreenClient::SetAuthType(const AccountId& account_id,
94 ash::mojom::AuthType auth_type,
95 const base::string16& initial_value) {
96 lock_screen_->SetAuthType(account_id, auth_type, initial_value);
97 }
98
99 void LockScreenClient::LoadUsers(std::unique_ptr<base::ListValue> users_list,
100 bool show_guest) {
101 lock_screen_->LoadUsers(std::move(users_list), show_guest);
102 }
103
104 void LockScreenClient::SetDelegate(Delegate* delegate) {
105 delegate_ = delegate;
106 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/lock_screen_client.h ('k') | chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698