| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_SCREEN_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_SCREEN_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_SCREEN_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_SCREEN_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/chromeos/login/screens/gaia_screen.h" | 8 #include "chrome/browser/chromeos/login/screens/gaia_screen.h" |
| 9 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" | 9 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" |
| 10 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 10 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 11 #include "chrome/browser/chromeos/login/ui/oobe_display.h" | 11 #include "chrome/browser/chromeos/login/ui/oobe_display.h" |
| 12 #include "components/user_manager/remove_user_delegate.h" | 12 #include "components/user_manager/remove_user_delegate.h" |
| 13 #include "components/user_manager/user.h" | 13 #include "components/user_manager/user.h" |
| 14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 16 | 16 |
| 17 namespace chromeos { | 17 namespace chromeos { |
| 18 | 18 |
| 19 class LoginDisplayWebUIHandler; | 19 class LoginDisplayWebUIHandler; |
| 20 | 20 |
| 21 // Class that manages control flow between wizard screens. Wizard controller | 21 // Class that manages control flow between wizard screens. Wizard controller |
| 22 // interacts with screen controllers to move the user between screens. | 22 // interacts with screen controllers to move the user between screens. |
| 23 class SignInScreenController : public user_manager::RemoveUserDelegate, | 23 class SignInScreenController : public user_manager::RemoveUserDelegate, |
| 24 public content::NotificationObserver { | 24 public content::NotificationObserver { |
| 25 public: | 25 public: |
| 26 SignInScreenController(OobeDisplay* oobe_display, | 26 SignInScreenController(OobeDisplay* oobe_display, |
| 27 LoginDisplay::Delegate* login_display_delegate); | 27 LoginDisplay::Delegate* login_display_delegate); |
| 28 virtual ~SignInScreenController(); | 28 ~SignInScreenController() override; |
| 29 | 29 |
| 30 // Returns the default wizard controller if it has been created. | 30 // Returns the default wizard controller if it has been created. |
| 31 static SignInScreenController* Get() { return instance_; } | 31 static SignInScreenController* Get() { return instance_; } |
| 32 | 32 |
| 33 void SetWebUIHandler(LoginDisplayWebUIHandler* webui_handler); | 33 void SetWebUIHandler(LoginDisplayWebUIHandler* webui_handler); |
| 34 | 34 |
| 35 // Set up the list of users for user selection screen. | 35 // Set up the list of users for user selection screen. |
| 36 // TODO(antrim): replace with querying for this data. | 36 // TODO(antrim): replace with querying for this data. |
| 37 void Init(const user_manager::UserList& users, bool show_guest); | 37 void Init(const user_manager::UserList& users, bool show_guest); |
| 38 | 38 |
| 39 // Called when signin screen is ready. | 39 // Called when signin screen is ready. |
| 40 void OnSigninScreenReady(); | 40 void OnSigninScreenReady(); |
| 41 | 41 |
| 42 // Query to send list of users to user selection screen. | 42 // Query to send list of users to user selection screen. |
| 43 void SendUserList(); | 43 void SendUserList(); |
| 44 | 44 |
| 45 // Provide current list of users on user selection screen. | 45 // Provide current list of users on user selection screen. |
| 46 const user_manager::UserList& GetUsers(); | 46 const user_manager::UserList& GetUsers(); |
| 47 | 47 |
| 48 // Query to remove user with specified id. | 48 // Query to remove user with specified id. |
| 49 // TODO(antrim): move to user selection screen handler. | 49 // TODO(antrim): move to user selection screen handler. |
| 50 void RemoveUser(const std::string& user_id); | 50 void RemoveUser(const std::string& user_id); |
| 51 | 51 |
| 52 // user_manager::RemoveUserDelegate implementation: | 52 // user_manager::RemoveUserDelegate implementation: |
| 53 virtual void OnBeforeUserRemoved(const std::string& username) override; | 53 void OnBeforeUserRemoved(const std::string& username) override; |
| 54 virtual void OnUserRemoved(const std::string& username) override; | 54 void OnUserRemoved(const std::string& username) override; |
| 55 | 55 |
| 56 // content::NotificationObserver implementation. | 56 // content::NotificationObserver implementation. |
| 57 virtual void Observe(int type, | 57 void Observe(int type, |
| 58 const content::NotificationSource& source, | 58 const content::NotificationSource& source, |
| 59 const content::NotificationDetails& details) override; | 59 const content::NotificationDetails& details) override; |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 static SignInScreenController* instance_; | 62 static SignInScreenController* instance_; |
| 63 | 63 |
| 64 OobeDisplay* oobe_display_; | 64 OobeDisplay* oobe_display_; |
| 65 | 65 |
| 66 // Reference to the WebUI handling layer for the login screen | 66 // Reference to the WebUI handling layer for the login screen |
| 67 LoginDisplayWebUIHandler* webui_handler_; | 67 LoginDisplayWebUIHandler* webui_handler_; |
| 68 | 68 |
| 69 scoped_ptr<GaiaScreen> gaia_screen_; | 69 scoped_ptr<GaiaScreen> gaia_screen_; |
| 70 scoped_ptr<UserSelectionScreen> user_selection_screen_; | 70 scoped_ptr<UserSelectionScreen> user_selection_screen_; |
| 71 | 71 |
| 72 // Used for notifications during the login process. | 72 // Used for notifications during the login process. |
| 73 content::NotificationRegistrar registrar_; | 73 content::NotificationRegistrar registrar_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(SignInScreenController); | 75 DISALLOW_COPY_AND_ASSIGN(SignInScreenController); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace chromeos | 78 } // namespace chromeos |
| 79 | 79 |
| 80 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_SCREEN_CONTROLLER_H_ | 80 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_SCREEN_CONTROLLER_H_ |
| OLD | NEW |