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