1 // Copyright 2014 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 COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_
6 #define COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "components/session_manager/session_manager_export.h"
11 namespace session_manager
{
13 class SessionManagerDelegate
;
15 // TODO(nkostylev): Get rid/consolidate with:
16 // ash::SessionStateDelegate::SessionState and chromeos::LoggedInState.
17 enum SESSION_EXPORT SessionState
{
18 // Default value, when session state hasn't been initialized yet.
19 SESSION_STATE_UNKNOWN
= 0,
21 // Running out of box UI.
24 // Running login UI (primary user) but user sign in hasn't completed yet.
25 SESSION_STATE_LOGIN_PRIMARY
,
27 // Running login UI (primary or secondary user), user sign in has been
28 // completed but login UI hasn't been hidden yet. This means that either
29 // some session initialization is happening or user has to go through some
30 // UI flow on the same login UI like select avatar, agree to terms of
32 SESSION_STATE_LOGGED_IN_NOT_ACTIVE
,
34 // A user(s) has logged in *and* login UI is hidden i.e. user session is
38 // Same as SESSION_STATE_LOGIN_PRIMARY but for multi-profiles sign in i.e.
39 // when there's at least one user already active in the session.
40 SESSION_STATE_LOGIN_SECONDARY
,
43 class SESSION_EXPORT SessionManager
{
46 virtual ~SessionManager();
48 SessionState
session_state() const { return session_state_
; }
49 virtual void SetSessionState(SessionState state
);
51 // Let session delegate executed on its plan of actions depending on the
52 // current session type / state.
56 // Initializes SessionManager with delegate.
57 void Initialize(SessionManagerDelegate
* delegate
);
60 SessionState session_state_
;
61 scoped_ptr
<SessionManagerDelegate
> delegate_
;
63 DISALLOW_COPY_AND_ASSIGN(SessionManager
);
66 class SESSION_EXPORT SessionManagerDelegate
{
68 SessionManagerDelegate();
69 virtual ~SessionManagerDelegate();
71 virtual void SetSessionManager(
72 session_manager::SessionManager
* session_manager
);
74 // Executes specific actions defined by this delegate.
75 virtual void Start() = 0;
78 session_manager::SessionManager
* session_manager_
;
81 DISALLOW_COPY_AND_ASSIGN(SessionManagerDelegate
);
84 } // namespace session_manager
86 #endif // COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_