| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ | 6 #define CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include "ash/session/session_state_delegate.h" | 8 #include "ash/session/session_state_delegate.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 12 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 13 #include "chromeos/login/login_state.h" | 13 #include "chromeos/login/login_state.h" |
| 14 #include "components/user_manager/user_manager.h" | 14 #include "components/user_manager/user_manager.h" |
| 15 | 15 |
| 16 namespace ash { | 16 namespace ash { |
| 17 class SessionStateObserver; | 17 class SessionStateObserver; |
| 18 } // namespace ash | 18 } // namespace ash |
| 19 | 19 |
| 20 class SessionStateDelegateChromeos | 20 class SessionStateDelegateChromeos |
| 21 : public ash::SessionStateDelegate, | 21 : public ash::SessionStateDelegate, |
| 22 public chromeos::LoginState::Observer, | 22 public chromeos::LoginState::Observer, |
| 23 public user_manager::UserManager::UserSessionStateObserver, | 23 public user_manager::UserManager::UserSessionStateObserver, |
| 24 public chromeos::UserAddingScreen::Observer { | 24 public chromeos::UserAddingScreen::Observer { |
| 25 public: | 25 public: |
| 26 SessionStateDelegateChromeos(); | 26 SessionStateDelegateChromeos(); |
| 27 virtual ~SessionStateDelegateChromeos(); | 27 ~SessionStateDelegateChromeos() override; |
| 28 | 28 |
| 29 // ash::SessionStateDelegate: | 29 // ash::SessionStateDelegate: |
| 30 virtual content::BrowserContext* GetBrowserContextByIndex( | 30 content::BrowserContext* GetBrowserContextByIndex( |
| 31 ash::MultiProfileIndex index) override; | 31 ash::MultiProfileIndex index) override; |
| 32 virtual content::BrowserContext* GetBrowserContextForWindow( | 32 content::BrowserContext* GetBrowserContextForWindow( |
| 33 aura::Window* window) override; | 33 aura::Window* window) override; |
| 34 virtual int GetMaximumNumberOfLoggedInUsers() const override; | 34 int GetMaximumNumberOfLoggedInUsers() const override; |
| 35 virtual int NumberOfLoggedInUsers() const override; | 35 int NumberOfLoggedInUsers() const override; |
| 36 virtual bool CanAddUserToMultiProfile(AddUserError* error) const override; | 36 bool CanAddUserToMultiProfile(AddUserError* error) const override; |
| 37 virtual bool IsActiveUserSessionStarted() const override; | 37 bool IsActiveUserSessionStarted() const override; |
| 38 virtual bool CanLockScreen() const override; | 38 bool CanLockScreen() const override; |
| 39 virtual bool IsScreenLocked() const override; | 39 bool IsScreenLocked() const override; |
| 40 virtual bool ShouldLockScreenBeforeSuspending() const override; | 40 bool ShouldLockScreenBeforeSuspending() const override; |
| 41 virtual void LockScreen() override; | 41 void LockScreen() override; |
| 42 virtual void UnlockScreen() override; | 42 void UnlockScreen() override; |
| 43 virtual bool IsUserSessionBlocked() const override; | 43 bool IsUserSessionBlocked() const override; |
| 44 virtual SessionState GetSessionState() const override; | 44 SessionState GetSessionState() const override; |
| 45 virtual const user_manager::UserInfo* GetUserInfo( | 45 const user_manager::UserInfo* GetUserInfo( |
| 46 ash::MultiProfileIndex index) const override; | 46 ash::MultiProfileIndex index) const override; |
| 47 virtual const user_manager::UserInfo* GetUserInfo( | 47 const user_manager::UserInfo* GetUserInfo( |
| 48 content::BrowserContext* context) const override; | 48 content::BrowserContext* context) const override; |
| 49 virtual bool ShouldShowAvatar(aura::Window* window) const override; | 49 bool ShouldShowAvatar(aura::Window* window) const override; |
| 50 virtual void SwitchActiveUser(const std::string& user_id) override; | 50 void SwitchActiveUser(const std::string& user_id) override; |
| 51 virtual void CycleActiveUser(CycleUser cycle_user) override; | 51 void CycleActiveUser(CycleUser cycle_user) override; |
| 52 virtual bool IsMultiProfileAllowedByPrimaryUserPolicy() const override; | 52 bool IsMultiProfileAllowedByPrimaryUserPolicy() const override; |
| 53 virtual void AddSessionStateObserver( | 53 void AddSessionStateObserver(ash::SessionStateObserver* observer) override; |
| 54 ash::SessionStateObserver* observer) override; | 54 void RemoveSessionStateObserver(ash::SessionStateObserver* observer) override; |
| 55 virtual void RemoveSessionStateObserver( | |
| 56 ash::SessionStateObserver* observer) override; | |
| 57 | 55 |
| 58 // chromeos::LoginState::Observer overrides. | 56 // chromeos::LoginState::Observer overrides. |
| 59 virtual void LoggedInStateChanged() override; | 57 void LoggedInStateChanged() override; |
| 60 | 58 |
| 61 // user_manager::UserManager::UserSessionStateObserver: | 59 // user_manager::UserManager::UserSessionStateObserver: |
| 62 virtual void ActiveUserChanged( | 60 void ActiveUserChanged(const user_manager::User* active_user) override; |
| 63 const user_manager::User* active_user) override; | 61 void UserAddedToSession(const user_manager::User* added_user) override; |
| 64 virtual void UserAddedToSession( | |
| 65 const user_manager::User* added_user) override; | |
| 66 | 62 |
| 67 // chromeos::UserAddingScreen::Observer: | 63 // chromeos::UserAddingScreen::Observer: |
| 68 virtual void OnUserAddingStarted() override; | 64 void OnUserAddingStarted() override; |
| 69 virtual void OnUserAddingFinished() override; | 65 void OnUserAddingFinished() override; |
| 70 | 66 |
| 71 private: | 67 private: |
| 72 // Sets session state to |new_state|. | 68 // Sets session state to |new_state|. |
| 73 // If |force| is true then |new_state| is set even if existing session | 69 // If |force| is true then |new_state| is set even if existing session |
| 74 // state is the same (used for explicit initialization). | 70 // state is the same (used for explicit initialization). |
| 75 void SetSessionState(SessionState new_state, bool force); | 71 void SetSessionState(SessionState new_state, bool force); |
| 76 | 72 |
| 77 // Notify observers about session state change. | 73 // Notify observers about session state change. |
| 78 void NotifySessionStateChanged(); | 74 void NotifySessionStateChanged(); |
| 79 | 75 |
| 80 // Switches to a new user. This call might show a dialog asking the user if he | 76 // Switches to a new user. This call might show a dialog asking the user if he |
| 81 // wants to stop desktop casting before switching. | 77 // wants to stop desktop casting before switching. |
| 82 void TryToSwitchUser(const std::string& user_id); | 78 void TryToSwitchUser(const std::string& user_id); |
| 83 | 79 |
| 84 // List of observers is only used on Chrome OS for now. | 80 // List of observers is only used on Chrome OS for now. |
| 85 ObserverList<ash::SessionStateObserver> session_state_observer_list_; | 81 ObserverList<ash::SessionStateObserver> session_state_observer_list_; |
| 86 | 82 |
| 87 // Session state (e.g. login screen vs. user session). | 83 // Session state (e.g. login screen vs. user session). |
| 88 SessionState session_state_; | 84 SessionState session_state_; |
| 89 | 85 |
| 90 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateChromeos); | 86 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateChromeos); |
| 91 }; | 87 }; |
| 92 | 88 |
| 93 #endif // CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ | 89 #endif // CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ |
| OLD | NEW |