| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 if (it == logged_in_users.begin()) | 201 if (it == logged_in_users.begin()) |
| 201 it = logged_in_users.end(); | 202 it = logged_in_users.end(); |
| 202 user_id = (*(--it))->email(); | 203 user_id = (*(--it))->email(); |
| 203 break; | 204 break; |
| 204 } | 205 } |
| 205 | 206 |
| 206 // Switch using the transformed |user_id|. | 207 // Switch using the transformed |user_id|. |
| 207 chromeos::UserManager::Get()->SwitchActiveUser(user_id); | 208 chromeos::UserManager::Get()->SwitchActiveUser(user_id); |
| 208 } | 209 } |
| 209 | 210 |
| 211 bool SessionStateDelegateChromeos::IsMultiProfileAllowedByPrimaryUserPolicy() |
| 212 const { |
| 213 return chromeos::MultiProfileUserController::GetPrimaryUserPolicy() == |
| 214 chromeos::MultiProfileUserController::ALLOWED; |
| 215 } |
| 216 |
| 210 void SessionStateDelegateChromeos::AddSessionStateObserver( | 217 void SessionStateDelegateChromeos::AddSessionStateObserver( |
| 211 ash::SessionStateObserver* observer) { | 218 ash::SessionStateObserver* observer) { |
| 212 session_state_observer_list_.AddObserver(observer); | 219 session_state_observer_list_.AddObserver(observer); |
| 213 } | 220 } |
| 214 | 221 |
| 215 void SessionStateDelegateChromeos::RemoveSessionStateObserver( | 222 void SessionStateDelegateChromeos::RemoveSessionStateObserver( |
| 216 ash::SessionStateObserver* observer) { | 223 ash::SessionStateObserver* observer) { |
| 217 session_state_observer_list_.RemoveObserver(observer); | 224 session_state_observer_list_.RemoveObserver(observer); |
| 218 } | 225 } |
| 219 | 226 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 258 |
| 252 session_state_ = new_state; | 259 session_state_ = new_state; |
| 253 NotifySessionStateChanged(); | 260 NotifySessionStateChanged(); |
| 254 } | 261 } |
| 255 | 262 |
| 256 void SessionStateDelegateChromeos::NotifySessionStateChanged() { | 263 void SessionStateDelegateChromeos::NotifySessionStateChanged() { |
| 257 FOR_EACH_OBSERVER(ash::SessionStateObserver, | 264 FOR_EACH_OBSERVER(ash::SessionStateObserver, |
| 258 session_state_observer_list_, | 265 session_state_observer_list_, |
| 259 SessionStateChanged(session_state_)); | 266 SessionStateChanged(session_state_)); |
| 260 } | 267 } |
| OLD | NEW |