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

Unified Diff: chrome/browser/chromeos/login/user_manager_impl.cc

Issue 15718003: Add SessionStateObserver with ActiveUserChanged() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge & reviews Created 7 years, 7 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: chrome/browser/chromeos/login/user_manager_impl.cc
diff --git a/chrome/browser/chromeos/login/user_manager_impl.cc b/chrome/browser/chromeos/login/user_manager_impl.cc
index 82b48dfdb05424351bd41f91a43430ad290de4d9..d5fd7d9413c71a046b0c49d6d3b6cb3213f586b9 100644
--- a/chrome/browser/chromeos/login/user_manager_impl.cc
+++ b/chrome/browser/chromeos/login/user_manager_impl.cc
@@ -369,13 +369,7 @@ void UserManagerImpl::SwitchActiveUser(const std::string& email) {
SetLRUUser(active_user_);
NotifyActiveUserHashChanged(active_user_->username_hash());
-
- // TODO(nkostylev): Notify session_manager on active user change.
- // http://crbug.com/230857
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_ACTIVE_USER_CHANGED,
- content::Source<UserManager>(this),
- content::Details<const User>(active_user_));
+ NotifyActiveUserChanged(active_user_);
}
void UserManagerImpl::RestoreActiveSessions() {
@@ -1254,8 +1248,11 @@ void UserManagerImpl::RetailModeUserLoggedIn() {
void UserManagerImpl::NotifyOnLogin() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
NotifyActiveUserHashChanged(active_user_->username_hash());
+ NotifyActiveUserChanged(active_user_);
UpdateLoginState();
+ // TODO(nkostylev): Deprecate this notification in favor of
+ // ActiveUserChanged() observer call.
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_LOGIN_USER_CHANGED,
content::Source<UserManager>(this),
@@ -1604,6 +1601,13 @@ void UserManagerImpl::NotifyMergeSessionStateChanged() {
MergeSessionStateChanged(merge_session_state_));
}
+void UserManagerImpl::NotifyActiveUserChanged(const User* active_user) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ FOR_EACH_OBSERVER(UserManager::UserSessionStateObserver,
+ session_state_observer_list_,
+ ActiveUserChanged(active_user));
+}
+
void UserManagerImpl::NotifyActiveUserHashChanged(const std::string& hash) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
FOR_EACH_OBSERVER(UserManager::UserSessionStateObserver,

Powered by Google App Engine
This is Rietveld 408576698