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

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

Issue 2923773003: Adding mojo calls for several lock screen related operations. (Closed)
Patch Set: clean up 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 "chrome/browser/chromeos/login/reauth_stats.h"
10 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
9 #include "content/public/common/service_manager_connection.h" 11 #include "content/public/common/service_manager_connection.h"
10 #include "services/service_manager/public/cpp/connector.h" 12 #include "services/service_manager/public/cpp/connector.h"
11 13
12 namespace { 14 namespace {
13 LockScreenClient* g_instance = nullptr; 15 LockScreenClient* g_instance = nullptr;
14 } // namespace 16 } // namespace
15 17
16 LockScreenClient::Delegate::Delegate() = default; 18 LockScreenClient::Delegate::Delegate() = default;
17 LockScreenClient::Delegate::~Delegate() = default; 19 LockScreenClient::Delegate::~Delegate() = default;
18 20
(...skipping 16 matching lines...) Expand all
35 } 37 }
36 38
37 // static 39 // static
38 LockScreenClient* LockScreenClient::Get() { 40 LockScreenClient* LockScreenClient::Get() {
39 return g_instance; 41 return g_instance;
40 } 42 }
41 43
42 void LockScreenClient::AuthenticateUser(const AccountId& account_id, 44 void LockScreenClient::AuthenticateUser(const AccountId& account_id,
43 const std::string& hashed_password, 45 const std::string& hashed_password,
44 bool authenticated_by_pin) { 46 bool authenticated_by_pin) {
45 // TODO(xiaoyinh): Complete the implementation below. 47 if (!delegate_)
46 // It should be similar as SigninScreenHandler::HandleAuthenticateUser. 48 return;
47 chromeos::UserContext user_context(account_id); 49 delegate_->HandleAuthenticateUser(account_id, hashed_password,
48 chromeos::Key key(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, 50 authenticated_by_pin);
49 std::string(), hashed_password);
50 user_context.SetKey(key);
51 user_context.SetIsUsingPin(authenticated_by_pin);
52 chromeos::ScreenLocker::default_screen_locker()->Authenticate(user_context);
53 } 51 }
54 52
55 void LockScreenClient::AttemptUnlock(const AccountId& account_id) { 53 void LockScreenClient::AttemptUnlock(const AccountId& account_id) {
56 if (!delegate_) 54 if (!delegate_)
57 return; 55 return;
58 delegate_->HandleAttemptUnlock(account_id); 56 delegate_->HandleAttemptUnlock(account_id);
59 } 57 }
60 58
61 void LockScreenClient::HardlockPod(const AccountId& account_id) { 59 void LockScreenClient::HardlockPod(const AccountId& account_id) {
62 if (!delegate_) 60 if (!delegate_)
63 return; 61 return;
64 delegate_->HandleHardlockPod(account_id); 62 delegate_->HandleHardlockPod(account_id);
65 } 63 }
66 64
67 void LockScreenClient::RecordClickOnLockIcon(const AccountId& account_id) { 65 void LockScreenClient::RecordClickOnLockIcon(const AccountId& account_id) {
68 if (!delegate_) 66 if (!delegate_)
69 return; 67 return;
70 delegate_->HandleRecordClickOnLockIcon(account_id); 68 delegate_->HandleRecordClickOnLockIcon(account_id);
71 } 69 }
72 70
71 void LockScreenClient::FocusPod(const AccountId& account_id) {
72 if (!delegate_)
73 return;
74 delegate_->HandleFocusPod(account_id);
75 }
76
77 void LockScreenClient::NoPodFocused() {
78 if (!delegate_)
79 return;
80 delegate_->HandleNoPodFocused();
81 }
82
83 void LockScreenClient::LoadWallpaper(const AccountId& account_id) {
84 chromeos::WallpaperManager::Get()->SetUserWallpaperDelayed(account_id);
85 }
86
87 void LockScreenClient::SignOutUser() {
88 chromeos::ScreenLocker::default_screen_locker()->Signout();
89 }
90
91 void LockScreenClient::MaxIncorrectPasswordAttempts(
92 const AccountId& account_id) {
93 RecordReauthReason(account_id,
94 chromeos::ReauthReason::INCORRECT_PASSWORD_ENTERED);
95 }
96
73 void LockScreenClient::ShowErrorMessage(int32_t login_attempts, 97 void LockScreenClient::ShowErrorMessage(int32_t login_attempts,
74 const std::string& error_text, 98 const std::string& error_text,
75 const std::string& help_link_text, 99 const std::string& help_link_text,
76 int32_t help_topic_id) { 100 int32_t help_topic_id) {
77 lock_screen_->ShowErrorMessage(login_attempts, error_text, help_link_text, 101 lock_screen_->ShowErrorMessage(login_attempts, error_text, help_link_text,
78 help_topic_id); 102 help_topic_id);
79 } 103 }
80 104
81 void LockScreenClient::ClearErrors() { 105 void LockScreenClient::ClearErrors() {
82 lock_screen_->ClearErrors(); 106 lock_screen_->ClearErrors();
(...skipping 13 matching lines...) Expand all
96 ash::mojom::AuthType auth_type, 120 ash::mojom::AuthType auth_type,
97 const base::string16& initial_value) { 121 const base::string16& initial_value) {
98 lock_screen_->SetAuthType(account_id, auth_type, initial_value); 122 lock_screen_->SetAuthType(account_id, auth_type, initial_value);
99 } 123 }
100 124
101 void LockScreenClient::LoadUsers(std::unique_ptr<base::ListValue> users_list, 125 void LockScreenClient::LoadUsers(std::unique_ptr<base::ListValue> users_list,
102 bool show_guest) { 126 bool show_guest) {
103 lock_screen_->LoadUsers(std::move(users_list), show_guest); 127 lock_screen_->LoadUsers(std::move(users_list), show_guest);
104 } 128 }
105 129
130 void LockScreenClient::SetPinEnabledForUser(const AccountId& account_id,
131 bool is_enabled) {
132 lock_screen_->SetPinEnabledForUser(account_id, is_enabled);
133 }
134
106 void LockScreenClient::SetDelegate(Delegate* delegate) { 135 void LockScreenClient::SetDelegate(Delegate* delegate) {
107 delegate_ = delegate; 136 delegate_ = delegate;
108 } 137 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698