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

Side by Side 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 & add SessionStateDelegateChromeos Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/chromeos/login/user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/user_manager_impl.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <set> 8 #include <set>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 362
363 DCHECK(active_user_); 363 DCHECK(active_user_);
364 active_user_->set_is_active(false); 364 active_user_->set_is_active(false);
365 user->set_is_active(true); 365 user->set_is_active(true);
366 active_user_ = user; 366 active_user_ = user;
367 367
368 // Move the user to the front. 368 // Move the user to the front.
369 SetLRUUser(active_user_); 369 SetLRUUser(active_user_);
370 370
371 NotifyActiveUserHashChanged(active_user_->username_hash()); 371 NotifyActiveUserHashChanged(active_user_->username_hash());
372 372 NotifyActiveUserChanged(active_user_);
373 // TODO(nkostylev): Notify session_manager on active user change.
374 // http://crbug.com/230857
375 content::NotificationService::current()->Notify(
376 chrome::NOTIFICATION_ACTIVE_USER_CHANGED,
377 content::Source<UserManager>(this),
378 content::Details<const User>(active_user_));
379 } 373 }
380 374
381 void UserManagerImpl::RestoreActiveSessions() { 375 void UserManagerImpl::RestoreActiveSessions() {
382 DBusThreadManager::Get()->GetSessionManagerClient()->RetrieveActiveSessions( 376 DBusThreadManager::Get()->GetSessionManagerClient()->RetrieveActiveSessions(
383 base::Bind(&UserManagerImpl::OnRestoreActiveSessions, 377 base::Bind(&UserManagerImpl::OnRestoreActiveSessions,
384 base::Unretained(this))); 378 base::Unretained(this)));
385 } 379 }
386 380
387 void UserManagerImpl::SessionStarted() { 381 void UserManagerImpl::SessionStarted() {
388 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 382 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 user_image_manager_->UserLoggedIn(UserManager::kRetailModeUserName, 1241 user_image_manager_->UserLoggedIn(UserManager::kRetailModeUserName,
1248 is_current_user_new_, 1242 is_current_user_new_,
1249 true); 1243 true);
1250 WallpaperManager::Get()->SetInitialUserWallpaper( 1244 WallpaperManager::Get()->SetInitialUserWallpaper(
1251 UserManager::kRetailModeUserName, false); 1245 UserManager::kRetailModeUserName, false);
1252 } 1246 }
1253 1247
1254 void UserManagerImpl::NotifyOnLogin() { 1248 void UserManagerImpl::NotifyOnLogin() {
1255 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1249 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1256 NotifyActiveUserHashChanged(active_user_->username_hash()); 1250 NotifyActiveUserHashChanged(active_user_->username_hash());
1251 NotifyActiveUserChanged(active_user_);
1257 1252
1258 UpdateLoginState(); 1253 UpdateLoginState();
1254 // TODO(nkostylev): Deprecate this notification in favor of
1255 // ActiveUserChanged() observer call.
1259 content::NotificationService::current()->Notify( 1256 content::NotificationService::current()->Notify(
1260 chrome::NOTIFICATION_LOGIN_USER_CHANGED, 1257 chrome::NOTIFICATION_LOGIN_USER_CHANGED,
1261 content::Source<UserManager>(this), 1258 content::Source<UserManager>(this),
1262 content::Details<const User>(active_user_)); 1259 content::Details<const User>(active_user_));
1263 1260
1264 // Indicate to DeviceSettingsService that the owner key may have become 1261 // Indicate to DeviceSettingsService that the owner key may have become
1265 // available. 1262 // available.
1266 DeviceSettingsService::Get()->SetUsername(active_user_->email()); 1263 DeviceSettingsService::Get()->SetUsername(active_user_->email());
1267 } 1264 }
1268 1265
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 content::Source<UserManager>(this), 1594 content::Source<UserManager>(this),
1598 content::NotificationService::NoDetails()); 1595 content::NotificationService::NoDetails());
1599 } 1596 }
1600 1597
1601 void UserManagerImpl::NotifyMergeSessionStateChanged() { 1598 void UserManagerImpl::NotifyMergeSessionStateChanged() {
1602 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1599 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1603 FOR_EACH_OBSERVER(UserManager::Observer, observer_list_, 1600 FOR_EACH_OBSERVER(UserManager::Observer, observer_list_,
1604 MergeSessionStateChanged(merge_session_state_)); 1601 MergeSessionStateChanged(merge_session_state_));
1605 } 1602 }
1606 1603
1604 void UserManagerImpl::NotifyActiveUserChanged(const User* active_user) {
1605 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1606 FOR_EACH_OBSERVER(UserManager::UserSessionStateObserver,
1607 session_state_observer_list_,
1608 ActiveUserChanged(active_user));
1609 }
1610
1607 void UserManagerImpl::NotifyActiveUserHashChanged(const std::string& hash) { 1611 void UserManagerImpl::NotifyActiveUserHashChanged(const std::string& hash) {
1608 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1612 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1609 FOR_EACH_OBSERVER(UserManager::UserSessionStateObserver, 1613 FOR_EACH_OBSERVER(UserManager::UserSessionStateObserver,
1610 session_state_observer_list_, 1614 session_state_observer_list_,
1611 ActiveUserHashChanged(hash)); 1615 ActiveUserHashChanged(hash));
1612 } 1616 }
1613 1617
1614 void UserManagerImpl::NotifyPendingUserSessionsRestoreFinished() { 1618 void UserManagerImpl::NotifyPendingUserSessionsRestoreFinished() {
1615 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1619 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1616 user_sessions_restored_ = true; 1620 user_sessions_restored_ = true;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 false, // using_oauth 1723 false, // using_oauth
1720 false, // has_cookies 1724 false, // has_cookies
1721 true, // has_active_session 1725 true, // has_active_session
1722 this); 1726 this);
1723 } else { 1727 } else {
1724 RestorePendingUserSessions(); 1728 RestorePendingUserSessions();
1725 } 1729 }
1726 } 1730 }
1727 1731
1728 } // namespace chromeos 1732 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager_impl.h ('k') | chrome/browser/chromeos/profiles/profile_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698