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/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
9 #include "base/compiler_specific.h" | |
10 #include "base/macros.h" | 9 #include "base/macros.h" |
11 #include "base/observer_list.h" | |
12 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | |
13 #include "chromeos/login/login_state.h" | |
14 #include "components/user_manager/user_manager.h" | |
15 | 10 |
16 namespace ash { | 11 class SessionStateDelegateChromeos : public ash::SessionStateDelegate { |
17 class SessionStateObserver; | |
18 } // namespace ash | |
19 | |
20 class SessionStateDelegateChromeos | |
21 : public ash::SessionStateDelegate, | |
22 public chromeos::LoginState::Observer, | |
23 public user_manager::UserManager::UserSessionStateObserver, | |
24 public chromeos::UserAddingScreen::Observer { | |
25 public: | 12 public: |
26 SessionStateDelegateChromeos(); | 13 SessionStateDelegateChromeos(); |
27 ~SessionStateDelegateChromeos() override; | 14 ~SessionStateDelegateChromeos() override; |
28 | 15 |
29 // ash::SessionStateDelegate: | 16 // ash::SessionStateDelegate: |
30 int GetMaximumNumberOfLoggedInUsers() const override; | |
31 int NumberOfLoggedInUsers() const override; | |
32 ash::AddUserSessionPolicy GetAddUserSessionPolicy() const override; | |
33 bool IsActiveUserSessionStarted() const override; | |
34 bool CanLockScreen() const override; | |
35 bool IsScreenLocked() const override; | |
36 bool ShouldLockScreenAutomatically() const override; | |
37 void LockScreen() override; | |
38 void UnlockScreen() override; | |
39 bool IsUserSessionBlocked() const override; | |
40 session_manager::SessionState GetSessionState() const override; | |
41 const user_manager::UserInfo* GetUserInfo( | |
42 ash::UserIndex index) const override; | |
43 bool ShouldShowAvatar(ash::WmWindow* window) const override; | 17 bool ShouldShowAvatar(ash::WmWindow* window) const override; |
44 gfx::ImageSkia GetAvatarImageForWindow(ash::WmWindow* window) const override; | 18 gfx::ImageSkia GetAvatarImageForWindow(ash::WmWindow* window) const override; |
45 void SwitchActiveUser(const AccountId& account_id) override; | |
46 void CycleActiveUser(ash::CycleUserDirection direction) override; | |
47 bool IsMultiProfileAllowedByPrimaryUserPolicy() const override; | |
48 void AddSessionStateObserver(ash::SessionStateObserver* observer) override; | |
49 void RemoveSessionStateObserver(ash::SessionStateObserver* observer) override; | |
50 | |
51 // chromeos::LoginState::Observer overrides. | |
52 void LoggedInStateChanged() override; | |
53 | |
54 // user_manager::UserManager::UserSessionStateObserver: | |
55 void ActiveUserChanged(const user_manager::User* active_user) override; | |
56 void UserAddedToSession(const user_manager::User* added_user) override; | |
57 | |
58 // chromeos::UserAddingScreen::Observer: | |
59 void OnUserAddingStarted() override; | |
60 void OnUserAddingFinished() override; | |
61 | 19 |
62 private: | 20 private: |
63 // Sets session state to |new_state|. | |
64 // If |force| is true then |new_state| is set even if existing session | |
65 // state is the same (used for explicit initialization). | |
66 void SetSessionState(session_manager::SessionState new_state, bool force); | |
67 | |
68 // Notify observers about session state change. | |
69 void NotifySessionStateChanged(); | |
70 | |
71 // Switches to a new user. This call might show a dialog asking the user if | |
72 // they want to stop desktop casting before switching. | |
73 void TryToSwitchUser(const AccountId& account_id); | |
74 | |
75 // List of observers is only used on Chrome OS for now. | |
76 base::ObserverList<ash::SessionStateObserver> session_state_observer_list_; | |
77 | |
78 // Session state (e.g. login screen vs. user session). | |
79 session_manager::SessionState session_state_; | |
80 | |
81 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateChromeos); | 21 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateChromeos); |
82 }; | 22 }; |
83 | 23 |
84 #endif // CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ | 24 #endif // CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ |
OLD | NEW |