Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / login / app_launch_signin_screen.h
1 // Copyright 2013 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_APP_LAUNCH_SIGNIN_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_SIGNIN_SCREEN_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/chromeos/login/authenticator.h"
12 #include "chrome/browser/chromeos/login/login_status_consumer.h"
13 #include "chrome/browser/chromeos/login/user_manager.h"
14 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
15
16 namespace chromeos {
17
18 class OobeUI;
19
20 // The app launch signin screen shows the user pod of the device owner
21 // and requires the user to login in order to access the network dialog.
22 // This screen is quite similar to the standard lock screen, but we do not
23 // create a new view to superimpose over the desktop.
24 //
25 // TODO(tengs): This class doesn't quite follow the idiom of the other
26 // screen classes, as SigninScreenHandler is very tightly coupled with
27 // the login screen. We should do some refactoring in this area.
28 class AppLaunchSigninScreen
29     : public SigninScreenHandlerDelegate,
30       public LoginStatusConsumer {
31  public:
32   class Delegate {
33    public:
34     virtual void OnOwnerSigninSuccess() = 0;
35
36    protected:
37     virtual ~Delegate() {}
38   };
39
40   AppLaunchSigninScreen(OobeUI* oobe_display, Delegate *delegate);
41   virtual ~AppLaunchSigninScreen();
42
43   void Show();
44
45   static void SetUserManagerForTesting(UserManager* user_manager);
46
47  private:
48   void InitOwnerUserList();
49   UserManager* GetUserManager();
50
51   // SigninScreenHandlerDelegate implementation:
52   virtual void CancelPasswordChangedFlow() OVERRIDE;
53   virtual void CancelUserAdding() OVERRIDE;
54   virtual void CreateAccount() OVERRIDE;
55   virtual void CompleteLogin(const UserContext& user_context) OVERRIDE;
56   virtual void Login(const UserContext& user_context) OVERRIDE;
57   virtual void LoginAsRetailModeUser() OVERRIDE;
58   virtual void LoginAsGuest() OVERRIDE;
59   virtual void MigrateUserData(const std::string& old_password) OVERRIDE;
60   virtual void LoginAsPublicAccount(const std::string& username) OVERRIDE;
61   virtual void LoadWallpaper(const std::string& username) OVERRIDE;
62   virtual void LoadSigninWallpaper() OVERRIDE;
63   virtual void OnSigninScreenReady() OVERRIDE;
64   virtual void RemoveUser(const std::string& username) OVERRIDE;
65   virtual void ResyncUserData() OVERRIDE;
66   virtual void ShowEnterpriseEnrollmentScreen() OVERRIDE;
67   virtual void ShowKioskEnableScreen() OVERRIDE;
68   virtual void ShowResetScreen() OVERRIDE;
69   virtual void ShowKioskAutolaunchScreen() OVERRIDE;
70   virtual void ShowWrongHWIDScreen() OVERRIDE;
71   virtual void SetWebUIHandler(
72       LoginDisplayWebUIHandler* webui_handler) OVERRIDE;
73   virtual void ShowSigninScreenForCreds(const std::string& username,
74                                         const std::string& password);
75   virtual const UserList& GetUsers() const OVERRIDE;
76   virtual bool IsShowGuest() const OVERRIDE;
77   virtual bool IsShowUsers() const OVERRIDE;
78   virtual bool IsShowNewUser() const OVERRIDE;
79   virtual bool IsSigninInProgress() const OVERRIDE;
80   virtual bool IsUserSigninCompleted() const OVERRIDE;
81   virtual void SetDisplayEmail(const std::string& email) OVERRIDE;
82   virtual void Signout() OVERRIDE;
83   virtual void LoginAsKioskApp(const std::string& app_id,
84                                bool diagnostic_mode) OVERRIDE;
85
86   // LoginStatusConsumer implementation:
87   virtual void OnLoginFailure(const LoginFailure& error) OVERRIDE;
88   virtual void OnLoginSuccess(const UserContext& user_context) OVERRIDE;
89
90   OobeUI* oobe_ui_;
91   Delegate* delegate_;
92   LoginDisplayWebUIHandler* webui_handler_;
93   scoped_refptr<Authenticator> authenticator_;
94
95   // This list should have at most one user, and that user should be the owner.
96   UserList owner_user_list_;
97
98   static UserManager* test_user_manager_;
99
100   DISALLOW_COPY_AND_ASSIGN(AppLaunchSigninScreen);
101 };
102
103 }  // namespace chromeos
104
105 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_APP_LAUNCH_SIGNIN_SCREEN_H_