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.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_SCREEN_CONTROLLER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_SCREEN_CONTROLLER_H_
8 #include "chrome/browser/chromeos/login/screens/gaia_screen.h"
9 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h"
10 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
11 #include "chrome/browser/chromeos/login/ui/oobe_display.h"
12 #include "components/user_manager/remove_user_delegate.h"
13 #include "components/user_manager/user.h"
14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h"
19 class LoginDisplayWebUIHandler
;
21 // Class that manages control flow between wizard screens. Wizard controller
22 // interacts with screen controllers to move the user between screens.
23 class SignInScreenController
: public user_manager::RemoveUserDelegate
,
24 public content::NotificationObserver
{
26 SignInScreenController(OobeDisplay
* oobe_display
,
27 LoginDisplay::Delegate
* login_display_delegate
);
28 ~SignInScreenController() override
;
30 // Returns the default wizard controller if it has been created.
31 static SignInScreenController
* Get() { return instance_
; }
33 void SetWebUIHandler(LoginDisplayWebUIHandler
* webui_handler
);
35 // Set up the list of users for user selection screen.
36 // TODO(antrim): replace with querying for this data.
37 void Init(const user_manager::UserList
& users
, bool show_guest
);
39 // Called when signin screen is ready.
40 void OnSigninScreenReady();
42 // Query to send list of users to user selection screen.
45 // Provide current list of users on user selection screen.
46 const user_manager::UserList
& GetUsers();
48 // Query to remove user with specified id.
49 // TODO(antrim): move to user selection screen handler.
50 void RemoveUser(const std::string
& user_id
);
52 // user_manager::RemoveUserDelegate implementation:
53 void OnBeforeUserRemoved(const std::string
& username
) override
;
54 void OnUserRemoved(const std::string
& username
) override
;
56 // content::NotificationObserver implementation.
57 void Observe(int type
,
58 const content::NotificationSource
& source
,
59 const content::NotificationDetails
& details
) override
;
62 static SignInScreenController
* instance_
;
64 OobeDisplay
* oobe_display_
;
66 // Reference to the WebUI handling layer for the login screen
67 LoginDisplayWebUIHandler
* webui_handler_
;
69 scoped_ptr
<GaiaScreen
> gaia_screen_
;
70 scoped_ptr
<UserSelectionScreen
> user_selection_screen_
;
72 // Used for notifications during the login process.
73 content::NotificationRegistrar registrar_
;
75 DISALLOW_COPY_AND_ASSIGN(SignInScreenController
);
78 } // namespace chromeos
80 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_SCREEN_CONTROLLER_H_