Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #ifndef COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ | |
| 6 #define COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "components/session_manager/session_manager_export.h" | |
| 10 | |
| 11 namespace session_manager { | |
| 12 | |
| 13 class SessionManagerDelegate; | |
| 14 | |
| 15 class SESSION_EXPORT SessionManager { | |
| 16 public: | |
| 17 // TODO(nkostylev): Get rid/consolidate with: | |
| 18 // ash::SessionStateDelegate::SessionState and chromeos::LoggedInState. | |
| 19 enum SessionState { | |
| 20 // Default value, when session state hasn't been initialized yet. | |
| 21 SESSION_STATE_UNKNOWN = 0, | |
|
oshima
2014/07/10 20:07:42
is it important to assign values explicitly?
Nikita (slow)
2014/07/14 16:30:11
Just to simplify debugging I guess.
oshima
2014/07/14 20:03:53
enum automatically initialize the next one with +1
Nikita (slow)
2014/07/15 10:18:42
Done.
| |
| 22 | |
| 23 // Running out of box UI. | |
| 24 SESSION_STATE_OOBE = 1, | |
| 25 | |
| 26 // Running login UI (primary user) but user sign in hasn't completed yet. | |
| 27 SESSION_STATE_LOGIN_PRIMARY = 2, | |
| 28 | |
| 29 // Running login UI (primary or secondary user), user sign in has been | |
| 30 // completed but login UI hasn't been hidden yet. This means that either | |
| 31 // some session initialization is happening or user has to go through some | |
| 32 // UI flow on the same login UI like select avatar, agree to terms of | |
| 33 // service etc. | |
| 34 SESSION_STATE_LOGGED_IN_NOT_ACTIVE = 3, | |
| 35 | |
| 36 // A user(s) has logged in *and* login UI is hidden i.e. user session is | |
| 37 // not blocked. | |
| 38 SESSION_STATE_ACTIVE = 4, | |
| 39 | |
| 40 // Same as SESSION_STATE_LOGIN_PRIMARY but for multi-profiles sign in i.e. | |
| 41 // when there's at least one user already active in the session. | |
| 42 SESSION_STATE_LOGIN_SECONDARY = 5, | |
| 43 }; | |
| 44 | |
| 45 SessionManager(); | |
| 46 virtual ~SessionManager(); | |
| 47 | |
| 48 SessionState session_state() { return session_state_; } | |
|
oshima
2014/07/10 20:07:42
const
Nikita (slow)
2014/07/14 16:30:11
Done.
| |
| 49 virtual void SetSessionState(SessionState state); | |
| 50 | |
| 51 // Let session delegate executed on its plan of actions depending on the | |
| 52 // current session type / state. | |
| 53 void Start(); | |
| 54 | |
| 55 protected: | |
| 56 // Initializes SessionManager with delegate. | |
| 57 void Initialize(SessionManagerDelegate* delegate); | |
| 58 | |
| 59 private: | |
| 60 SessionState session_state_; | |
| 61 scoped_ptr<SessionManagerDelegate> delegate_; | |
| 62 }; | |
|
oshima
2014/07/10 20:07:42
DISALLOW_COPY_AND_ASSIGN
Nikita (slow)
2014/07/14 16:30:11
Done.
| |
| 63 | |
| 64 class SESSION_EXPORT SessionManagerDelegate { | |
| 65 public: | |
| 66 SessionManagerDelegate(); | |
| 67 virtual ~SessionManagerDelegate(); | |
| 68 | |
| 69 virtual void SetSessionManager( | |
| 70 session_manager::SessionManager* session_manager); | |
| 71 | |
| 72 // Executes specific actions defined by this delegate. | |
| 73 virtual void Start() = 0; | |
| 74 | |
| 75 protected: | |
| 76 session_manager::SessionManager* session_manager_; | |
| 77 }; | |
|
oshima
2014/07/10 20:07:42
ditto
Nikita (slow)
2014/07/14 16:30:11
Done.
| |
| 78 | |
| 79 } // namespace session_manager | |
| 80 | |
| 81 #endif // COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ | |
| OLD | NEW |