Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(684)

Unified Diff: components/session_manager/core/session_manager.h

Issue 363613004: [cros] Define session_manager component with SessionManager base class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/session_manager/core/session_manager.h
diff --git a/components/session_manager/core/session_manager.h b/components/session_manager/core/session_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..35b020b8f66f86f2d8f06bcfe3f2d2a16fa290f1
--- /dev/null
+++ b/components/session_manager/core/session_manager.h
@@ -0,0 +1,81 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_
+#define COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "components/session_manager/session_manager_export.h"
+
+namespace session_manager {
+
+class SessionManagerDelegate;
+
+class SESSION_EXPORT SessionManager {
+ public:
+ // TODO(nkostylev): Get rid/consolidate with:
+ // ash::SessionStateDelegate::SessionState and chromeos::LoggedInState.
+ enum SessionState {
+ // Default value, when session state hasn't been initialized yet.
+ 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.
+
+ // Running out of box UI.
+ SESSION_STATE_OOBE = 1,
+
+ // Running login UI (primary user) but user sign in hasn't completed yet.
+ SESSION_STATE_LOGIN_PRIMARY = 2,
+
+ // Running login UI (primary or secondary user), user sign in has been
+ // completed but login UI hasn't been hidden yet. This means that either
+ // some session initialization is happening or user has to go through some
+ // UI flow on the same login UI like select avatar, agree to terms of
+ // service etc.
+ SESSION_STATE_LOGGED_IN_NOT_ACTIVE = 3,
+
+ // A user(s) has logged in *and* login UI is hidden i.e. user session is
+ // not blocked.
+ SESSION_STATE_ACTIVE = 4,
+
+ // Same as SESSION_STATE_LOGIN_PRIMARY but for multi-profiles sign in i.e.
+ // when there's at least one user already active in the session.
+ SESSION_STATE_LOGIN_SECONDARY = 5,
+ };
+
+ SessionManager();
+ virtual ~SessionManager();
+
+ SessionState session_state() { return session_state_; }
oshima 2014/07/10 20:07:42 const
Nikita (slow) 2014/07/14 16:30:11 Done.
+ virtual void SetSessionState(SessionState state);
+
+ // Let session delegate executed on its plan of actions depending on the
+ // current session type / state.
+ void Start();
+
+ protected:
+ // Initializes SessionManager with delegate.
+ void Initialize(SessionManagerDelegate* delegate);
+
+ private:
+ SessionState session_state_;
+ scoped_ptr<SessionManagerDelegate> delegate_;
+};
oshima 2014/07/10 20:07:42 DISALLOW_COPY_AND_ASSIGN
Nikita (slow) 2014/07/14 16:30:11 Done.
+
+class SESSION_EXPORT SessionManagerDelegate {
+ public:
+ SessionManagerDelegate();
+ virtual ~SessionManagerDelegate();
+
+ virtual void SetSessionManager(
+ session_manager::SessionManager* session_manager);
+
+ // Executes specific actions defined by this delegate.
+ virtual void Start() = 0;
+
+ protected:
+ session_manager::SessionManager* session_manager_;
+};
oshima 2014/07/10 20:07:42 ditto
Nikita (slow) 2014/07/14 16:30:11 Done.
+
+} // namespace session_manager
+
+#endif // COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698