OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/compiler_specific.h" | |
12 #include "base/timer/timer.h" | |
13 #include "chrome/browser/chromeos/login/login_display.h" | |
14 #include "chrome/browser/chromeos/login/user.h" | |
15 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" | |
16 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | |
17 #include "ui/views/widget/widget.h" | |
18 #include "ui/wm/core/user_activity_observer.h" | |
19 | |
20 namespace chromeos { | |
21 // WebUI-based login UI implementation. | |
22 class WebUILoginDisplay : public LoginDisplay, | |
23 public NativeWindowDelegate, | |
24 public SigninScreenHandlerDelegate, | |
25 public wm::UserActivityObserver { | |
26 public: | |
27 explicit WebUILoginDisplay(LoginDisplay::Delegate* delegate); | |
28 virtual ~WebUILoginDisplay(); | |
29 | |
30 // LoginDisplay implementation: | |
31 virtual void ClearAndEnablePassword() OVERRIDE; | |
32 virtual void Init(const UserList& users, | |
33 bool show_guest, | |
34 bool show_users, | |
35 bool show_new_user) OVERRIDE; | |
36 virtual void OnPreferencesChanged() OVERRIDE; | |
37 virtual void OnBeforeUserRemoved(const std::string& username) OVERRIDE; | |
38 virtual void OnUserImageChanged(const User& user) OVERRIDE; | |
39 virtual void OnUserRemoved(const std::string& username) OVERRIDE; | |
40 virtual void OnFadeOut() OVERRIDE; | |
41 virtual void OnLoginSuccess(const std::string& username) OVERRIDE; | |
42 virtual void SetUIEnabled(bool is_enabled) OVERRIDE; | |
43 virtual void SelectPod(int index) OVERRIDE; | |
44 virtual void ShowBannerMessage(const std::string& message) OVERRIDE; | |
45 virtual void ShowUserPodButton(const std::string& username, | |
46 const std::string& iconURL, | |
47 const base::Closure& click_callback) OVERRIDE; | |
48 virtual void HideUserPodButton(const std::string& username) OVERRIDE; | |
49 virtual void SetAuthType(const std::string& username, | |
50 AuthType auth_type, | |
51 const std::string& initial_value) OVERRIDE; | |
52 virtual AuthType GetAuthType(const std::string& username) const OVERRIDE; | |
53 virtual void ShowError(int error_msg_id, | |
54 int login_attempts, | |
55 HelpAppLauncher::HelpTopic help_topic_id) OVERRIDE; | |
56 virtual void ShowErrorScreen(LoginDisplay::SigninError error_id) OVERRIDE; | |
57 virtual void ShowGaiaPasswordChanged(const std::string& username) OVERRIDE; | |
58 virtual void ShowPasswordChangedDialog(bool show_password_error) OVERRIDE; | |
59 virtual void ShowSigninUI(const std::string& email) OVERRIDE; | |
60 virtual void ShowControlBar(bool show) OVERRIDE; | |
61 | |
62 // NativeWindowDelegate implementation: | |
63 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; | |
64 | |
65 // SigninScreenHandlerDelegate implementation: | |
66 virtual void CancelPasswordChangedFlow() OVERRIDE; | |
67 virtual void CancelUserAdding() OVERRIDE; | |
68 virtual void CreateAccount() OVERRIDE; | |
69 virtual void CompleteLogin(const UserContext& user_context) OVERRIDE; | |
70 virtual void Login(const UserContext& user_context) OVERRIDE; | |
71 virtual void LoginAsRetailModeUser() OVERRIDE; | |
72 virtual void LoginAsGuest() OVERRIDE; | |
73 virtual void MigrateUserData(const std::string& old_password) OVERRIDE; | |
74 virtual void LoginAsPublicAccount(const std::string& username) OVERRIDE; | |
75 virtual void LoadWallpaper(const std::string& username) OVERRIDE; | |
76 virtual void LoadSigninWallpaper() OVERRIDE; | |
77 virtual void OnSigninScreenReady() OVERRIDE; | |
78 virtual void RemoveUser(const std::string& username) OVERRIDE; | |
79 virtual void ResyncUserData() OVERRIDE; | |
80 virtual void ShowEnterpriseEnrollmentScreen() OVERRIDE; | |
81 virtual void ShowKioskEnableScreen() OVERRIDE; | |
82 virtual void ShowKioskAutolaunchScreen() OVERRIDE; | |
83 virtual void ShowWrongHWIDScreen() OVERRIDE; | |
84 virtual void SetWebUIHandler( | |
85 LoginDisplayWebUIHandler* webui_handler) OVERRIDE; | |
86 virtual void ShowSigninScreenForCreds(const std::string& username, | |
87 const std::string& password); | |
88 virtual const UserList& GetUsers() const OVERRIDE; | |
89 virtual bool IsShowGuest() const OVERRIDE; | |
90 virtual bool IsShowUsers() const OVERRIDE; | |
91 virtual bool IsShowNewUser() const OVERRIDE; | |
92 virtual bool IsSigninInProgress() const OVERRIDE; | |
93 virtual bool IsUserSigninCompleted() const OVERRIDE; | |
94 virtual void SetDisplayEmail(const std::string& email) OVERRIDE; | |
95 virtual void Signout() OVERRIDE; | |
96 virtual void LoginAsKioskApp(const std::string& app_id, | |
97 bool diagnostic_mode) OVERRIDE; | |
98 | |
99 // wm::UserActivityDetector implementation: | |
100 virtual void OnUserActivity(const ui::Event* event) OVERRIDE; | |
101 | |
102 private: | |
103 void StartPasswordClearTimer(); | |
104 void OnPasswordClearTimerExpired(); | |
105 | |
106 // Set of Users that are visible. | |
107 UserList users_; | |
108 | |
109 // Whether to show guest login. | |
110 bool show_guest_; | |
111 | |
112 // Weather to show the user pods or a GAIA sign in. | |
113 // Public sessions are always shown. | |
114 bool show_users_; | |
115 | |
116 // Whether to show add new user. | |
117 bool show_new_user_; | |
118 | |
119 // Timer for measuring idle state duration before password clear. | |
120 base::OneShotTimer<WebUILoginDisplay> password_clear_timer_; | |
121 | |
122 // Reference to the WebUI handling layer for the login screen | |
123 LoginDisplayWebUIHandler* webui_handler_; | |
124 | |
125 DISALLOW_COPY_AND_ASSIGN(WebUILoginDisplay); | |
126 }; | |
127 | |
128 } // namespace chromeos | |
129 | |
130 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_LOGIN_DISPLAY_H_ | |
OLD | NEW |