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

Side by Side Diff: ash/login/lock_screen_controller.h

Issue 2896093003: cros: Make sure views-based lock screen is destroyed after it is dismissed. (Closed)
Patch Set: Address comments 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 | « no previous file | ash/login/lock_screen_controller.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 #ifndef ASH_LOGIN_LOCK_SCREEN_CONTROLLER_H_ 5 #ifndef ASH_LOGIN_LOCK_SCREEN_CONTROLLER_H_
6 #define ASH_LOGIN_LOCK_SCREEN_CONTROLLER_H_ 6 #define ASH_LOGIN_LOCK_SCREEN_CONTROLLER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/public/interfaces/lock_screen.mojom.h" 9 #include "ash/public/interfaces/lock_screen.mojom.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "mojo/public/cpp/bindings/binding_set.h" 11 #include "mojo/public/cpp/bindings/binding_set.h"
12 12
13 namespace ash { 13 namespace ash {
14 14
15 // LockScreenController implements mojom::LockScreen and wraps the 15 // LockScreenController implements mojom::LockScreen and wraps the
16 // mojom::LockScreenClient interface. This lets a consumer of ash provide a 16 // mojom::LockScreenClient interface. This lets a consumer of ash provide a
17 // LockScreenClient, which we will dispatch to if one has been provided to us. 17 // LockScreenClient, which we will dispatch to if one has been provided to us.
18 // This could send requests to LockScreenClient and also handle requests from 18 // This could send requests to LockScreenClient and also handle requests from
19 // LockScreenClient through mojo. 19 // LockScreenClient through mojo.
20 class ASH_EXPORT LockScreenController 20 class ASH_EXPORT LockScreenController
21 : NON_EXPORTED_BASE(public mojom::LockScreen) { 21 : NON_EXPORTED_BASE(public mojom::LockScreen) {
22 public: 22 public:
23 using OnShownCallback = base::OnceCallback<void(bool did_show)>;
24
23 LockScreenController(); 25 LockScreenController();
24 ~LockScreenController() override; 26 ~LockScreenController() override;
25 27
26 // Binds the mojom::LockScreen interface to this object. 28 // Binds the mojom::LockScreen interface to this object.
27 void BindRequest(mojom::LockScreenRequest request); 29 void BindRequest(mojom::LockScreenRequest request);
28 30
29 // mojom::LockScreen: 31 // mojom::LockScreen:
30 void SetClient(mojom::LockScreenClientPtr client) override; 32 void SetClient(mojom::LockScreenClientPtr client) override;
33 void ShowLockScreen(ShowLockScreenCallback callback) override;
31 void ShowErrorMessage(int32_t login_attempts, 34 void ShowErrorMessage(int32_t login_attempts,
32 const std::string& error_text, 35 const std::string& error_text,
33 const std::string& help_link_text, 36 const std::string& help_link_text,
34 int32_t help_topic_id) override; 37 int32_t help_topic_id) override;
35 void ClearErrors() override; 38 void ClearErrors() override;
36 void ShowUserPodCustomIcon(const AccountId& account_id, 39 void ShowUserPodCustomIcon(const AccountId& account_id,
37 mojom::UserPodCustomIconOptionsPtr icon) override; 40 mojom::UserPodCustomIconOptionsPtr icon) override;
38 void HideUserPodCustomIcon(const AccountId& account_id) override; 41 void HideUserPodCustomIcon(const AccountId& account_id) override;
39 void SetAuthType(const AccountId& account_id, 42 void SetAuthType(const AccountId& account_id,
40 mojom::AuthType auth_type, 43 mojom::AuthType auth_type,
41 const base::string16& initial_value) override; 44 const base::string16& initial_value) override;
42 void LoadUsers(std::unique_ptr<base::ListValue> users, 45 void LoadUsers(std::unique_ptr<base::ListValue> users,
43 bool show_guest) override; 46 bool show_guest) override;
44 47
45 // Wrappers around the mojom::LockScreenClient interface. 48 // Wrappers around the mojom::LockScreenClient interface.
46 // Hash the password and send AuthenticateUser request to LockScreenClient. 49 // Hash the password and send AuthenticateUser request to LockScreenClient.
47 // LockScreenClient(chrome) will do the authentication and request to show 50 // LockScreenClient(chrome) will do the authentication and request to show
48 // error messages in the lock screen if auth fails, or request to clear 51 // error messages in the lock screen if auth fails, or request to clear
49 // errors if auth succeeds. 52 // errors if auth succeeds.
50 void AuthenticateUser(const AccountId& account_id, 53 void AuthenticateUser(
51 const std::string& password, 54 const AccountId& account_id,
52 bool authenticated_by_pin); 55 const std::string& password,
56 bool authenticated_by_pin,
57 mojom::LockScreenClient::AuthenticateUserCallback callback);
53 void AttemptUnlock(const AccountId& account_id); 58 void AttemptUnlock(const AccountId& account_id);
54 void HardlockPod(const AccountId& account_id); 59 void HardlockPod(const AccountId& account_id);
55 void RecordClickOnLockIcon(const AccountId& account_id); 60 void RecordClickOnLockIcon(const AccountId& account_id);
56 61
57 private: 62 private:
58 void DoAuthenticateUser(const AccountId& account_id, 63 using PendingAuthenticateUserCall =
59 const std::string& password, 64 base::OnceCallback<void(const std::string& system_salt)>;
60 bool authenticated_by_pin, 65
61 const std::string& system_salt); 66 void DoAuthenticateUser(
67 const AccountId& account_id,
68 const std::string& password,
69 bool authenticated_by_pin,
70 mojom::LockScreenClient::AuthenticateUserCallback callback,
71 const std::string& system_salt);
72
73 void OnGetSystemSalt(const std::string& system_salt);
62 74
63 // Client interface in chrome browser. May be null in tests. 75 // Client interface in chrome browser. May be null in tests.
64 mojom::LockScreenClientPtr lock_screen_client_; 76 mojom::LockScreenClientPtr lock_screen_client_;
65 77
66 // Bindings for the LockScreen interface. 78 // Bindings for the LockScreen interface.
67 mojo::BindingSet<mojom::LockScreen> bindings_; 79 mojo::BindingSet<mojom::LockScreen> bindings_;
68 80
81 // User authentication call that will run when we have system salt.
82 PendingAuthenticateUserCall pending_user_auth_;
83
69 DISALLOW_COPY_AND_ASSIGN(LockScreenController); 84 DISALLOW_COPY_AND_ASSIGN(LockScreenController);
70 }; 85 };
71 86
72 } // namspace ash 87 } // namespace ash
73 88
74 #endif // ASH_LOGIN_LOCK_SCREEN_CONTROLLER_H_ 89 #endif // ASH_LOGIN_LOCK_SCREEN_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | ash/login/lock_screen_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698