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

Side by Side Diff: ash/login/lock_screen_controller.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
« no previous file with comments | « ash/login/lock_screen_controller.h ('k') | ash/login/lock_screen_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/login/lock_screen_controller.h" 5 #include "ash/login/lock_screen_controller.h"
6 6
7 #include "chromeos/cryptohome/system_salt_getter.h" 7 #include "chromeos/cryptohome/system_salt_getter.h"
8 #include "chromeos/login/auth/user_context.h" 8 #include "chromeos/login/auth/user_context.h"
9 9
10 namespace ash { 10 namespace ash {
11 11
12 LockScreenController::LockScreenController() = default; 12 LockScreenController::LockScreenController() = default;
13 13
14 LockScreenController::~LockScreenController() = default; 14 LockScreenController::~LockScreenController() = default;
15 15
16 void LockScreenController::BindRequest(mojom::LockScreenRequest request) { 16 void LockScreenController::BindRequest(mojom::LockScreenRequest request) {
17 bindings_.AddBinding(this, std::move(request)); 17 bindings_.AddBinding(this, std::move(request));
18 } 18 }
19 19
20 void LockScreenController::SetClient(mojom::LockScreenClientPtr client) {
21 lock_screen_client_ = std::move(client);
22 }
23
24 void LockScreenController::ShowErrorMessage(int32_t login_attempts,
25 const std::string& error_text,
26 const std::string& help_link_text,
27 int32_t help_topic_id) {
28 NOTIMPLEMENTED();
29 }
30
31 void LockScreenController::ClearErrors() {
32 NOTIMPLEMENTED();
33 }
34
35 void LockScreenController::ShowUserPodCustomIcon(
36 const AccountId& account_id,
37 mojom::UserPodCustomIconOptionsPtr icon) {
38 NOTIMPLEMENTED();
39 }
40
41 void LockScreenController::HideUserPodCustomIcon(const AccountId& account_id) {
42 NOTIMPLEMENTED();
43 }
44
45 void LockScreenController::SetAuthType(const AccountId& account_id,
46 mojom::AuthType auth_type,
47 const base::string16& initial_value) {
48 NOTIMPLEMENTED();
49 }
50
51 void LockScreenController::LoadUsers(std::unique_ptr<base::ListValue> users,
52 bool show_guest) {
53 NOTIMPLEMENTED();
54 }
55
20 void LockScreenController::AuthenticateUser(const AccountId& account_id, 56 void LockScreenController::AuthenticateUser(const AccountId& account_id,
21 const std::string& password, 57 const std::string& password,
22 bool authenticated_by_pin) { 58 bool authenticated_by_pin) {
23 if (!lock_screen_client_) 59 if (!lock_screen_client_)
24 return; 60 return;
25 61
26 chromeos::SystemSaltGetter::Get()->GetSystemSalt(base::Bind( 62 chromeos::SystemSaltGetter::Get()->GetSystemSalt(base::Bind(
27 &LockScreenController::DoAuthenticateUser, base::Unretained(this), 63 &LockScreenController::DoAuthenticateUser, base::Unretained(this),
28 account_id, password, authenticated_by_pin)); 64 account_id, password, authenticated_by_pin));
29 } 65 }
30 66
31 void LockScreenController::SetClient(mojom::LockScreenClientPtr client) { 67 void LockScreenController::AttemptUnlock(const AccountId& account_id) {
32 lock_screen_client_ = std::move(client); 68 if (!lock_screen_client_)
69 return;
70 lock_screen_client_->AttemptUnlock(account_id);
33 } 71 }
34 72
35 void LockScreenController::ShowErrorMessage(int32_t login_attempts, 73 void LockScreenController::HardlockPod(const AccountId& account_id) {
36 const std::string& error_text, 74 if (!lock_screen_client_)
37 const std::string& help_link_text, 75 return;
38 int32_t help_topic_id) { 76 lock_screen_client_->HardlockPod(account_id);
39 NOTIMPLEMENTED();
40 } 77 }
41 78
42 void LockScreenController::ClearErrors() { 79 void LockScreenController::RecordClickOnLockIcon(const AccountId& account_id) {
43 NOTIMPLEMENTED(); 80 if (!lock_screen_client_)
81 return;
82 lock_screen_client_->RecordClickOnLockIcon(account_id);
44 } 83 }
45 84
46 void LockScreenController::DoAuthenticateUser(const AccountId& account_id, 85 void LockScreenController::DoAuthenticateUser(const AccountId& account_id,
47 const std::string& password, 86 const std::string& password,
48 bool authenticated_by_pin, 87 bool authenticated_by_pin,
49 const std::string& system_salt) { 88 const std::string& system_salt) {
50 // Hash password before sending through mojo. 89 // Hash password before sending through mojo.
51 // TODO(xiaoyinh): Pin is hashed differently by using a different salt and 90 // TODO(xiaoyinh): Pin is hashed differently by using a different salt and
52 // a different hash algorithm. Update this part in PinStorage. 91 // a different hash algorithm. Update this part in PinStorage.
53 chromeos::Key key(password); 92 chromeos::Key key(password);
54 key.Transform(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); 93 key.Transform(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt);
55 lock_screen_client_->AuthenticateUser(account_id, key.GetSecret(), 94 lock_screen_client_->AuthenticateUser(account_id, key.GetSecret(),
56 authenticated_by_pin); 95 authenticated_by_pin);
57 } 96 }
58 97
59 } // namespace ash 98 } // namespace ash
OLDNEW
« no previous file with comments | « ash/login/lock_screen_controller.h ('k') | ash/login/lock_screen_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698