Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: chrome/browser/chromeos/login/lock/webui_screen_locker.h

Issue 2859363003: cros: Initial structure for views-based lock. (Closed)
Patch Set: Address comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
16 #include "chrome/browser/chromeos/login/signin_screen_controller.h" 17 #include "chrome/browser/chromeos/login/signin_screen_controller.h"
17 #include "chrome/browser/chromeos/login/signin_specifics.h" 18 #include "chrome/browser/chromeos/login/signin_specifics.h"
18 #include "chrome/browser/chromeos/login/ui/lock_window.h" 19 #include "chrome/browser/chromeos/login/ui/lock_window.h"
19 #include "chrome/browser/chromeos/login/ui/login_display.h" 20 #include "chrome/browser/chromeos/login/ui/login_display.h"
20 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" 21 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
21 #include "chromeos/dbus/power_manager_client.h" 22 #include "chromeos/dbus/power_manager_client.h"
22 #include "content/public/browser/web_contents_observer.h" 23 #include "content/public/browser/web_contents_observer.h"
23 #include "ui/display/display_observer.h" 24 #include "ui/display/display_observer.h"
24 #include "ui/views/widget/widget.h" 25 #include "ui/views/widget/widget.h"
25 #include "ui/views/widget/widget_observer.h" 26 #include "ui/views/widget/widget_observer.h"
(...skipping 10 matching lines...) Expand all
36 namespace login { 37 namespace login {
37 class NetworkStateHelper; 38 class NetworkStateHelper;
38 } 39 }
39 40
40 namespace test { 41 namespace test {
41 class WebUIScreenLockerTester; 42 class WebUIScreenLockerTester;
42 } 43 }
43 44
44 // Displays a WebUI lock screen based on the Oobe account picker screen. 45 // Displays a WebUI lock screen based on the Oobe account picker screen.
45 class WebUIScreenLocker : public WebUILoginView, 46 class WebUIScreenLocker : public WebUILoginView,
47 public ScreenLocker::Delegate,
46 public LoginDisplay::Delegate, 48 public LoginDisplay::Delegate,
47 public views::WidgetObserver, 49 public views::WidgetObserver,
48 public PowerManagerClient::Observer, 50 public PowerManagerClient::Observer,
49 public display::DisplayObserver, 51 public display::DisplayObserver,
50 public content::WebContentsObserver { 52 public content::WebContentsObserver {
51 public: 53 public:
52 enum class FingerprintState {
53 kHidden,
54 kDefault,
55 kSignin,
56 kFailed,
57 kRemoved,
58 };
59
60 // Request lock screen preload when the user is idle. Does nothing if 54 // Request lock screen preload when the user is idle. Does nothing if
61 // preloading is disabled or if the preload hueristics return false. 55 // preloading is disabled or if the preload hueristics return false.
62 static void RequestPreload(); 56 static void RequestPreload();
63 57
64 explicit WebUIScreenLocker(ScreenLocker* screen_locker); 58 explicit WebUIScreenLocker(ScreenLocker* screen_locker);
65 ~WebUIScreenLocker() override; 59 ~WebUIScreenLocker() override;
66 60
67 // Begin initializing the widget and views::WebView that show the lock screen. 61 // Begin initializing the widget and views::WebView that show the lock screen.
68 // ScreenLockReady is called when all initialization has finished. 62 // ScreenLockReady is called when all initialization has finished.
69 void LockScreen(); 63 void LockScreen();
70 64
71 // Enable/disable password input.
72 void SetInputEnabled(bool enabled);
73
74 // Disables all UI needed and shows error bubble with |message|. If
75 // |sign_out_only| is true then all other input except "Sign Out" button is
76 // blocked.
77 void ShowErrorMessage(int error_msg_id,
78 HelpAppLauncher::HelpTopic help_topic_id);
79
80 // Close message bubble to clear error messages.
81 void ClearErrors();
82
83 // Allows to have visual effects once unlock authentication is successful,
84 // Must call ScreenLocker::UnlockOnLoginSuccess() once all effects are done.
85 void AnimateAuthenticationSuccess();
86
87 // Called when the webui lock screen is ready. This gets invoked by a
88 // chrome.send from the embedded webui.
89 void OnLockWebUIReady();
90
91 // Called when webui lock screen wallpaper is loaded and displayed.
92 void OnLockBackgroundDisplayed();
93
94 // Called when the webui header bar becomes visible.
95 void OnHeaderBarVisible();
96
97 // Called by ScreenLocker to notify that ash lock animation finishes.
98 void OnAshLockAnimationFinished();
99
100 void SetFingerprintState(const AccountId& account_id, FingerprintState state);
101
102 private: 65 private:
103 friend class test::WebUIScreenLockerTester; 66 friend class test::WebUIScreenLockerTester;
104 67
105 // Returns true if the lock screen should be preloaded. 68 // Returns true if the lock screen should be preloaded.
106 static bool ShouldPreloadLockScreen(); 69 static bool ShouldPreloadLockScreen();
107 // Helper function that creates and preloads a views::WebView. 70 // Helper function that creates and preloads a views::WebView.
108 static std::unique_ptr<views::WebView> DoPreload(Profile* profile); 71 static std::unique_ptr<views::WebView> DoPreload(Profile* profile);
109 72
73 // ScreenLocker::Delegate:
74 void SetPasswordInputEnabled(bool enabled) override;
75 void ShowErrorMessage(int error_msg_id,
76 HelpAppLauncher::HelpTopic help_topic_id) override;
77 void ClearErrors() override;
78 void AnimateAuthenticationSuccess() override;
79 void OnLockWebUIReady() override;
80 void OnLockBackgroundDisplayed() override;
81 void OnHeaderBarVisible() override;
82 void OnAshLockAnimationFinished() override;
83 void SetFingerprintState(const AccountId& account_id,
84 ScreenLocker::FingerprintState state) override;
85 content::WebContents* GetWebContents() override;
86
110 // LoginDisplay::Delegate: 87 // LoginDisplay::Delegate:
111 void CancelPasswordChangedFlow() override; 88 void CancelPasswordChangedFlow() override;
112 void CompleteLogin(const UserContext& user_context) override; 89 void CompleteLogin(const UserContext& user_context) override;
113 base::string16 GetConnectedNetworkName() override; 90 base::string16 GetConnectedNetworkName() override;
114 bool IsSigninInProgress() const override; 91 bool IsSigninInProgress() const override;
115 void Login(const UserContext& user_context, 92 void Login(const UserContext& user_context,
116 const SigninSpecifics& specifics) override; 93 const SigninSpecifics& specifics) override;
117 void MigrateUserData(const std::string& old_password) override; 94 void MigrateUserData(const std::string& old_password) override;
118 void OnSigninScreenReady() override; 95 void OnSigninScreenReady() override;
119 void OnGaiaScreenReady() override; 96 void OnGaiaScreenReady() override;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 std::unique_ptr<login::NetworkStateHelper> network_state_helper_; 167 std::unique_ptr<login::NetworkStateHelper> network_state_helper_;
191 168
192 base::WeakPtrFactory<WebUIScreenLocker> weak_factory_; 169 base::WeakPtrFactory<WebUIScreenLocker> weak_factory_;
193 170
194 DISALLOW_COPY_AND_ASSIGN(WebUIScreenLocker); 171 DISALLOW_COPY_AND_ASSIGN(WebUIScreenLocker);
195 }; 172 };
196 173
197 } // namespace chromeos 174 } // namespace chromeos
198 175
199 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WEBUI_SCREEN_LOCKER_H_ 176 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WEBUI_SCREEN_LOCKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698