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_state_delegate.h" | 8 #include "ash/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/user_adding_screen.h" | |
12 #include "chrome/browser/chromeos/login/user_manager.h" | 13 #include "chrome/browser/chromeos/login/user_manager.h" |
14 #include "chromeos/login/login_state.h" | |
13 | 15 |
14 namespace ash { | 16 namespace ash { |
15 class SessionStateObserver; | 17 class SessionStateObserver; |
16 } // namespace ash | 18 } // namespace ash |
17 | 19 |
18 class SessionStateDelegateChromeos | 20 class SessionStateDelegateChromeos |
19 : public ash::SessionStateDelegate, | 21 : public ash::SessionStateDelegate, |
20 public chromeos::UserManager::UserSessionStateObserver { | 22 public chromeos::LoginState::Observer, |
23 public chromeos::UserManager::UserSessionStateObserver, | |
24 public chromeos::UserAddingScreen::Observer { | |
21 public: | 25 public: |
22 SessionStateDelegateChromeos(); | 26 SessionStateDelegateChromeos(); |
23 virtual ~SessionStateDelegateChromeos(); | 27 virtual ~SessionStateDelegateChromeos(); |
24 | 28 |
25 // ash::SessionStateDelegate: | 29 // ash::SessionStateDelegate: |
26 virtual content::BrowserContext* GetBrowserContextByIndex( | 30 virtual content::BrowserContext* GetBrowserContextByIndex( |
27 ash::MultiProfileIndex index) OVERRIDE; | 31 ash::MultiProfileIndex index) OVERRIDE; |
28 virtual content::BrowserContext* GetBrowserContextForWindow( | 32 virtual content::BrowserContext* GetBrowserContextForWindow( |
29 aura::Window* window) OVERRIDE; | 33 aura::Window* window) OVERRIDE; |
30 virtual int GetMaximumNumberOfLoggedInUsers() const OVERRIDE; | 34 virtual int GetMaximumNumberOfLoggedInUsers() const OVERRIDE; |
31 virtual int NumberOfLoggedInUsers() const OVERRIDE; | 35 virtual int NumberOfLoggedInUsers() const OVERRIDE; |
32 virtual bool IsActiveUserSessionStarted() const OVERRIDE; | 36 virtual bool IsActiveUserSessionStarted() const OVERRIDE; |
33 virtual bool CanLockScreen() const OVERRIDE; | 37 virtual bool CanLockScreen() const OVERRIDE; |
34 virtual bool IsScreenLocked() const OVERRIDE; | 38 virtual bool IsScreenLocked() const OVERRIDE; |
35 virtual bool ShouldLockScreenBeforeSuspending() const OVERRIDE; | 39 virtual bool ShouldLockScreenBeforeSuspending() const OVERRIDE; |
36 virtual void LockScreen() OVERRIDE; | 40 virtual void LockScreen() OVERRIDE; |
37 virtual void UnlockScreen() OVERRIDE; | 41 virtual void UnlockScreen() OVERRIDE; |
38 virtual bool IsUserSessionBlocked() const OVERRIDE; | 42 virtual bool IsUserSessionBlocked() const OVERRIDE; |
43 virtual SessionState GetSessionState() const OVERRIDE; | |
39 virtual const base::string16 GetUserDisplayName( | 44 virtual const base::string16 GetUserDisplayName( |
40 ash::MultiProfileIndex index) const OVERRIDE; | 45 ash::MultiProfileIndex index) const OVERRIDE; |
41 virtual const std::string GetUserEmail( | 46 virtual const std::string GetUserEmail( |
42 ash::MultiProfileIndex index) const OVERRIDE; | 47 ash::MultiProfileIndex index) const OVERRIDE; |
43 virtual const std::string GetUserID( | 48 virtual const std::string GetUserID( |
44 ash::MultiProfileIndex index) const OVERRIDE; | 49 ash::MultiProfileIndex index) const OVERRIDE; |
45 virtual const gfx::ImageSkia& GetUserImage( | 50 virtual const gfx::ImageSkia& GetUserImage( |
46 content::BrowserContext* context) const OVERRIDE; | 51 content::BrowserContext* context) const OVERRIDE; |
47 virtual bool ShouldShowAvatar(aura::Window* window) OVERRIDE; | 52 virtual bool ShouldShowAvatar(aura::Window* window) OVERRIDE; |
48 virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE; | 53 virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE; |
49 virtual void CycleActiveUser(CycleUser cycle_user) OVERRIDE; | 54 virtual void CycleActiveUser(CycleUser cycle_user) OVERRIDE; |
50 virtual void AddSessionStateObserver( | 55 virtual void AddSessionStateObserver( |
51 ash::SessionStateObserver* observer) OVERRIDE; | 56 ash::SessionStateObserver* observer) OVERRIDE; |
52 virtual void RemoveSessionStateObserver( | 57 virtual void RemoveSessionStateObserver( |
53 ash::SessionStateObserver* observer) OVERRIDE; | 58 ash::SessionStateObserver* observer) OVERRIDE; |
54 // UserManager::UserSessionStateObserver: | 59 |
60 // chromeos::LoginState::Observer overrides. | |
61 virtual void LoggedInStateChanged() OVERRIDE; | |
62 | |
63 // chromeos::UserManager::UserSessionStateObserver: | |
55 virtual void ActiveUserChanged(const chromeos::User* active_user) OVERRIDE; | 64 virtual void ActiveUserChanged(const chromeos::User* active_user) OVERRIDE; |
56 virtual void UserAddedToSession(const chromeos::User* added_user) OVERRIDE; | 65 virtual void UserAddedToSession(const chromeos::User* added_user) OVERRIDE; |
57 | 66 |
67 // chromeos::UserAddingScreen::Observer: | |
68 virtual void OnUserAddingStarted() OVERRIDE; | |
69 virtual void OnUserAddingFinished() OVERRIDE; | |
70 | |
58 private: | 71 private: |
72 // Sets session state to |new_state|. | |
73 // If |force| is true then |new_state| is set even if existing session | |
74 // state is the same (used for explicit initialization). | |
75 void SetSessionState(SessionState new_state, bool force); | |
76 | |
77 // Notify observers about session state change. | |
78 void NotifySessionStateChanged(); | |
79 | |
59 // List of observers is only used on Chrome OS for now. | 80 // List of observers is only used on Chrome OS for now. |
60 ObserverList<ash::SessionStateObserver> session_state_observer_list_; | 81 ObserverList<ash::SessionStateObserver> session_state_observer_list_; |
61 | 82 |
83 // Session state like at login or lock screen or inside session. | |
Daniel Erat
2014/04/11 14:43:41
this doesn't include the lock screen anymore, so i
Nikita (slow)
2014/04/14 08:53:16
Done.
| |
84 SessionState session_state_; | |
85 | |
86 // True if session state has been explicitly set. | |
Daniel Erat
2014/04/11 14:43:41
i don't think you need this now that SetSessionSta
Nikita (slow)
2014/04/14 08:53:16
Done.
| |
87 bool initialized_; | |
88 | |
62 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateChromeos); | 89 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateChromeos); |
63 }; | 90 }; |
64 | 91 |
65 #endif // CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ | 92 #endif // CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ |
OLD | NEW |