| 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/content/shell_content_state.h" | 8 #include "ash/content/shell_content_state.h" |
| 8 #include "ash/multi_profile_uma.h" | 9 #include "ash/multi_profile_uma.h" |
| 9 #include "ash/session/session_state_observer.h" | 10 #include "ash/session/session_state_observer.h" |
| 10 #include "ash/system/chromeos/multi_user/user_switch_util.h" | 11 #include "ash/system/chromeos/multi_user/user_switch_util.h" |
| 11 #include "base/bind.h" | 12 #include "base/bind.h" |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 16 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 16 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 17 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 return session_state_; | 139 return session_state_; |
| 139 } | 140 } |
| 140 | 141 |
| 141 const user_manager::UserInfo* SessionStateDelegateChromeos::GetUserInfo( | 142 const user_manager::UserInfo* SessionStateDelegateChromeos::GetUserInfo( |
| 142 ash::UserIndex index) const { | 143 ash::UserIndex index) const { |
| 143 DCHECK_LT(index, NumberOfLoggedInUsers()); | 144 DCHECK_LT(index, NumberOfLoggedInUsers()); |
| 144 return user_manager::UserManager::Get()->GetLRULoggedInUsers()[index]; | 145 return user_manager::UserManager::Get()->GetLRULoggedInUsers()[index]; |
| 145 } | 146 } |
| 146 | 147 |
| 147 bool SessionStateDelegateChromeos::ShouldShowAvatar( | 148 bool SessionStateDelegateChromeos::ShouldShowAvatar( |
| 148 aura::Window* window) const { | 149 ash::WmWindow* window) const { |
| 149 return chrome::MultiUserWindowManager::GetInstance()-> | 150 return chrome::MultiUserWindowManager::GetInstance()->ShouldShowAvatar( |
| 150 ShouldShowAvatar(window); | 151 ash::WmWindowAura::GetAuraWindow(window)); |
| 151 } | 152 } |
| 152 | 153 |
| 153 gfx::ImageSkia SessionStateDelegateChromeos::GetAvatarImageForWindow( | 154 gfx::ImageSkia SessionStateDelegateChromeos::GetAvatarImageForWindow( |
| 154 aura::Window* window) const { | 155 ash::WmWindow* window) const { |
| 155 content::BrowserContext* context = | 156 content::BrowserContext* context = |
| 156 ash::ShellContentState::GetInstance()->GetBrowserContextForWindow(window); | 157 ash::ShellContentState::GetInstance()->GetBrowserContextForWindow( |
| 158 ash::WmWindowAura::GetAuraWindow(window)); |
| 157 return GetAvatarImageForContext(context); | 159 return GetAvatarImageForContext(context); |
| 158 } | 160 } |
| 159 | 161 |
| 160 void SessionStateDelegateChromeos::SwitchActiveUser( | 162 void SessionStateDelegateChromeos::SwitchActiveUser( |
| 161 const AccountId& account_id) { | 163 const AccountId& account_id) { |
| 162 // Disallow switching to an already active user since that might crash. | 164 // Disallow switching to an already active user since that might crash. |
| 163 // Also check that we got a user id and not an email address. | 165 // Also check that we got a user id and not an email address. |
| 164 DCHECK_EQ( | 166 DCHECK_EQ( |
| 165 account_id.GetUserEmail(), | 167 account_id.GetUserEmail(), |
| 166 gaia::CanonicalizeEmail(gaia::SanitizeEmail(account_id.GetUserEmail()))); | 168 gaia::CanonicalizeEmail(gaia::SanitizeEmail(account_id.GetUserEmail()))); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 272 } |
| 271 | 273 |
| 272 void DoSwitchUser(const AccountId& account_id) { | 274 void DoSwitchUser(const AccountId& account_id) { |
| 273 user_manager::UserManager::Get()->SwitchActiveUser(account_id); | 275 user_manager::UserManager::Get()->SwitchActiveUser(account_id); |
| 274 } | 276 } |
| 275 | 277 |
| 276 void SessionStateDelegateChromeos::TryToSwitchUser( | 278 void SessionStateDelegateChromeos::TryToSwitchUser( |
| 277 const AccountId& account_id) { | 279 const AccountId& account_id) { |
| 278 ash::TrySwitchingActiveUser(base::Bind(&DoSwitchUser, account_id)); | 280 ash::TrySwitchingActiveUser(base::Bind(&DoSwitchUser, account_id)); |
| 279 } | 281 } |
| OLD | NEW |