Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / ash / session_state_delegate_chromeos.h
blob1a8d00305250d6530d92bfee8b8c67e26ee2ac3d
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_
6 #define CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_
8 #include "ash/session/session_state_delegate.h"
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.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"
16 namespace ash {
17 class SessionStateObserver;
18 } // namespace ash
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:
26 SessionStateDelegateChromeos();
27 ~SessionStateDelegateChromeos() override;
29 // ash::SessionStateDelegate:
30 content::BrowserContext* GetBrowserContextByIndex(
31 ash::MultiProfileIndex index) override;
32 content::BrowserContext* GetBrowserContextForWindow(
33 aura::Window* window) override;
34 content::BrowserContext* GetUserPresentingBrowserContextForWindow(
35 aura::Window* window) override;
36 int GetMaximumNumberOfLoggedInUsers() const override;
37 int NumberOfLoggedInUsers() const override;
38 bool CanAddUserToMultiProfile(AddUserError* error) const override;
39 bool IsActiveUserSessionStarted() const override;
40 bool CanLockScreen() const override;
41 bool IsScreenLocked() const override;
42 bool ShouldLockScreenBeforeSuspending() const override;
43 void LockScreen() override;
44 void UnlockScreen() override;
45 bool IsUserSessionBlocked() const override;
46 SessionState GetSessionState() const override;
47 const user_manager::UserInfo* GetUserInfo(
48 ash::MultiProfileIndex index) const override;
49 const user_manager::UserInfo* GetUserInfo(
50 content::BrowserContext* context) const override;
51 bool ShouldShowAvatar(aura::Window* window) const override;
52 void SwitchActiveUser(const std::string& user_id) override;
53 void CycleActiveUser(CycleUser cycle_user) override;
54 bool IsMultiProfileAllowedByPrimaryUserPolicy() const override;
55 void AddSessionStateObserver(ash::SessionStateObserver* observer) override;
56 void RemoveSessionStateObserver(ash::SessionStateObserver* observer) override;
58 // chromeos::LoginState::Observer overrides.
59 void LoggedInStateChanged() override;
61 // user_manager::UserManager::UserSessionStateObserver:
62 void ActiveUserChanged(const user_manager::User* active_user) override;
63 void UserAddedToSession(const user_manager::User* added_user) override;
65 // chromeos::UserAddingScreen::Observer:
66 void OnUserAddingStarted() override;
67 void OnUserAddingFinished() override;
69 private:
70 // Sets session state to |new_state|.
71 // If |force| is true then |new_state| is set even if existing session
72 // state is the same (used for explicit initialization).
73 void SetSessionState(SessionState new_state, bool force);
75 // Notify observers about session state change.
76 void NotifySessionStateChanged();
78 // Switches to a new user. This call might show a dialog asking the user if he
79 // wants to stop desktop casting before switching.
80 void TryToSwitchUser(const std::string& user_id);
82 // List of observers is only used on Chrome OS for now.
83 base::ObserverList<ash::SessionStateObserver> session_state_observer_list_;
85 // Session state (e.g. login screen vs. user session).
86 SessionState session_state_;
88 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateChromeos);
91 #endif // CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_