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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UI_WEBUI_LOGIN_DISPLAY_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_UI_WEBUI_LOGIN_DISPLAY_H_
11 #include "base/compiler_specific.h"
12 #include "chrome/browser/chromeos/login/signin_specifics.h"
13 #include "chrome/browser/chromeos/login/ui/login_display.h"
14 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h"
15 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
16 #include "components/user_manager/user.h"
17 #include "ui/base/user_activity/user_activity_observer.h"
18 #include "ui/views/widget/widget.h"
22 // WebUI-based login UI implementation.
23 class WebUILoginDisplay
: public LoginDisplay
,
24 public NativeWindowDelegate
,
25 public SigninScreenHandlerDelegate
,
26 public ui::UserActivityObserver
{
28 explicit WebUILoginDisplay(LoginDisplay::Delegate
* delegate
);
29 ~WebUILoginDisplay() override
;
31 // LoginDisplay implementation:
32 void ClearAndEnablePassword() override
;
33 void Init(const user_manager::UserList
& users
,
36 bool show_new_user
) override
;
37 void OnPreferencesChanged() override
;
38 void RemoveUser(const std::string
& user_id
) override
;
39 void SetUIEnabled(bool is_enabled
) override
;
40 void ShowError(int error_msg_id
,
42 HelpAppLauncher::HelpTopic help_topic_id
) override
;
43 void ShowErrorScreen(LoginDisplay::SigninError error_id
) override
;
44 void ShowPasswordChangedDialog(bool show_password_error
,
45 const std::string
& email
) override
;
46 void ShowSigninUI(const std::string
& email
) override
;
47 void ShowWhitelistCheckFailedError() override
;
49 // NativeWindowDelegate implementation:
50 gfx::NativeWindow
GetNativeWindow() const override
;
52 // SigninScreenHandlerDelegate implementation:
53 void CancelPasswordChangedFlow() override
;
54 void ResyncUserData() override
;
55 void MigrateUserData(const std::string
& old_password
) override
;
57 void Login(const UserContext
& user_context
,
58 const SigninSpecifics
& specifics
) override
;
59 bool IsSigninInProgress() const override
;
60 void Signout() override
;
61 void CreateAccount() override
;
62 void CompleteLogin(const UserContext
& user_context
) override
;
64 void OnSigninScreenReady() override
;
65 void CancelUserAdding() override
;
66 void LoadWallpaper(const std::string
& username
) override
;
67 void LoadSigninWallpaper() override
;
68 void ShowEnterpriseEnrollmentScreen() override
;
69 void ShowEnableDebuggingScreen() override
;
70 void ShowKioskEnableScreen() override
;
71 void ShowKioskAutolaunchScreen() override
;
72 void ShowWrongHWIDScreen() override
;
73 void SetWebUIHandler(LoginDisplayWebUIHandler
* webui_handler
) override
;
74 virtual void ShowSigninScreenForCreds(const std::string
& username
,
75 const std::string
& password
);
76 bool IsShowGuest() const override
;
77 bool IsShowUsers() const override
;
78 bool IsUserSigninCompleted() const override
;
79 void SetDisplayEmail(const std::string
& email
) override
;
81 void HandleGetUsers() override
;
82 void CheckUserStatus(const std::string
& user_id
) override
;
83 const user_manager::UserList
& GetUsers() const override
;
84 bool IsUserWhitelisted(const std::string
& user_id
) override
;
86 // ui::UserActivityDetector implementation:
87 void OnUserActivity(const ui::Event
* event
) override
;
91 // Whether to show guest login.
94 // Weather to show the user pods or a GAIA sign in.
95 // Public sessions are always shown.
98 // Whether to show add new user.
101 // Reference to the WebUI handling layer for the login screen
102 LoginDisplayWebUIHandler
* webui_handler_
;
104 DISALLOW_COPY_AND_ASSIGN(WebUILoginDisplay
);
107 } // namespace chromeos
109 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UI_WEBUI_LOGIN_DISPLAY_H_