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

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

Issue 417623002: user_manager component: Add UserManagerBase 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.cc
diff --git a/components/session_manager/core/session_manager.cc b/components/session_manager/core/session_manager.cc
index 3fff7484f57fdd17974f0f059866dda1be90a128..f7ee8dc7b813353ab426e5272d8198836748abda 100644
--- a/components/session_manager/core/session_manager.cc
+++ b/components/session_manager/core/session_manager.cc
@@ -6,12 +6,29 @@
#include "base/logging.h"
+#if defined(OS_CHROMEOS)
+#include "base/command_line.h"
+#include "base/sys_info.h"
+#include "chromeos/chromeos_switches.h"
+#endif
+
namespace session_manager {
+// static
+SessionManager* SessionManager::instance = NULL;
+
SessionManager::SessionManager() : session_state_(SESSION_STATE_UNKNOWN) {
+ DCHECK(!SessionManager::Get());
+ SessionManager::SetInstance(this);
}
SessionManager::~SessionManager() {
+ SessionManager::SetInstance(NULL);
+}
+
+// static
+SessionManager* SessionManager::Get() {
+ return SessionManager::instance;
}
void SessionManager::SetSessionState(SessionState state) {
@@ -31,10 +48,26 @@ void SessionManager::Initialize(SessionManagerDelegate* delegate) {
delegate_->SetSessionManager(this);
}
+// static
+void SessionManager::SetInstance(SessionManager* session_manager) {
+ SessionManager::instance = session_manager;
+}
+
void SessionManager::Start() {
delegate_->Start();
}
+// static
+bool SessionManager::HasBrowserRestarted() {
+#if defined(OS_CHROMEOS)
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ return base::SysInfo::IsRunningOnChromeOS() &&
+ command_line->HasSwitch(chromeos::switches::kLoginUser);
+#else
+ return false;
+#endif
+}
+
SessionManagerDelegate::SessionManagerDelegate() : session_manager_(NULL) {
}

Powered by Google App Engine
This is Rietveld 408576698