| OLD | NEW |
| 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 CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_VIEWS_SCREEN_LOCKER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_VIEWS_SCREEN_LOCKER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_VIEWS_SCREEN_LOCKER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_VIEWS_SCREEN_LOCKER_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 10 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 10 #include "chrome/browser/ui/ash/lock_screen_client.h" | 11 #include "chrome/browser/ui/ash/lock_screen_client.h" |
| 12 #include "chromeos/dbus/power_manager_client.h" |
| 11 | 13 |
| 12 namespace chromeos { | 14 namespace chromeos { |
| 13 | 15 |
| 14 class UserSelectionScreen; | 16 class UserSelectionScreen; |
| 15 class UserSelectionScreenProxy; | 17 class UserSelectionScreenProxy; |
| 16 | 18 |
| 17 // ViewsScreenLocker acts like LockScreenClient::Delegate which handles method | 19 // ViewsScreenLocker acts like LockScreenClient::Delegate which handles method |
| 18 // calls coming from ash into chrome. | 20 // calls coming from ash into chrome. |
| 19 // It is also a ScreenLocker::Delegate which handles calls from chrome into | 21 // It is also a ScreenLocker::Delegate which handles calls from chrome into |
| 20 // ash (views-based lockscreen). | 22 // ash (views-based lockscreen). |
| 21 class ViewsScreenLocker : public LockScreenClient::Delegate, | 23 class ViewsScreenLocker : public LockScreenClient::Delegate, |
| 22 public ScreenLocker::Delegate { | 24 public ScreenLocker::Delegate, |
| 25 public PowerManagerClient::Observer { |
| 23 public: | 26 public: |
| 24 explicit ViewsScreenLocker(ScreenLocker* screen_locker); | 27 explicit ViewsScreenLocker(ScreenLocker* screen_locker); |
| 25 ~ViewsScreenLocker() override; | 28 ~ViewsScreenLocker() override; |
| 26 | 29 |
| 30 void Init(); |
| 31 void OnLockScreenReady(); |
| 32 |
| 27 // ScreenLocker::Delegate: | 33 // ScreenLocker::Delegate: |
| 28 void SetPasswordInputEnabled(bool enabled) override; | 34 void SetPasswordInputEnabled(bool enabled) override; |
| 29 void ShowErrorMessage(int error_msg_id, | 35 void ShowErrorMessage(int error_msg_id, |
| 30 HelpAppLauncher::HelpTopic help_topic_id) override; | 36 HelpAppLauncher::HelpTopic help_topic_id) override; |
| 31 void ClearErrors() override; | 37 void ClearErrors() override; |
| 32 void AnimateAuthenticationSuccess() override; | 38 void AnimateAuthenticationSuccess() override; |
| 33 void OnLockWebUIReady() override; | 39 void OnLockWebUIReady() override; |
| 34 void OnLockBackgroundDisplayed() override; | 40 void OnLockBackgroundDisplayed() override; |
| 35 void OnHeaderBarVisible() override; | 41 void OnHeaderBarVisible() override; |
| 36 void OnAshLockAnimationFinished() override; | 42 void OnAshLockAnimationFinished() override; |
| 37 void SetFingerprintState(const AccountId& account_id, | 43 void SetFingerprintState(const AccountId& account_id, |
| 38 ScreenLocker::FingerprintState state) override; | 44 ScreenLocker::FingerprintState state) override; |
| 39 content::WebContents* GetWebContents() override; | 45 content::WebContents* GetWebContents() override; |
| 40 | 46 |
| 41 void Init(); | |
| 42 void OnLockScreenReady(); | |
| 43 | |
| 44 private: | |
| 45 // LockScreenClient::Delegate | 47 // LockScreenClient::Delegate |
| 48 void HandleAuthenticateUser(const AccountId& account_id, |
| 49 const std::string& hashed_password, |
| 50 bool authenticated_by_pin, |
| 51 AuthenticateUserCallback callback) override; |
| 46 void HandleAttemptUnlock(const AccountId& account_id) override; | 52 void HandleAttemptUnlock(const AccountId& account_id) override; |
| 47 void HandleHardlockPod(const AccountId& account_id) override; | 53 void HandleHardlockPod(const AccountId& account_id) override; |
| 48 void HandleRecordClickOnLockIcon(const AccountId& account_id) override; | 54 void HandleRecordClickOnLockIcon(const AccountId& account_id) override; |
| 55 void HandleOnFocusPod(const AccountId& account_id) override; |
| 56 void HandleOnNoPodFocused() override; |
| 57 |
| 58 // PowerManagerClient::Observer: |
| 59 void SuspendDone(const base::TimeDelta& sleep_duration) override; |
| 60 |
| 61 private: |
| 62 void UpdatePinKeyboardState(const AccountId& account_id); |
| 63 void OnAllowedInputMethodsChanged(); |
| 49 | 64 |
| 50 std::unique_ptr<UserSelectionScreenProxy> user_selection_screen_proxy_; | 65 std::unique_ptr<UserSelectionScreenProxy> user_selection_screen_proxy_; |
| 51 std::unique_ptr<UserSelectionScreen> user_selection_screen_; | 66 std::unique_ptr<UserSelectionScreen> user_selection_screen_; |
| 52 | 67 |
| 53 // The ScreenLocker that owns this instance. | 68 // The ScreenLocker that owns this instance. |
| 54 ScreenLocker* const screen_locker_ = nullptr; | 69 ScreenLocker* const screen_locker_ = nullptr; |
| 55 | 70 |
| 56 // Time when lock was initiated, required for metrics. | 71 // Time when lock was initiated, required for metrics. |
| 57 base::TimeTicks lock_time_; | 72 base::TimeTicks lock_time_; |
| 58 | 73 |
| 74 base::Optional<AccountId> focused_pod_account_id_; |
| 75 |
| 76 // Input Method Engine state used at lock screen. |
| 77 scoped_refptr<input_method::InputMethodManager::State> ime_state_; |
| 78 |
| 79 std::unique_ptr<CrosSettings::ObserverSubscription> |
| 80 allowed_input_methods_subscription_; |
| 81 |
| 82 bool lock_screen_ready_ = false; |
| 83 |
| 59 base::WeakPtrFactory<ViewsScreenLocker> weak_factory_; | 84 base::WeakPtrFactory<ViewsScreenLocker> weak_factory_; |
| 60 | 85 |
| 61 DISALLOW_COPY_AND_ASSIGN(ViewsScreenLocker); | 86 DISALLOW_COPY_AND_ASSIGN(ViewsScreenLocker); |
| 62 }; | 87 }; |
| 63 | 88 |
| 64 } // namespace chromeos | 89 } // namespace chromeos |
| 65 | 90 |
| 66 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_VIEWS_SCREEN_LOCKER_H_ | 91 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_VIEWS_SCREEN_LOCKER_H_ |
| OLD | NEW |