| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/session_manager/core/session_manager.h" | 5 #include "components/session_manager/core/session_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 namespace session_manager { | 10 namespace session_manager { |
| 11 | 11 |
| 12 // static | 12 // static |
| 13 SessionManager* SessionManager::instance = NULL; | 13 SessionManager* SessionManager::instance = NULL; |
| 14 | 14 |
| 15 SessionManager::SessionManager() : session_state_(SESSION_STATE_UNKNOWN) { | 15 SessionManager::SessionManager() : session_state_(SessionState::UNKNOWN) { |
| 16 DCHECK(!SessionManager::Get()); | 16 DCHECK(!SessionManager::Get()); |
| 17 SessionManager::SetInstance(this); | 17 SessionManager::SetInstance(this); |
| 18 } | 18 } |
| 19 | 19 |
| 20 SessionManager::~SessionManager() { | 20 SessionManager::~SessionManager() { |
| 21 DCHECK(instance == this); | 21 DCHECK(instance == this); |
| 22 SessionManager::SetInstance(NULL); | 22 SessionManager::SetInstance(NULL); |
| 23 } | 23 } |
| 24 | 24 |
| 25 // static | 25 // static |
| 26 SessionManager* SessionManager::Get() { | 26 SessionManager* SessionManager::Get() { |
| 27 return SessionManager::instance; | 27 return SessionManager::instance; |
| 28 } | 28 } |
| 29 | 29 |
| 30 void SessionManager::SetSessionState(SessionState state) { | 30 void SessionManager::SetSessionState(SessionState state) { |
| 31 VLOG(1) << "Changing session state to: " << state; | 31 VLOG(1) << "Changing session state to: " << static_cast<int>(state); |
| 32 | 32 |
| 33 if (session_state_ != state) { | 33 if (session_state_ != state) { |
| 34 // TODO(nkostylev): Notify observers about the state change. | 34 // TODO(nkostylev): Notify observers about the state change. |
| 35 // TODO(nkostylev): Add code to process session state change and probably | 35 // TODO(nkostylev): Add code to process session state change and probably |
| 36 // replace delegate_ if needed. | 36 // replace delegate_ if needed. |
| 37 session_state_ = state; | 37 session_state_ = state; |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 void SessionManager::Initialize(SessionManagerDelegate* delegate) { | 41 void SessionManager::Initialize(SessionManagerDelegate* delegate) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 58 | 58 |
| 59 SessionManagerDelegate::~SessionManagerDelegate() { | 59 SessionManagerDelegate::~SessionManagerDelegate() { |
| 60 } | 60 } |
| 61 | 61 |
| 62 void SessionManagerDelegate::SetSessionManager( | 62 void SessionManagerDelegate::SetSessionManager( |
| 63 session_manager::SessionManager* session_manager) { | 63 session_manager::SessionManager* session_manager) { |
| 64 session_manager_ = session_manager; | 64 session_manager_ = session_manager; |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace session_manager | 67 } // namespace session_manager |
| OLD | NEW |