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

Side by Side Diff: chrome/browser/ui/ash/session_state_delegate_chromeos.cc

Issue 15718003: Add SessionStateObserver with ActiveUserChanged() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: close button when switching users, notify observers with ActiveUserChanged() when new user logs in 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/ui/ash/session_state_delegate.h" 5 #include "chrome/browser/ui/ash/session_state_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/chromeos/login/screen_locker.h" 8 #include "chrome/browser/chromeos/login/screen_locker.h"
9 #include "chrome/browser/chromeos/login/user.h"
9 #include "chrome/browser/chromeos/login/user_manager.h" 10 #include "chrome/browser/chromeos/login/user_manager.h"
10 #include "chromeos/dbus/dbus_thread_manager.h" 11 #include "chromeos/dbus/dbus_thread_manager.h"
11 #include "chromeos/dbus/session_manager_client.h" 12 #include "chromeos/dbus/session_manager_client.h"
12 13
13 SessionStateDelegate::SessionStateDelegate() { 14 SessionStateDelegate::SessionStateDelegate() {
15 chromeos::UserManager::Get()->AddSessionStateObserver(this);
14 } 16 }
15 17
16 SessionStateDelegate::~SessionStateDelegate() { 18 SessionStateDelegate::~SessionStateDelegate() {
17 } 19 }
18 20
19 int SessionStateDelegate::GetMaximumNumberOfLoggedInUsers() const { 21 int SessionStateDelegate::GetMaximumNumberOfLoggedInUsers() const {
20 return 3; 22 return 3;
21 } 23 }
22 24
23 int SessionStateDelegate::NumberOfLoggedInUsers() const { 25 int SessionStateDelegate::NumberOfLoggedInUsers() const {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 for (chromeos::UserList::const_iterator it = logged_in_users.begin(); 81 for (chromeos::UserList::const_iterator it = logged_in_users.begin();
80 it != logged_in_users.end(); ++it) { 82 it != logged_in_users.end(); ++it) {
81 const chromeos::User* user = (*it); 83 const chromeos::User* user = (*it);
82 users->push_back(user->email()); 84 users->push_back(user->email());
83 } 85 }
84 } 86 }
85 87
86 void SessionStateDelegate::SwitchActiveUser(const std::string& email) { 88 void SessionStateDelegate::SwitchActiveUser(const std::string& email) {
87 chromeos::UserManager::Get()->SwitchActiveUser(email); 89 chromeos::UserManager::Get()->SwitchActiveUser(email);
88 } 90 }
91
92 void SessionStateDelegate::AddSessionStateObserver(
93 ash::SessionStateObserver* observer) {
94 session_state_observer_list_.AddObserver(observer);
95 }
96
97 void SessionStateDelegate::RemoveSessionStateObserver(
98 ash::SessionStateObserver* observer) {
99 session_state_observer_list_.RemoveObserver(observer);
100 }
101
102 void SessionStateDelegate::ActiveUserChanged(
103 const chromeos::User* active_user) {
104 FOR_EACH_OBSERVER(ash::SessionStateObserver,
105 session_state_observer_list_,
bartfab (slow) 2013/06/03 09:00:06 Nit: Indent one space less.
Nikita (slow) 2013/06/03 09:21:28 Done.
106 ActiveUserChanged(active_user->email()));
107 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698