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 // Runs OAauth token validity check.
49 void CheckUserStatus(const std::string
& user_id
);
51 // Query to remove user with specified id.
52 // TODO(antrim): move to user selection screen handler.
53 void RemoveUser(const std::string
& user_id
);
55 // user_manager::RemoveUserDelegate implementation:
56 void OnBeforeUserRemoved(const std::string
& username
) override
;
57 void OnUserRemoved(const std::string
& username
) override
;
59 // content::NotificationObserver implementation.
60 void Observe(int type
,
61 const content::NotificationSource
& source
,
62 const content::NotificationDetails
& details
) override
;
65 static SignInScreenController
* instance_
;
67 OobeDisplay
* oobe_display_
;
69 // Reference to the WebUI handling layer for the login screen
70 LoginDisplayWebUIHandler
* webui_handler_
;
72 scoped_ptr
<GaiaScreen
> gaia_screen_
;
73 scoped_ptr
<UserSelectionScreen
> user_selection_screen_
;
75 // Used for notifications during the login process.
76 content::NotificationRegistrar registrar_
;
78 DISALLOW_COPY_AND_ASSIGN(SignInScreenController
);
81 } // namespace chromeos
83 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_SCREEN_CONTROLLER_H_