| OLD | NEW |
| 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_chromeos.h" | 5 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" |
| 6 | 6 |
| 7 #include "ash/multi_profile_uma.h" | 7 #include "ash/multi_profile_uma.h" |
| 8 #include "ash/session/session_state_observer.h" | 8 #include "ash/session/session_state_observer.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 12 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 13 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 13 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 14 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 14 #include "chrome/browser/chromeos/login/users/user_manager.h" | 15 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 15 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 16 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 19 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 19 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 20 #include "chromeos/chromeos_switches.h" | 21 #include "chromeos/chromeos_switches.h" |
| 21 #include "chromeos/dbus/dbus_thread_manager.h" | 22 #include "chromeos/dbus/dbus_thread_manager.h" |
| 22 #include "chromeos/dbus/session_manager_client.h" | 23 #include "chromeos/dbus/session_manager_client.h" |
| 23 #include "chromeos/login/login_state.h" | 24 #include "chromeos/login/login_state.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 if (it == logged_in_users.begin()) | 202 if (it == logged_in_users.begin()) |
| 202 it = logged_in_users.end(); | 203 it = logged_in_users.end(); |
| 203 user_id = (*(--it))->email(); | 204 user_id = (*(--it))->email(); |
| 204 break; | 205 break; |
| 205 } | 206 } |
| 206 | 207 |
| 207 // Switch using the transformed |user_id|. | 208 // Switch using the transformed |user_id|. |
| 208 chromeos::UserManager::Get()->SwitchActiveUser(user_id); | 209 chromeos::UserManager::Get()->SwitchActiveUser(user_id); |
| 209 } | 210 } |
| 210 | 211 |
| 212 bool SessionStateDelegateChromeos::IsMultiProfileAllowedByPrimaryUserPolicy() |
| 213 const { |
| 214 return chromeos::MultiProfileUserController::GetPrimaryUserPolicy() == |
| 215 chromeos::MultiProfileUserController::ALLOWED; |
| 216 } |
| 217 |
| 211 void SessionStateDelegateChromeos::AddSessionStateObserver( | 218 void SessionStateDelegateChromeos::AddSessionStateObserver( |
| 212 ash::SessionStateObserver* observer) { | 219 ash::SessionStateObserver* observer) { |
| 213 session_state_observer_list_.AddObserver(observer); | 220 session_state_observer_list_.AddObserver(observer); |
| 214 } | 221 } |
| 215 | 222 |
| 216 void SessionStateDelegateChromeos::RemoveSessionStateObserver( | 223 void SessionStateDelegateChromeos::RemoveSessionStateObserver( |
| 217 ash::SessionStateObserver* observer) { | 224 ash::SessionStateObserver* observer) { |
| 218 session_state_observer_list_.RemoveObserver(observer); | 225 session_state_observer_list_.RemoveObserver(observer); |
| 219 } | 226 } |
| 220 | 227 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 259 |
| 253 session_state_ = new_state; | 260 session_state_ = new_state; |
| 254 NotifySessionStateChanged(); | 261 NotifySessionStateChanged(); |
| 255 } | 262 } |
| 256 | 263 |
| 257 void SessionStateDelegateChromeos::NotifySessionStateChanged() { | 264 void SessionStateDelegateChromeos::NotifySessionStateChanged() { |
| 258 FOR_EACH_OBSERVER(ash::SessionStateObserver, | 265 FOR_EACH_OBSERVER(ash::SessionStateObserver, |
| 259 session_state_observer_list_, | 266 session_state_observer_list_, |
| 260 SessionStateChanged(session_state_)); | 267 SessionStateChanged(session_state_)); |
| 261 } | 268 } |
| OLD | NEW |