| 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/auth/login_status_consumer.h" | 16 #include "chrome/browser/chromeos/login/auth/login_status_consumer.h" |
| 17 #include "chrome/browser/chromeos/login/auth/user_context.h" | 17 #include "chrome/browser/chromeos/login/auth/user_context.h" |
| 18 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 18 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
| 19 #include "chrome/browser/chromeos/login/lock/screen_locker_delegate.h" | 19 #include "chrome/browser/chromeos/login/lock/screen_locker_delegate.h" |
| 20 #include "chrome/browser/chromeos/login/ui/login_display.h" | 20 #include "chrome/browser/chromeos/login/ui/login_display.h" |
| 21 #include "chrome/browser/chromeos/login/users/user.h" | 21 #include "chrome/browser/chromeos/login/users/user.h" |
| 22 #include "chrome/browser/signin/screenlock_bridge.h" | |
| 23 #include "ui/base/accelerators/accelerator.h" | 22 #include "ui/base/accelerators/accelerator.h" |
| 24 | 23 |
| 25 namespace content { | 24 namespace content { |
| 26 class WebUI; | 25 class WebUI; |
| 27 } | 26 } |
| 28 | 27 |
| 29 namespace gfx { | 28 namespace gfx { |
| 30 class Image; | 29 class Image; |
| 31 } | 30 } |
| 32 | 31 |
| 33 namespace chromeos { | 32 namespace chromeos { |
| 34 | 33 |
| 35 class Authenticator; | 34 class Authenticator; |
| 36 class ExtendedAuthenticator; | 35 class ExtendedAuthenticator; |
| 37 class LoginFailure; | 36 class LoginFailure; |
| 38 class ScreenlockIconProvider; | 37 class ScreenlockIconProvider; |
| 39 | 38 |
| 40 namespace test { | 39 namespace test { |
| 41 class ScreenLockerTester; | 40 class ScreenLockerTester; |
| 42 class ScreenLockerViewsTester; | 41 class ScreenLockerViewsTester; |
| 43 class WebUIScreenLockerTester; | 42 class WebUIScreenLockerTester; |
| 44 } // namespace test | 43 } // namespace test |
| 45 | 44 |
| 46 // ScreenLocker creates a ScreenLockerDelegate which will display the lock UI. | 45 // ScreenLocker creates a ScreenLockerDelegate which will display the lock UI. |
| 47 // 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 |
| 48 // 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. |
| 49 class ScreenLocker : public LoginStatusConsumer, | 48 class ScreenLocker : public LoginStatusConsumer { |
| 50 public ScreenlockBridge::LockHandler { | |
| 51 public: | 49 public: |
| 52 explicit ScreenLocker(const UserList& users); | 50 explicit ScreenLocker(const UserList& users); |
| 53 | 51 |
| 54 // Returns the default instance if it has been created. | 52 // Returns the default instance if it has been created. |
| 55 static ScreenLocker* default_screen_locker() { | 53 static ScreenLocker* default_screen_locker() { |
| 56 return screen_locker_; | 54 return screen_locker_; |
| 57 } | 55 } |
| 58 | 56 |
| 59 bool locked() const { return locked_; } | 57 bool locked() const { return locked_; } |
| 60 | 58 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 71 | 69 |
| 72 // Authenticates the user with given |user_context|. | 70 // Authenticates the user with given |user_context|. |
| 73 void Authenticate(const UserContext& user_context); | 71 void Authenticate(const UserContext& user_context); |
| 74 | 72 |
| 75 // Close message bubble to clear error messages. | 73 // Close message bubble to clear error messages. |
| 76 void ClearErrors(); | 74 void ClearErrors(); |
| 77 | 75 |
| 78 // Exit the chrome, which will sign out the current session. | 76 // Exit the chrome, which will sign out the current session. |
| 79 void Signout(); | 77 void Signout(); |
| 80 | 78 |
| 81 // ScreenlockBridge::LockHandler: | 79 // (Re)enable input field. |
| 82 virtual void ShowBannerMessage(const std::string& message) OVERRIDE; | 80 void EnableInput(); |
| 83 virtual void ShowUserPodButton(const std::string& username, | |
| 84 const gfx::Image& icon, | |
| 85 const base::Closure& click_callback) OVERRIDE; | |
| 86 virtual void HideUserPodButton(const std::string& username) OVERRIDE; | |
| 87 virtual void EnableInput() OVERRIDE; | |
| 88 virtual void SetAuthType(const std::string& username, | |
| 89 ScreenlockBridge::LockHandler::AuthType auth_type, | |
| 90 const std::string& initial_value) OVERRIDE; | |
| 91 virtual ScreenlockBridge::LockHandler::AuthType GetAuthType( | |
| 92 const std::string& username) const OVERRIDE; | |
| 93 virtual void Unlock(const std::string& user_email) OVERRIDE; | |
| 94 | 81 |
| 95 // Disables all UI needed and shows error bubble with |message|. | 82 // Disables all UI needed and shows error bubble with |message|. |
| 96 // 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" |
| 97 // button is blocked. | 84 // button is blocked. |
| 98 void ShowErrorMessage(int error_msg_id, | 85 void ShowErrorMessage(int error_msg_id, |
| 99 HelpAppLauncher::HelpTopic help_topic_id, | 86 HelpAppLauncher::HelpTopic help_topic_id, |
| 100 bool sign_out_only); | 87 bool sign_out_only); |
| 101 | 88 |
| 102 // Returns the screen locker's delegate. | 89 // Returns the screen locker's delegate. |
| 103 ScreenLockerDelegate* delegate() const { return delegate_.get(); } | 90 ScreenLockerDelegate* delegate() const { return delegate_.get(); } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 scoped_ptr<ScreenlockIconProvider> screenlock_icon_provider_; | 187 scoped_ptr<ScreenlockIconProvider> screenlock_icon_provider_; |
| 201 | 188 |
| 202 base::WeakPtrFactory<ScreenLocker> weak_factory_; | 189 base::WeakPtrFactory<ScreenLocker> weak_factory_; |
| 203 | 190 |
| 204 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); | 191 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); |
| 205 }; | 192 }; |
| 206 | 193 |
| 207 } // namespace chromeos | 194 } // namespace chromeos |
| 208 | 195 |
| 209 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ | 196 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_H_ |
| OLD | NEW |