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

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

Issue 2446453002: Refactor ShouldLockScreenBeforeSuspending to ShouldLockScreenAutomatically (Closed)
Patch Set: comment Created 4 years, 1 month 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 (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"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 const user_manager::UserList unlock_users = 96 const user_manager::UserList unlock_users =
97 user_manager::UserManager::Get()->GetUnlockUsers(); 97 user_manager::UserManager::Get()->GetUnlockUsers();
98 return !unlock_users.empty(); 98 return !unlock_users.empty();
99 } 99 }
100 100
101 bool SessionStateDelegateChromeos::IsScreenLocked() const { 101 bool SessionStateDelegateChromeos::IsScreenLocked() const {
102 return chromeos::ScreenLocker::default_screen_locker() && 102 return chromeos::ScreenLocker::default_screen_locker() &&
103 chromeos::ScreenLocker::default_screen_locker()->locked(); 103 chromeos::ScreenLocker::default_screen_locker()->locked();
104 } 104 }
105 105
106 bool SessionStateDelegateChromeos::ShouldLockScreenBeforeSuspending() const { 106 bool SessionStateDelegateChromeos::ShouldLockScreenAutomatically() const {
107 const user_manager::UserList logged_in_users = 107 const user_manager::UserList logged_in_users =
108 user_manager::UserManager::Get()->GetLoggedInUsers(); 108 user_manager::UserManager::Get()->GetLoggedInUsers();
109 for (user_manager::UserList::const_iterator it = logged_in_users.begin(); 109 for (user_manager::UserList::const_iterator it = logged_in_users.begin();
110 it != logged_in_users.end(); 110 it != logged_in_users.end();
111 ++it) { 111 ++it) {
112 user_manager::User* user = (*it); 112 user_manager::User* user = (*it);
113 Profile* profile = chromeos::ProfileHelper::Get()->GetProfileByUser(user); 113 Profile* profile = chromeos::ProfileHelper::Get()->GetProfileByUser(user);
114 if (profile && 114 if (profile &&
115 profile->GetPrefs()->GetBoolean(prefs::kEnableAutoScreenLock)) { 115 profile->GetPrefs()->GetBoolean(prefs::kEnableAutoScreenLock)) {
116 return true; 116 return true;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 281 }
282 282
283 void DoSwitchUser(const AccountId& account_id) { 283 void DoSwitchUser(const AccountId& account_id) {
284 user_manager::UserManager::Get()->SwitchActiveUser(account_id); 284 user_manager::UserManager::Get()->SwitchActiveUser(account_id);
285 } 285 }
286 286
287 void SessionStateDelegateChromeos::TryToSwitchUser( 287 void SessionStateDelegateChromeos::TryToSwitchUser(
288 const AccountId& account_id) { 288 const AccountId& account_id) {
289 TrySwitchingActiveUser(base::Bind(&DoSwitchUser, account_id)); 289 TrySwitchingActiveUser(base::Bind(&DoSwitchUser, account_id));
290 } 290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698