| 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 #ifndef COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ | 5 #ifndef COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ |
| 6 #define COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ | 6 #define COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "components/session_manager/session_manager_export.h" | 11 #include "components/session_manager/session_manager_export.h" |
| 11 | 12 |
| 12 namespace session_manager { | 13 namespace session_manager { |
| 13 | 14 |
| 14 class SessionManagerDelegate; | 15 class SessionManagerDelegate; |
| 15 | 16 |
| 16 // TODO(nkostylev): Get rid/consolidate with: | 17 // TODO(nkostylev): Get rid/consolidate with: |
| 17 // ash::SessionStateDelegate::SessionState and chromeos::LoggedInState. | 18 // ash::SessionStateDelegate::SessionState and chromeos::LoggedInState. |
| 18 enum SessionState { | 19 enum SessionState { |
| 19 // Default value, when session state hasn't been initialized yet. | 20 // Default value, when session state hasn't been initialized yet. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 // Pointer to the existing SessionManager instance (if any). | 69 // Pointer to the existing SessionManager instance (if any). |
| 69 // Set in ctor, reset in dtor. Not owned since specific implementation of | 70 // Set in ctor, reset in dtor. Not owned since specific implementation of |
| 70 // SessionManager should decide on its own appropriate owner of SessionManager | 71 // SessionManager should decide on its own appropriate owner of SessionManager |
| 71 // instance. For src/chrome implementation such place is | 72 // instance. For src/chrome implementation such place is |
| 72 // g_browser_process->platform_part(). | 73 // g_browser_process->platform_part(). |
| 73 static SessionManager* instance; | 74 static SessionManager* instance; |
| 74 | 75 |
| 75 SessionState session_state_; | 76 SessionState session_state_; |
| 76 scoped_ptr<SessionManagerDelegate> delegate_; | 77 std::unique_ptr<SessionManagerDelegate> delegate_; |
| 77 | 78 |
| 78 DISALLOW_COPY_AND_ASSIGN(SessionManager); | 79 DISALLOW_COPY_AND_ASSIGN(SessionManager); |
| 79 }; | 80 }; |
| 80 | 81 |
| 81 class SESSION_EXPORT SessionManagerDelegate { | 82 class SESSION_EXPORT SessionManagerDelegate { |
| 82 public: | 83 public: |
| 83 SessionManagerDelegate(); | 84 SessionManagerDelegate(); |
| 84 virtual ~SessionManagerDelegate(); | 85 virtual ~SessionManagerDelegate(); |
| 85 | 86 |
| 86 virtual void SetSessionManager( | 87 virtual void SetSessionManager( |
| 87 session_manager::SessionManager* session_manager); | 88 session_manager::SessionManager* session_manager); |
| 88 | 89 |
| 89 // Executes specific actions defined by this delegate. | 90 // Executes specific actions defined by this delegate. |
| 90 virtual void Start() = 0; | 91 virtual void Start() = 0; |
| 91 | 92 |
| 92 protected: | 93 protected: |
| 93 session_manager::SessionManager* session_manager_; | 94 session_manager::SessionManager* session_manager_; |
| 94 | 95 |
| 95 private: | 96 private: |
| 96 DISALLOW_COPY_AND_ASSIGN(SessionManagerDelegate); | 97 DISALLOW_COPY_AND_ASSIGN(SessionManagerDelegate); |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 } // namespace session_manager | 100 } // namespace session_manager |
| 100 | 101 |
| 101 #endif // COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ | 102 #endif // COMPONENTS_SESSION_MANAGER_CORE_SESSION_MANAGER_H_ |
| OLD | NEW |