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

Unified Diff: components/user_manager/user_manager.cc

Issue 2661283002: cros: Clean up SessionStateDelegate refs in Chrome (Closed)
Patch Set: for #8 comments Created 3 years, 10 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/user_manager/user_manager.cc
diff --git a/components/user_manager/user_manager.cc b/components/user_manager/user_manager.cc
index 22b33c0ae9196aeecc602c0c2e660a0016f29a54..a4f4282594df560994bae6e73a7e0e8851ca5d67 100644
--- a/components/user_manager/user_manager.cc
+++ b/components/user_manager/user_manager.cc
@@ -92,4 +92,16 @@ UserManager* UserManager::SetForTesting(UserManager* user_manager) {
return previous_instance;
}
+ScopedUserSessionStateObserver::ScopedUserSessionStateObserver(
+ UserManager::UserSessionStateObserver* observer)
+ : observer_(observer) {
+ if (UserManager::IsInitialized())
+ UserManager::Get()->AddSessionStateObserver(observer_);
+}
+
+ScopedUserSessionStateObserver::~ScopedUserSessionStateObserver() {
+ if (UserManager::IsInitialized())
+ UserManager::Get()->RemoveSessionStateObserver(observer_);
+}
+
} // namespace user_manager

Powered by Google App Engine
This is Rietveld 408576698