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/dbus/session_manager_client.h" |
| 15 #include "chromeos/login/login_state.h" |
| 16 #include "content/public/browser/notification_observer.h" |
| 17 #include "content/public/browser/notification_registrar.h" |
13 | 18 |
14 namespace ash { | 19 namespace ash { |
15 class SessionStateObserver; | 20 class SessionStateObserver; |
16 } // namespace ash | 21 } // namespace ash |
17 | 22 |
18 class SessionStateDelegateChromeos | 23 class SessionStateDelegateChromeos |
19 : public ash::SessionStateDelegate, | 24 : public ash::SessionStateDelegate, |
20 public chromeos::UserManager::UserSessionStateObserver { | 25 public chromeos::LoginState::Observer, |
| 26 public chromeos::SessionManagerClient::Observer, |
| 27 public chromeos::UserManager::UserSessionStateObserver, |
| 28 public chromeos::UserAddingScreen::Observer, |
| 29 public content::NotificationObserver { |
21 public: | 30 public: |
22 SessionStateDelegateChromeos(); | 31 SessionStateDelegateChromeos(); |
23 virtual ~SessionStateDelegateChromeos(); | 32 virtual ~SessionStateDelegateChromeos(); |
24 | 33 |
25 // ash::SessionStateDelegate: | 34 // ash::SessionStateDelegate: |
26 virtual content::BrowserContext* GetBrowserContextByIndex( | 35 virtual content::BrowserContext* GetBrowserContextByIndex( |
27 ash::MultiProfileIndex index) OVERRIDE; | 36 ash::MultiProfileIndex index) OVERRIDE; |
28 virtual content::BrowserContext* GetBrowserContextForWindow( | 37 virtual content::BrowserContext* GetBrowserContextForWindow( |
29 aura::Window* window) OVERRIDE; | 38 aura::Window* window) OVERRIDE; |
30 virtual int GetMaximumNumberOfLoggedInUsers() const OVERRIDE; | 39 virtual int GetMaximumNumberOfLoggedInUsers() const OVERRIDE; |
31 virtual int NumberOfLoggedInUsers() const OVERRIDE; | 40 virtual int NumberOfLoggedInUsers() const OVERRIDE; |
32 virtual bool IsActiveUserSessionStarted() const OVERRIDE; | 41 virtual bool IsActiveUserSessionStarted() const OVERRIDE; |
33 virtual bool CanLockScreen() const OVERRIDE; | 42 virtual bool CanLockScreen() const OVERRIDE; |
34 virtual bool IsScreenLocked() const OVERRIDE; | 43 virtual bool IsScreenLocked() const OVERRIDE; |
35 virtual bool ShouldLockScreenBeforeSuspending() const OVERRIDE; | 44 virtual bool ShouldLockScreenBeforeSuspending() const OVERRIDE; |
36 virtual void LockScreen() OVERRIDE; | 45 virtual void LockScreen() OVERRIDE; |
37 virtual void UnlockScreen() OVERRIDE; | 46 virtual void UnlockScreen() OVERRIDE; |
38 virtual bool IsUserSessionBlocked() const OVERRIDE; | 47 virtual bool IsUserSessionBlocked() const OVERRIDE; |
| 48 virtual SessionState GetSessionState() const OVERRIDE; |
39 virtual const base::string16 GetUserDisplayName( | 49 virtual const base::string16 GetUserDisplayName( |
40 ash::MultiProfileIndex index) const OVERRIDE; | 50 ash::MultiProfileIndex index) const OVERRIDE; |
41 virtual const std::string GetUserEmail( | 51 virtual const std::string GetUserEmail( |
42 ash::MultiProfileIndex index) const OVERRIDE; | 52 ash::MultiProfileIndex index) const OVERRIDE; |
43 virtual const std::string GetUserID( | 53 virtual const std::string GetUserID( |
44 ash::MultiProfileIndex index) const OVERRIDE; | 54 ash::MultiProfileIndex index) const OVERRIDE; |
45 virtual const gfx::ImageSkia& GetUserImage( | 55 virtual const gfx::ImageSkia& GetUserImage( |
46 content::BrowserContext* context) const OVERRIDE; | 56 content::BrowserContext* context) const OVERRIDE; |
47 virtual bool ShouldShowAvatar(aura::Window* window) OVERRIDE; | 57 virtual bool ShouldShowAvatar(aura::Window* window) OVERRIDE; |
48 virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE; | 58 virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE; |
49 virtual void CycleActiveUser(CycleUser cycle_user) OVERRIDE; | 59 virtual void CycleActiveUser(CycleUser cycle_user) OVERRIDE; |
50 virtual void AddSessionStateObserver( | 60 virtual void AddSessionStateObserver( |
51 ash::SessionStateObserver* observer) OVERRIDE; | 61 ash::SessionStateObserver* observer) OVERRIDE; |
52 virtual void RemoveSessionStateObserver( | 62 virtual void RemoveSessionStateObserver( |
53 ash::SessionStateObserver* observer) OVERRIDE; | 63 ash::SessionStateObserver* observer) OVERRIDE; |
54 // UserManager::UserSessionStateObserver: | 64 |
| 65 // chromeos::LoginState::Observer overrides. |
| 66 virtual void LoggedInStateChanged() OVERRIDE; |
| 67 |
| 68 // chromeos::SessionManagerClient::Observer: |
| 69 virtual void ScreenIsLocked() OVERRIDE; |
| 70 virtual void ScreenIsUnlocked() OVERRIDE; |
| 71 |
| 72 // chromeos::UserManager::UserSessionStateObserver: |
55 virtual void ActiveUserChanged(const chromeos::User* active_user) OVERRIDE; | 73 virtual void ActiveUserChanged(const chromeos::User* active_user) OVERRIDE; |
56 virtual void UserAddedToSession(const chromeos::User* added_user) OVERRIDE; | 74 virtual void UserAddedToSession(const chromeos::User* added_user) OVERRIDE; |
57 | 75 |
| 76 // chromeos::UserAddingScreen::Observer: |
| 77 virtual void OnUserAddingStarted() OVERRIDE; |
| 78 virtual void OnUserAddingFinished() OVERRIDE; |
| 79 |
| 80 // content::NotificationObserver: |
| 81 virtual void Observe(int type, |
| 82 const content::NotificationSource& source, |
| 83 const content::NotificationDetails& details) OVERRIDE; |
| 84 |
58 private: | 85 private: |
| 86 // Sets session state to |new_state|. |
| 87 void SetSessionState(SessionState new_state); |
| 88 |
| 89 // Notify observers about session state change. |
| 90 void NotifySessionStateChanged(); |
| 91 |
| 92 content::NotificationRegistrar notification_registrar_; |
| 93 |
59 // List of observers is only used on Chrome OS for now. | 94 // List of observers is only used on Chrome OS for now. |
60 ObserverList<ash::SessionStateObserver> session_state_observer_list_; | 95 ObserverList<ash::SessionStateObserver> session_state_observer_list_; |
61 | 96 |
| 97 // Session state like at login or lock screen or inside session. |
| 98 SessionState session_state_; |
| 99 |
62 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateChromeos); | 100 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateChromeos); |
63 }; | 101 }; |
64 | 102 |
65 #endif // CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ | 103 #endif // CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ |
OLD | NEW |