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

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

Issue 783663003: Special check on Supervised User creation flow added to prevent misleading shelf alignment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/multi_profile_uma.h" 7 #include "ash/multi_profile_uma.h"
8 #include "ash/session/session_state_observer.h" 8 #include "ash/session/session_state_observer.h"
9 #include "ash/system/chromeos/multi_user/user_switch_util.h" 9 #include "ash/system/chromeos/multi_user/user_switch_util.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 11 matching lines...) Expand all
22 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
23 #include "chromeos/chromeos_switches.h" 23 #include "chromeos/chromeos_switches.h"
24 #include "chromeos/dbus/dbus_thread_manager.h" 24 #include "chromeos/dbus/dbus_thread_manager.h"
25 #include "chromeos/dbus/session_manager_client.h" 25 #include "chromeos/dbus/session_manager_client.h"
26 #include "chromeos/login/login_state.h" 26 #include "chromeos/login/login_state.h"
27 #include "components/user_manager/user.h" 27 #include "components/user_manager/user.h"
28 #include "components/user_manager/user_manager.h" 28 #include "components/user_manager/user_manager.h"
29 #include "google_apis/gaia/gaia_auth_util.h" 29 #include "google_apis/gaia/gaia_auth_util.h"
30 30
31 SessionStateDelegateChromeos::SessionStateDelegateChromeos() 31 SessionStateDelegateChromeos::SessionStateDelegateChromeos()
32 : session_state_(SESSION_STATE_LOGIN_PRIMARY) { 32 : session_state_(SESSION_STATE_LOGIN_PRIMARY),
33 is_in_supervised_creation_flow_(false) {
33 user_manager::UserManager::Get()->AddSessionStateObserver(this); 34 user_manager::UserManager::Get()->AddSessionStateObserver(this);
34 chromeos::UserAddingScreen::Get()->AddObserver(this); 35 chromeos::UserAddingScreen::Get()->AddObserver(this);
35 36
36 // LoginState is not initialized in unit_tests. 37 // LoginState is not initialized in unit_tests.
37 if (chromeos::LoginState::IsInitialized()) { 38 if (chromeos::LoginState::IsInitialized()) {
38 chromeos::LoginState::Get()->AddObserver(this); 39 chromeos::LoginState::Get()->AddObserver(this);
39 SetSessionState(chromeos::LoginState::Get()->IsUserLoggedIn() ? 40 SetSessionState(chromeos::LoginState::Get()->IsUserLoggedIn() ?
40 SESSION_STATE_ACTIVE : SESSION_STATE_LOGIN_PRIMARY, true); 41 SESSION_STATE_ACTIVE : SESSION_STATE_LOGIN_PRIMARY, true);
41 } 42 }
42 } 43 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 141 }
141 142
142 bool SessionStateDelegateChromeos::IsUserSessionBlocked() const { 143 bool SessionStateDelegateChromeos::IsUserSessionBlocked() const {
143 bool has_login_manager = CommandLine::ForCurrentProcess()->HasSwitch( 144 bool has_login_manager = CommandLine::ForCurrentProcess()->HasSwitch(
144 chromeos::switches::kLoginManager); 145 chromeos::switches::kLoginManager);
145 return (has_login_manager && !IsActiveUserSessionStarted()) || 146 return (has_login_manager && !IsActiveUserSessionStarted()) ||
146 IsScreenLocked() || 147 IsScreenLocked() ||
147 chromeos::UserAddingScreen::Get()->IsRunning(); 148 chromeos::UserAddingScreen::Get()->IsRunning();
148 } 149 }
149 150
151 bool SessionStateDelegateChromeos::IsInSupervisedUserCreationFlow() const {
152 return is_in_supervised_creation_flow_;
153 }
154
155 void SessionStateDelegateChromeos::SetIsInSupervisedUserCreationFlow(
156 bool is_in_flow) {
157 is_in_supervised_creation_flow_ = is_in_flow;
158 }
159
150 ash::SessionStateDelegate::SessionState 160 ash::SessionStateDelegate::SessionState
151 SessionStateDelegateChromeos::GetSessionState() const { 161 SessionStateDelegateChromeos::GetSessionState() const {
152 return session_state_; 162 return session_state_;
153 } 163 }
154 164
155 const user_manager::UserInfo* SessionStateDelegateChromeos::GetUserInfo( 165 const user_manager::UserInfo* SessionStateDelegateChromeos::GetUserInfo(
156 ash::MultiProfileIndex index) const { 166 ash::MultiProfileIndex index) const {
157 DCHECK_LT(index, NumberOfLoggedInUsers()); 167 DCHECK_LT(index, NumberOfLoggedInUsers());
158 return user_manager::UserManager::Get()->GetLRULoggedInUsers()[index]; 168 return user_manager::UserManager::Get()->GetLRULoggedInUsers()[index];
159 } 169 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 294 }
285 295
286 void DoSwitchUser(const std::string& user_id) { 296 void DoSwitchUser(const std::string& user_id) {
287 user_manager::UserManager::Get()->SwitchActiveUser(user_id); 297 user_manager::UserManager::Get()->SwitchActiveUser(user_id);
288 } 298 }
289 299
290 void SessionStateDelegateChromeos::TryToSwitchUser( 300 void SessionStateDelegateChromeos::TryToSwitchUser(
291 const std::string& user_id) { 301 const std::string& user_id) {
292 ash::TrySwitchingActiveUser(base::Bind(&DoSwitchUser, user_id)); 302 ash::TrySwitchingActiveUser(base::Bind(&DoSwitchUser, user_id));
293 } 303 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698