| 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/user_manager/user_manager.h" | 5 #include "components/user_manager/user_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "components/signin/core/account_id/account_id.h" | 8 #include "components/signin/core/account_id/account_id.h" |
| 9 | 9 |
| 10 namespace user_manager { | 10 namespace user_manager { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 return UserManager::instance; | 85 return UserManager::instance; |
| 86 } | 86 } |
| 87 | 87 |
| 88 // static | 88 // static |
| 89 UserManager* UserManager::SetForTesting(UserManager* user_manager) { | 89 UserManager* UserManager::SetForTesting(UserManager* user_manager) { |
| 90 UserManager* previous_instance = UserManager::instance; | 90 UserManager* previous_instance = UserManager::instance; |
| 91 UserManager::instance = user_manager; | 91 UserManager::instance = user_manager; |
| 92 return previous_instance; | 92 return previous_instance; |
| 93 } | 93 } |
| 94 | 94 |
| 95 ScopedUserSessionStateObserver::ScopedUserSessionStateObserver( |
| 96 UserManager::UserSessionStateObserver* observer) |
| 97 : observer_(observer) { |
| 98 if (UserManager::IsInitialized()) |
| 99 UserManager::Get()->AddSessionStateObserver(observer_); |
| 100 } |
| 101 |
| 102 ScopedUserSessionStateObserver::~ScopedUserSessionStateObserver() { |
| 103 if (UserManager::IsInitialized()) |
| 104 UserManager::Get()->RemoveSessionStateObserver(observer_); |
| 105 } |
| 106 |
| 95 } // namespace user_manager | 107 } // namespace user_manager |
| OLD | NEW |