| 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/sequenced_task_runner_helpers.h" | 13 #include "base/sequenced_task_runner_helpers.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 15 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
| 16 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 16 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
| 17 #include "chrome/browser/chromeos/login/screen_locker_delegate.h" | 17 #include "chrome/browser/chromeos/login/screen_locker_delegate.h" |
| 18 #include "ui/base/accelerators/accelerator.h" | 18 #include "ui/base/accelerators/accelerator.h" |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 class WebUI; | 21 class WebUI; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace chromeos { | 24 namespace chromeos { |
| 25 | 25 |
| 26 class Authenticator; | 26 class Authenticator; |
| 27 class LoginFailure; | 27 class LoginFailure; |
| 28 class User; | 28 class User; |
| 29 struct UserCredentials; |
| 29 | 30 |
| 30 namespace test { | 31 namespace test { |
| 31 class ScreenLockerTester; | 32 class ScreenLockerTester; |
| 32 class ScreenLockerViewsTester; | 33 class ScreenLockerViewsTester; |
| 33 class WebUIScreenLockerTester; | 34 class WebUIScreenLockerTester; |
| 34 } // namespace test | 35 } // namespace test |
| 35 | 36 |
| 36 // ScreenLocker creates a ScreenLockerDelegate which will display the lock UI. | 37 // ScreenLocker creates a ScreenLockerDelegate which will display the lock UI. |
| 37 // As well, it takes care of authenticating the user and managing a global | 38 // As well, it takes care of authenticating the user and managing a global |
| 38 // instance of itself which will be deleted when the system is unlocked. | 39 // instance of itself which will be deleted when the system is unlocked. |
| 39 class ScreenLocker : public LoginStatusConsumer { | 40 class ScreenLocker : public LoginStatusConsumer { |
| 40 public: | 41 public: |
| 41 explicit ScreenLocker(const User& user); | 42 explicit ScreenLocker(const User& user); |
| 42 | 43 |
| 43 // Returns the default instance if it has been created. | 44 // Returns the default instance if it has been created. |
| 44 static ScreenLocker* default_screen_locker() { | 45 static ScreenLocker* default_screen_locker() { |
| 45 return screen_locker_; | 46 return screen_locker_; |
| 46 } | 47 } |
| 47 | 48 |
| 48 bool locked() const { return locked_; } | 49 bool locked() const { return locked_; } |
| 49 | 50 |
| 50 // Initialize and show the screen locker. | 51 // Initialize and show the screen locker. |
| 51 void Init(); | 52 void Init(); |
| 52 | 53 |
| 53 // LoginStatusConsumer implements: | 54 // LoginStatusConsumer implements: |
| 54 virtual void OnLoginFailure(const chromeos::LoginFailure& error) OVERRIDE; | 55 virtual void OnLoginFailure(const chromeos::LoginFailure& error) OVERRIDE; |
| 55 virtual void OnLoginSuccess(const std::string& username, | 56 virtual void OnLoginSuccess(const UserCredentials& credentials, |
| 56 const std::string& password, | |
| 57 bool pending_requests, | 57 bool pending_requests, |
| 58 bool using_oauth) OVERRIDE; | 58 bool using_oauth) OVERRIDE; |
| 59 | 59 |
| 60 // Does actual unlocking once authentication is successful and all blocking | 60 // Does actual unlocking once authentication is successful and all blocking |
| 61 // animations are done. | 61 // animations are done. |
| 62 void UnlockOnLoginSuccess(); | 62 void UnlockOnLoginSuccess(); |
| 63 | 63 |
| 64 // Authenticates the user with given |password| and authenticator. | 64 // Authenticates the user with given |password| and authenticator. |
| 65 void Authenticate(const string16& password); | 65 void Authenticate(const string16& password); |
| 66 | 66 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 scoped_ptr<AuthenticationParametersCapture> authentication_capture_; | 171 scoped_ptr<AuthenticationParametersCapture> authentication_capture_; |
| 172 | 172 |
| 173 base::WeakPtrFactory<ScreenLocker> weak_factory_; | 173 base::WeakPtrFactory<ScreenLocker> weak_factory_; |
| 174 | 174 |
| 175 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); | 175 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 } // namespace chromeos | 178 } // namespace chromeos |
| 179 | 179 |
| 180 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ | 180 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ |
| OLD | NEW |