OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/sequenced_task_runner_helpers.h" | 14 #include "base/sequenced_task_runner_helpers.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 16 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
17 #include "chrome/browser/chromeos/login/lock/screen_locker_delegate.h" | 17 #include "chrome/browser/chromeos/login/lock/screen_locker_delegate.h" |
18 #include "chrome/browser/chromeos/login/ui/login_display.h" | 18 #include "chrome/browser/chromeos/login/ui/login_display.h" |
19 #include "chrome/browser/chromeos/login/users/user.h" | |
20 #include "chromeos/login/auth/auth_status_consumer.h" | 19 #include "chromeos/login/auth/auth_status_consumer.h" |
21 #include "chromeos/login/auth/user_context.h" | 20 #include "chromeos/login/auth/user_context.h" |
| 21 #include "components/user_manager/user.h" |
22 #include "ui/base/accelerators/accelerator.h" | 22 #include "ui/base/accelerators/accelerator.h" |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 class WebUI; | 25 class WebUI; |
26 } | 26 } |
27 | 27 |
28 namespace gfx { | 28 namespace gfx { |
29 class Image; | 29 class Image; |
30 } | 30 } |
31 | 31 |
32 namespace chromeos { | 32 namespace chromeos { |
33 | 33 |
34 class Authenticator; | 34 class Authenticator; |
35 class ExtendedAuthenticator; | 35 class ExtendedAuthenticator; |
36 class AuthFailure; | 36 class AuthFailure; |
37 class ScreenlockIconProvider; | 37 class ScreenlockIconProvider; |
38 | 38 |
39 namespace test { | 39 namespace test { |
40 class ScreenLockerTester; | 40 class ScreenLockerTester; |
41 class ScreenLockerViewsTester; | 41 class ScreenLockerViewsTester; |
42 class WebUIScreenLockerTester; | 42 class WebUIScreenLockerTester; |
43 } // namespace test | 43 } // namespace test |
44 | 44 |
45 // ScreenLocker creates a ScreenLockerDelegate which will display the lock UI. | 45 // ScreenLocker creates a ScreenLockerDelegate which will display the lock UI. |
46 // As well, it takes care of authenticating the user and managing a global | 46 // As well, it takes care of authenticating the user and managing a global |
47 // instance of itself which will be deleted when the system is unlocked. | 47 // instance of itself which will be deleted when the system is unlocked. |
48 class ScreenLocker : public AuthStatusConsumer { | 48 class ScreenLocker : public AuthStatusConsumer { |
49 public: | 49 public: |
50 explicit ScreenLocker(const UserList& users); | 50 explicit ScreenLocker(const user_manager::UserList& users); |
51 | 51 |
52 // Returns the default instance if it has been created. | 52 // Returns the default instance if it has been created. |
53 static ScreenLocker* default_screen_locker() { | 53 static ScreenLocker* default_screen_locker() { |
54 return screen_locker_; | 54 return screen_locker_; |
55 } | 55 } |
56 | 56 |
57 bool locked() const { return locked_; } | 57 bool locked() const { return locked_; } |
58 | 58 |
59 // Initialize and show the screen locker. | 59 // Initialize and show the screen locker. |
60 void Init(); | 60 void Init(); |
(...skipping 22 matching lines...) Expand all Loading... |
83 // If |sign_out_only| is true then all other input except "Sign Out" | 83 // If |sign_out_only| is true then all other input except "Sign Out" |
84 // button is blocked. | 84 // button is blocked. |
85 void ShowErrorMessage(int error_msg_id, | 85 void ShowErrorMessage(int error_msg_id, |
86 HelpAppLauncher::HelpTopic help_topic_id, | 86 HelpAppLauncher::HelpTopic help_topic_id, |
87 bool sign_out_only); | 87 bool sign_out_only); |
88 | 88 |
89 // Returns the screen locker's delegate. | 89 // Returns the screen locker's delegate. |
90 ScreenLockerDelegate* delegate() const { return delegate_.get(); } | 90 ScreenLockerDelegate* delegate() const { return delegate_.get(); } |
91 | 91 |
92 // Returns the users to authenticate. | 92 // Returns the users to authenticate. |
93 const UserList& users() const { return users_; } | 93 const user_manager::UserList& users() const { return users_; } |
94 | 94 |
95 // Allow a AuthStatusConsumer to listen for | 95 // Allow a AuthStatusConsumer to listen for |
96 // the same login events that ScreenLocker does. | 96 // the same login events that ScreenLocker does. |
97 void SetLoginStatusConsumer(chromeos::AuthStatusConsumer* consumer); | 97 void SetLoginStatusConsumer(chromeos::AuthStatusConsumer* consumer); |
98 | 98 |
99 // Returns WebUI associated with screen locker implementation or NULL if | 99 // Returns WebUI associated with screen locker implementation or NULL if |
100 // there isn't one. | 100 // there isn't one. |
101 content::WebUI* GetAssociatedWebUI(); | 101 content::WebUI* GetAssociatedWebUI(); |
102 | 102 |
103 // Initialize or uninitialize the ScreenLocker class. It listens to | 103 // Initialize or uninitialize the ScreenLocker class. It listens to |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Called when the screen lock is ready. | 137 // Called when the screen lock is ready. |
138 void ScreenLockReady(); | 138 void ScreenLockReady(); |
139 | 139 |
140 // Called when screen locker is safe to delete. | 140 // Called when screen locker is safe to delete. |
141 static void ScheduleDeletion(); | 141 static void ScheduleDeletion(); |
142 | 142 |
143 // Returns true if |username| is found among logged in users. | 143 // Returns true if |username| is found among logged in users. |
144 bool IsUserLoggedIn(const std::string& username); | 144 bool IsUserLoggedIn(const std::string& username); |
145 | 145 |
146 // Looks up user in unlock user list. | 146 // Looks up user in unlock user list. |
147 const User* FindUnlockUser(const std::string& user_id); | 147 const user_manager::User* FindUnlockUser(const std::string& user_id); |
148 | 148 |
149 // ScreenLockerDelegate instance in use. | 149 // ScreenLockerDelegate instance in use. |
150 scoped_ptr<ScreenLockerDelegate> delegate_; | 150 scoped_ptr<ScreenLockerDelegate> delegate_; |
151 | 151 |
152 // Users that can unlock the device. | 152 // Users that can unlock the device. |
153 UserList users_; | 153 user_manager::UserList users_; |
154 | 154 |
155 // Used to authenticate the user to unlock. | 155 // Used to authenticate the user to unlock. |
156 scoped_refptr<Authenticator> authenticator_; | 156 scoped_refptr<Authenticator> authenticator_; |
157 | 157 |
158 // Used to authenticate the user to unlock supervised users. | 158 // Used to authenticate the user to unlock supervised users. |
159 scoped_refptr<ExtendedAuthenticator> extended_authenticator_; | 159 scoped_refptr<ExtendedAuthenticator> extended_authenticator_; |
160 | 160 |
161 // True if the screen is locked, or false otherwise. This changes | 161 // True if the screen is locked, or false otherwise. This changes |
162 // from false to true, but will never change from true to | 162 // from false to true, but will never change from true to |
163 // false. Instead, ScreenLocker object gets deleted when unlocked. | 163 // false. Instead, ScreenLocker object gets deleted when unlocked. |
(...skipping 23 matching lines...) Expand all Loading... |
187 scoped_ptr<ScreenlockIconProvider> screenlock_icon_provider_; | 187 scoped_ptr<ScreenlockIconProvider> screenlock_icon_provider_; |
188 | 188 |
189 base::WeakPtrFactory<ScreenLocker> weak_factory_; | 189 base::WeakPtrFactory<ScreenLocker> weak_factory_; |
190 | 190 |
191 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); | 191 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); |
192 }; | 192 }; |
193 | 193 |
194 } // namespace chromeos | 194 } // namespace chromeos |
195 | 195 |
196 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ | 196 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ |
OLD | NEW |