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

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

Issue 11361187: Merge 166784 - Check for login screen availibility before showing spinner. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1271/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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 ShutdownKioskModeScreensaver(); 186 ShutdownKioskModeScreensaver();
187 } 187 }
188 } 188 }
189 189
190 void KioskModeScreensaver::OnUserActivity() { 190 void KioskModeScreensaver::OnUserActivity() {
191 // We don't want to handle further user notifications; we'll either login 191 // We don't want to handle further user notifications; we'll either login
192 // the user and close out or or at least close the screensaver. 192 // the user and close out or or at least close the screensaver.
193 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this); 193 ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this);
194 194
195 // Find the retail mode login page. 195 // Find the retail mode login page.
196 CHECK(WebUILoginDisplayHost::default_host()); 196 if (WebUILoginDisplayHost::default_host()) {
197 WebUILoginDisplayHost* webui_host = 197 WebUILoginDisplayHost* webui_host =
198 static_cast<WebUILoginDisplayHost*>( 198 static_cast<WebUILoginDisplayHost*>(
199 WebUILoginDisplayHost::default_host()); 199 WebUILoginDisplayHost::default_host());
200 OobeUI* oobe_ui = webui_host->GetOobeUI(); 200 OobeUI* oobe_ui = webui_host->GetOobeUI();
201 201
202 // Show the login spinner. 202 // Show the login spinner.
203 CHECK(oobe_ui); 203 if (oobe_ui)
204 oobe_ui->ShowRetailModeLoginSpinner(); 204 oobe_ui->ShowRetailModeLoginSpinner();
205 205
206 // Close the screensaver, our login spinner is already showing. 206 // Close the screensaver, our login spinner is already showing.
207 ash::CloseScreensaver(); 207 ash::CloseScreensaver();
208 208
209 // Log us in. 209 // Log us in.
210 ExistingUserController* controller = 210 ExistingUserController* controller =
211 ExistingUserController::current_controller(); 211 ExistingUserController::current_controller();
212 CHECK(controller); 212 if (controller && !chromeos::UserManager::Get()->IsUserLoggedIn())
213 controller->LoginAsDemoUser(); 213 controller->LoginAsDemoUser();
214 } else {
215 // No default host for the WebUiLoginDisplay means that we're already in the
216 // process of logging in - shut down screensaver and do nothing else.
217 ash::CloseScreensaver();
218 }
214 219
215 ShutdownKioskModeScreensaver(); 220 ShutdownKioskModeScreensaver();
216 } 221 }
217 222
218 static KioskModeScreensaver* g_kiosk_mode_screensaver = NULL; 223 static KioskModeScreensaver* g_kiosk_mode_screensaver = NULL;
219 224
220 void InitializeKioskModeScreensaver() { 225 void InitializeKioskModeScreensaver() {
221 if (g_kiosk_mode_screensaver) { 226 if (g_kiosk_mode_screensaver) {
222 LOG(WARNING) << "Screensaver was already initialized"; 227 LOG(WARNING) << "Screensaver was already initialized";
223 return; 228 return;
224 } 229 }
225 230
226 g_kiosk_mode_screensaver = new KioskModeScreensaver(); 231 g_kiosk_mode_screensaver = new KioskModeScreensaver();
227 } 232 }
228 233
229 void ShutdownKioskModeScreensaver() { 234 void ShutdownKioskModeScreensaver() {
230 delete g_kiosk_mode_screensaver; 235 delete g_kiosk_mode_screensaver;
231 g_kiosk_mode_screensaver = NULL; 236 g_kiosk_mode_screensaver = NULL;
232 } 237 }
233 238
234 } // namespace chromeos 239 } // 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