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