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

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

Issue 363613004: [cros] Define session_manager component with SessionManager base class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review + fix build 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.cc
diff --git a/components/session_manager/core/session_manager.cc b/components/session_manager/core/session_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..001c5bd9688e7c898d6e97c7dd224de03e7924cb
--- /dev/null
+++ b/components/session_manager/core/session_manager.cc
@@ -0,0 +1,49 @@
+// 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.
+
+#include "components/session_manager/core/session_manager.h"
+
+#include "base/logging.h"
+
+namespace session_manager {
+
+SessionManager::SessionManager() : session_state_(SESSION_STATE_UNKNOWN) {
+}
+
+SessionManager::~SessionManager() {
+}
+
+void SessionManager::SetSessionState(SessionManager::SessionState state) {
+ VLOG(1) << "Changing session state to: " << state;
+
+ if (session_state_ != state) {
+ // TODO(nkostylev): Notify observers about the state change.
+ // TODO(nkostylev): Add code to process session state change and probably
+ // replace delegate_ if needed.
+ session_state_ = state;
+ }
+}
+
+void SessionManager::Initialize(SessionManagerDelegate* delegate) {
+ DCHECK(delegate);
+ delegate_.reset(delegate);
+ delegate_->SetSessionManager(this);
+}
+
+void SessionManager::Start() {
+ delegate_->Start();
+}
+
+SessionManagerDelegate::SessionManagerDelegate() : session_manager_(NULL) {
+}
+
+SessionManagerDelegate::~SessionManagerDelegate() {
+}
+
+void SessionManagerDelegate::SetSessionManager(
+ session_manager::SessionManager* session_manager) {
+ session_manager_ = session_manager;
+}
+
+} // namespace session_manager

Powered by Google App Engine
This is Rietveld 408576698