Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/browser/ui/ash/session_controller_client.cc

Issue 2661283002: cros: Clean up SessionStateDelegate refs in Chrome (Closed)
Patch Set: update browser_finder_chromeos_unittest Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/palette_delegate_chromeos.cc ('k') | chrome/browser/ui/browser_finder_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698