| 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_WEBUI_SCREEN_LOCKER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WEBUI_SCREEN_LOCKER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WEBUI_SCREEN_LOCKER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WEBUI_SCREEN_LOCKER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "ash/wm/lock_state_observer.h" | |
| 14 #include "base/macros.h" | 13 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 16 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 17 #include "chrome/browser/chromeos/login/signin_screen_controller.h" | 16 #include "chrome/browser/chromeos/login/signin_screen_controller.h" |
| 18 #include "chrome/browser/chromeos/login/signin_specifics.h" | 17 #include "chrome/browser/chromeos/login/signin_specifics.h" |
| 19 #include "chrome/browser/chromeos/login/ui/lock_window.h" | 18 #include "chrome/browser/chromeos/login/ui/lock_window.h" |
| 20 #include "chrome/browser/chromeos/login/ui/login_display.h" | 19 #include "chrome/browser/chromeos/login/ui/login_display.h" |
| 21 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 20 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 22 #include "chromeos/dbus/power_manager_client.h" | 21 #include "chromeos/dbus/power_manager_client.h" |
| 23 #include "content/public/browser/web_contents_observer.h" | 22 #include "content/public/browser/web_contents_observer.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 38 class NetworkStateHelper; | 37 class NetworkStateHelper; |
| 39 } | 38 } |
| 40 | 39 |
| 41 namespace test { | 40 namespace test { |
| 42 class WebUIScreenLockerTester; | 41 class WebUIScreenLockerTester; |
| 43 } | 42 } |
| 44 | 43 |
| 45 // Displays a WebUI lock screen based on the Oobe account picker screen. | 44 // Displays a WebUI lock screen based on the Oobe account picker screen. |
| 46 class WebUIScreenLocker : public WebUILoginView, | 45 class WebUIScreenLocker : public WebUILoginView, |
| 47 public LoginDisplay::Delegate, | 46 public LoginDisplay::Delegate, |
| 48 public ash::LockStateObserver, | |
| 49 public views::WidgetObserver, | 47 public views::WidgetObserver, |
| 50 public PowerManagerClient::Observer, | 48 public PowerManagerClient::Observer, |
| 51 public display::DisplayObserver, | 49 public display::DisplayObserver, |
| 52 public content::WebContentsObserver { | 50 public content::WebContentsObserver { |
| 53 public: | 51 public: |
| 54 // Request lock screen preload when the user is idle. Does nothing if | 52 // Request lock screen preload when the user is idle. Does nothing if |
| 55 // preloading is disabled or if the preload hueristics return false. | 53 // preloading is disabled or if the preload hueristics return false. |
| 56 static void RequestPreload(); | 54 static void RequestPreload(); |
| 57 | 55 |
| 58 explicit WebUIScreenLocker(ScreenLocker* screen_locker); | 56 explicit WebUIScreenLocker(ScreenLocker* screen_locker); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 81 // Called when the webui lock screen is ready. This gets invoked by a | 79 // Called when the webui lock screen is ready. This gets invoked by a |
| 82 // chrome.send from the embedded webui. | 80 // chrome.send from the embedded webui. |
| 83 void OnLockWebUIReady(); | 81 void OnLockWebUIReady(); |
| 84 | 82 |
| 85 // Called when webui lock screen wallpaper is loaded and displayed. | 83 // Called when webui lock screen wallpaper is loaded and displayed. |
| 86 void OnLockBackgroundDisplayed(); | 84 void OnLockBackgroundDisplayed(); |
| 87 | 85 |
| 88 // Called when the webui header bar becomes visible. | 86 // Called when the webui header bar becomes visible. |
| 89 void OnHeaderBarVisible(); | 87 void OnHeaderBarVisible(); |
| 90 | 88 |
| 89 // Called by ScreenLocker to notify that ash lock animation finishes. |
| 90 void OnLockAnimationFinished(); |
| 91 |
| 91 private: | 92 private: |
| 92 friend class test::WebUIScreenLockerTester; | 93 friend class test::WebUIScreenLockerTester; |
| 93 | 94 |
| 94 // Returns true if the lock screen should be preloaded. | 95 // Returns true if the lock screen should be preloaded. |
| 95 static bool ShouldPreloadLockScreen(); | 96 static bool ShouldPreloadLockScreen(); |
| 96 // Helper function that creates and preloads a views::WebView. | 97 // Helper function that creates and preloads a views::WebView. |
| 97 static std::unique_ptr<views::WebView> DoPreload(Profile* profile); | 98 static std::unique_ptr<views::WebView> DoPreload(Profile* profile); |
| 98 | 99 |
| 99 // LoginDisplay::Delegate: | 100 // LoginDisplay::Delegate: |
| 100 void CancelPasswordChangedFlow() override; | 101 void CancelPasswordChangedFlow() override; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 112 void OnStartKioskAutolaunchScreen() override; | 113 void OnStartKioskAutolaunchScreen() override; |
| 113 void ShowWrongHWIDScreen() override; | 114 void ShowWrongHWIDScreen() override; |
| 114 void ResetAutoLoginTimer() override; | 115 void ResetAutoLoginTimer() override; |
| 115 void ResyncUserData() override; | 116 void ResyncUserData() override; |
| 116 void SetDisplayEmail(const std::string& email) override; | 117 void SetDisplayEmail(const std::string& email) override; |
| 117 void SetDisplayAndGivenName(const std::string& display_name, | 118 void SetDisplayAndGivenName(const std::string& display_name, |
| 118 const std::string& given_name) override; | 119 const std::string& given_name) override; |
| 119 void Signout() override; | 120 void Signout() override; |
| 120 bool IsUserWhitelisted(const AccountId& account_id) override; | 121 bool IsUserWhitelisted(const AccountId& account_id) override; |
| 121 | 122 |
| 122 // LockStateObserver: | |
| 123 void OnLockStateEvent(ash::LockStateObserver::EventType event) override; | |
| 124 | |
| 125 // WidgetObserver: | 123 // WidgetObserver: |
| 126 void OnWidgetDestroying(views::Widget* widget) override; | 124 void OnWidgetDestroying(views::Widget* widget) override; |
| 127 | 125 |
| 128 // PowerManagerClient::Observer: | 126 // PowerManagerClient::Observer: |
| 129 void SuspendImminent() override; | 127 void SuspendImminent() override; |
| 130 void SuspendDone(const base::TimeDelta& sleep_duration) override; | 128 void SuspendDone(const base::TimeDelta& sleep_duration) override; |
| 131 void LidEventReceived(PowerManagerClient::LidState state, | 129 void LidEventReceived(PowerManagerClient::LidState state, |
| 132 const base::TimeTicks& time) override; | 130 const base::TimeTicks& time) override; |
| 133 | 131 |
| 134 // content::WebContentsObserver: | 132 // content::WebContentsObserver: |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 std::unique_ptr<login::NetworkStateHelper> network_state_helper_; | 180 std::unique_ptr<login::NetworkStateHelper> network_state_helper_; |
| 183 | 181 |
| 184 base::WeakPtrFactory<WebUIScreenLocker> weak_factory_; | 182 base::WeakPtrFactory<WebUIScreenLocker> weak_factory_; |
| 185 | 183 |
| 186 DISALLOW_COPY_AND_ASSIGN(WebUIScreenLocker); | 184 DISALLOW_COPY_AND_ASSIGN(WebUIScreenLocker); |
| 187 }; | 185 }; |
| 188 | 186 |
| 189 } // namespace chromeos | 187 } // namespace chromeos |
| 190 | 188 |
| 191 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WEBUI_SCREEN_LOCKER_H_ | 189 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WEBUI_SCREEN_LOCKER_H_ |
| OLD | NEW |