| 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/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/session/session_state_observer.h" | 8 #include "ash/common/session/session_state_observer.h" |
| 9 #include "ash/content/shell_content_state.h" | 9 #include "ash/content/shell_content_state.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 14 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 15 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 15 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 16 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 16 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 20 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 21 #include "chrome/browser/ui/ash/multi_user/user_switch_util.h" | 21 #include "chrome/browser/ui/ash/multi_user/user_switch_util.h" |
| 22 #include "chrome/browser/ui/ash/session_util.h" | 22 #include "chrome/browser/ui/ash/session_util.h" |
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "chromeos/chromeos_switches.h" | 24 #include "chromeos/chromeos_switches.h" |
| 25 #include "chromeos/dbus/dbus_thread_manager.h" | 25 #include "chromeos/dbus/dbus_thread_manager.h" |
| 26 #include "chromeos/dbus/session_manager_client.h" | 26 #include "chromeos/dbus/session_manager_client.h" |
| 27 #include "chromeos/login/login_state.h" | 27 #include "chromeos/login/login_state.h" |
| 28 #include "components/prefs/pref_service.h" | 28 #include "components/prefs/pref_service.h" |
| 29 #include "components/session_manager/core/session_manager.h" |
| 29 #include "components/signin/core/account_id/account_id.h" | 30 #include "components/signin/core/account_id/account_id.h" |
| 30 #include "components/user_manager/user.h" | 31 #include "components/user_manager/user.h" |
| 31 #include "components/user_manager/user_info.h" | 32 #include "components/user_manager/user_info.h" |
| 32 #include "components/user_manager/user_manager.h" | 33 #include "components/user_manager/user_manager.h" |
| 33 #include "google_apis/gaia/gaia_auth_util.h" | 34 #include "google_apis/gaia/gaia_auth_util.h" |
| 34 #include "ui/gfx/image/image_skia.h" | 35 #include "ui/gfx/image/image_skia.h" |
| 35 | 36 |
| 36 SessionStateDelegateChromeos::SessionStateDelegateChromeos() | 37 SessionStateDelegateChromeos::SessionStateDelegateChromeos() |
| 37 : session_state_(session_manager::SessionState::LOGIN_PRIMARY) { | 38 : session_state_(session_manager::SessionState::LOGIN_PRIMARY) { |
| 38 user_manager::UserManager::Get()->AddSessionStateObserver(this); | 39 user_manager::UserManager::Get()->AddSessionStateObserver(this); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ->GetUsersAllowedForMultiProfile() | 83 ->GetUsersAllowedForMultiProfile() |
| 83 .size() == 0) { | 84 .size() == 0) { |
| 84 if (error) | 85 if (error) |
| 85 *error = ADD_USER_ERROR_OUT_OF_USERS; | 86 *error = ADD_USER_ERROR_OUT_OF_USERS; |
| 86 return false; | 87 return false; |
| 87 } | 88 } |
| 88 return SessionStateDelegate::CanAddUserToMultiProfile(error); | 89 return SessionStateDelegate::CanAddUserToMultiProfile(error); |
| 89 } | 90 } |
| 90 | 91 |
| 91 bool SessionStateDelegateChromeos::IsActiveUserSessionStarted() const { | 92 bool SessionStateDelegateChromeos::IsActiveUserSessionStarted() const { |
| 92 return user_manager::UserManager::Get()->IsSessionStarted(); | 93 return session_manager::SessionManager::Get() && |
| 94 session_manager::SessionManager::Get()->IsSessionStarted(); |
| 93 } | 95 } |
| 94 | 96 |
| 95 bool SessionStateDelegateChromeos::CanLockScreen() const { | 97 bool SessionStateDelegateChromeos::CanLockScreen() const { |
| 96 const user_manager::UserList unlock_users = | 98 const user_manager::UserList unlock_users = |
| 97 user_manager::UserManager::Get()->GetUnlockUsers(); | 99 user_manager::UserManager::Get()->GetUnlockUsers(); |
| 98 return !unlock_users.empty(); | 100 return !unlock_users.empty(); |
| 99 } | 101 } |
| 100 | 102 |
| 101 bool SessionStateDelegateChromeos::IsScreenLocked() const { | 103 bool SessionStateDelegateChromeos::IsScreenLocked() const { |
| 102 return chromeos::ScreenLocker::default_screen_locker() && | 104 return chromeos::ScreenLocker::default_screen_locker() && |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } | 283 } |
| 282 | 284 |
| 283 void DoSwitchUser(const AccountId& account_id) { | 285 void DoSwitchUser(const AccountId& account_id) { |
| 284 user_manager::UserManager::Get()->SwitchActiveUser(account_id); | 286 user_manager::UserManager::Get()->SwitchActiveUser(account_id); |
| 285 } | 287 } |
| 286 | 288 |
| 287 void SessionStateDelegateChromeos::TryToSwitchUser( | 289 void SessionStateDelegateChromeos::TryToSwitchUser( |
| 288 const AccountId& account_id) { | 290 const AccountId& account_id) { |
| 289 TrySwitchingActiveUser(base::Bind(&DoSwitchUser, account_id)); | 291 TrySwitchingActiveUser(base::Bind(&DoSwitchUser, account_id)); |
| 290 } | 292 } |
| OLD | NEW |