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

Side by Side Diff: chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc

Issue 11363109: Check for login screen availibility before showing spinner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/kiosk_mode/kiosk_mode_screensaver.h" 5 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h"
6 6
7 #include "ash/screensaver/screensaver_view.h" 7 #include "ash/screensaver/screensaver_view.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/wm/user_activity_detector.h" 9 #include "ash/wm/user_activity_detector.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 ShutdownKioskModeScreensaver(); 192 ShutdownKioskModeScreensaver();
193 } 193 }
194 } 194 }
195 195
196 void KioskModeScreensaver::OnUserActivity() { 196 void KioskModeScreensaver::OnUserActivity() {
197 // We don't want to handle further user notifications; we'll either login 197 // We don't want to handle further user notifications; we'll either login
198 // the user and close out or or at least close the screensaver. 198 // the user and close out or or at least close the screensaver.
199 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this); 199 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this);
200 200
201 // Find the retail mode login page. 201 // Find the retail mode login page.
202 CHECK(WebUILoginDisplayHost::default_host()); 202 if (WebUILoginDisplayHost::default_host()) {
203 WebUILoginDisplayHost* webui_host = 203 WebUILoginDisplayHost* webui_host =
204 static_cast<WebUILoginDisplayHost*>( 204 static_cast<WebUILoginDisplayHost*>(
205 WebUILoginDisplayHost::default_host()); 205 WebUILoginDisplayHost::default_host());
206 OobeUI* oobe_ui = webui_host->GetOobeUI(); 206 OobeUI* oobe_ui = webui_host->GetOobeUI();
207 207
208 // Show the login spinner. 208 // Show the login spinner.
209 CHECK(oobe_ui); 209 if (oobe_ui)
210 oobe_ui->ShowRetailModeLoginSpinner(); 210 oobe_ui->ShowRetailModeLoginSpinner();
211 211
212 // Close the screensaver, our login spinner is already showing. 212 // Close the screensaver, our login spinner is already showing.
213 ash::CloseScreensaver(); 213 ash::CloseScreensaver();
214 214
215 // Log us in. 215 // Log us in.
216 ExistingUserController* controller = 216 ExistingUserController* controller =
217 ExistingUserController::current_controller(); 217 ExistingUserController::current_controller();
218 CHECK(controller); 218 if (controller && !chromeos::UserManager::Get()->IsSessionStarted())
Nikita (slow) 2012/11/08 17:58:40 This should still use IsUserLoggedIn() as there's
rkc 2012/11/08 20:06:57 Done.
219 controller->LoginAsDemoUser(); 219 controller->LoginAsDemoUser();
220 } else {
221 // No default host for the WebUiLoginDisplay means that we're already in the
222 // process of logging in - shut down screensaver and do nothing else.
223 ash::CloseScreensaver();
224 }
220 225
221 ShutdownKioskModeScreensaver(); 226 ShutdownKioskModeScreensaver();
222 } 227 }
223 228
224 static KioskModeScreensaver* g_kiosk_mode_screensaver = NULL; 229 static KioskModeScreensaver* g_kiosk_mode_screensaver = NULL;
225 230
226 void InitializeKioskModeScreensaver() { 231 void InitializeKioskModeScreensaver() {
227 if (g_kiosk_mode_screensaver) { 232 if (g_kiosk_mode_screensaver) {
228 LOG(WARNING) << "Screensaver was already initialized"; 233 LOG(WARNING) << "Screensaver was already initialized";
229 return; 234 return;
230 } 235 }
231 236
232 g_kiosk_mode_screensaver = new KioskModeScreensaver(); 237 g_kiosk_mode_screensaver = new KioskModeScreensaver();
233 } 238 }
234 239
235 void ShutdownKioskModeScreensaver() { 240 void ShutdownKioskModeScreensaver() {
236 delete g_kiosk_mode_screensaver; 241 delete g_kiosk_mode_screensaver;
237 g_kiosk_mode_screensaver = NULL; 242 g_kiosk_mode_screensaver = NULL;
238 } 243 }
239 244
240 } // namespace chromeos 245 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698