| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_controller_client.h" | 5 #include "chrome/browser/ui/ash/session_controller_client.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/public/cpp/session_types.h" | 10 #include "ash/public/cpp/session_types.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 VLOG(1) << "Requesting screen lock from SessionControllerClient"; | 184 VLOG(1) << "Requesting screen lock from SessionControllerClient"; |
| 185 chromeos::DBusThreadManager::Get() | 185 chromeos::DBusThreadManager::Get() |
| 186 ->GetSessionManagerClient() | 186 ->GetSessionManagerClient() |
| 187 ->RequestLockScreen(); | 187 ->RequestLockScreen(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 // static | 190 // static |
| 191 void SessionControllerClient::DoSwitchActiveUser(const AccountId& account_id) { | 191 void SessionControllerClient::DoSwitchActiveUser(const AccountId& account_id) { |
| 192 // Disallow switching to an already active user since that might crash. | 192 // Disallow switching to an already active user since that might crash. |
| 193 // Also check that we got a user id and not an email address. | |
| 194 DCHECK_EQ( | |
| 195 account_id.GetUserEmail(), | |
| 196 gaia::CanonicalizeEmail(gaia::SanitizeEmail(account_id.GetUserEmail()))); | |
| 197 if (account_id == UserManager::Get()->GetActiveUser()->GetAccountId()) | 193 if (account_id == UserManager::Get()->GetActiveUser()->GetAccountId()) |
| 198 return; | 194 return; |
| 199 | 195 |
| 200 TrySwitchingActiveUser(base::Bind(&DoSwitchUser, account_id)); | 196 TrySwitchingActiveUser(base::Bind(&DoSwitchUser, account_id)); |
| 201 } | 197 } |
| 202 | 198 |
| 203 // static | 199 // static |
| 204 void SessionControllerClient::DoCycleActiveUser(bool next_user) { | 200 void SessionControllerClient::DoCycleActiveUser(bool next_user) { |
| 205 const UserList& logged_in_users = UserManager::Get()->GetLoggedInUsers(); | 201 const UserList& logged_in_users = UserManager::Get()->GetLoggedInUsers(); |
| 206 if (logged_in_users.size() <= 1) | 202 if (logged_in_users.size() <= 1) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 const UserList logged_in_users = user_manager->GetLoggedInUsers(); | 282 const UserList logged_in_users = user_manager->GetLoggedInUsers(); |
| 287 std::vector<uint32_t> user_session_ids; | 283 std::vector<uint32_t> user_session_ids; |
| 288 for (auto* user : user_manager->GetLRULoggedInUsers()) { | 284 for (auto* user : user_manager->GetLRULoggedInUsers()) { |
| 289 const uint32_t user_session_id = GetSessionId(*user); | 285 const uint32_t user_session_id = GetSessionId(*user); |
| 290 DCHECK_NE(0u, user_session_id); | 286 DCHECK_NE(0u, user_session_id); |
| 291 user_session_ids.push_back(user_session_id); | 287 user_session_ids.push_back(user_session_id); |
| 292 } | 288 } |
| 293 | 289 |
| 294 session_controller_->SetUserSessionOrder(user_session_ids); | 290 session_controller_->SetUserSessionOrder(user_session_ids); |
| 295 } | 291 } |
| OLD | NEW |