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

Side by Side Diff: chrome/browser/chromeos/login/app_launch_controller.cc

Issue 209143002: Added shortcut for NW config screen in kiosk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/chromeos/login/app_launch_controller.h" 5 #include "chrome/browser/chromeos/login/app_launch_controller.h"
6 6
7 #include "apps/app_window.h" 7 #include "apps/app_window.h"
8 #include "apps/app_window_registry.h" 8 #include "apps/app_window_registry.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 diagnostic_mode_(diagnostic_mode), 112 diagnostic_mode_(diagnostic_mode),
113 host_(host), 113 host_(host),
114 oobe_display_(oobe_display), 114 oobe_display_(oobe_display),
115 app_launch_splash_screen_actor_( 115 app_launch_splash_screen_actor_(
116 oobe_display_->GetAppLaunchSplashScreenActor()), 116 oobe_display_->GetAppLaunchSplashScreenActor()),
117 webui_visible_(false), 117 webui_visible_(false),
118 launcher_ready_(false), 118 launcher_ready_(false),
119 waiting_for_network_(false), 119 waiting_for_network_(false),
120 network_wait_timedout_(false), 120 network_wait_timedout_(false),
121 showing_network_dialog_(false), 121 showing_network_dialog_(false),
122 network_config_requested_(false),
122 launch_splash_start_time_(0) { 123 launch_splash_start_time_(0) {
123 } 124 }
124 125
125 AppLaunchController::~AppLaunchController() { 126 AppLaunchController::~AppLaunchController() {
126 app_launch_splash_screen_actor_->SetDelegate(NULL); 127 app_launch_splash_screen_actor_->SetDelegate(NULL);
127 } 128 }
128 129
129 void AppLaunchController::StartAppLaunch() { 130 void AppLaunchController::StartAppLaunch() {
130 DVLOG(1) << "Starting kiosk mode..."; 131 DVLOG(1) << "Starting kiosk mode...";
131 132
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 OnReadyToLaunch(); 210 OnReadyToLaunch();
210 } 211 }
211 212
212 void AppLaunchController::OnCancelAppLaunch() { 213 void AppLaunchController::OnCancelAppLaunch() {
213 if (KioskAppManager::Get()->GetDisableBailoutShortcut()) 214 if (KioskAppManager::Get()->GetDisableBailoutShortcut())
214 return; 215 return;
215 216
216 OnLaunchFailed(KioskAppLaunchError::USER_CANCEL); 217 OnLaunchFailed(KioskAppLaunchError::USER_CANCEL);
217 } 218 }
218 219
220 void AppLaunchController::OnNetworkConfigRequested(bool requested) {
221 network_config_requested_ = requested;
222 if (requested)
223 MaybeShowNetworkConfigureUI();
224 else
225 startup_app_launcher_->RestartLauncher();
226 }
227
219 void AppLaunchController::OnNetworkStateChanged(bool online) { 228 void AppLaunchController::OnNetworkStateChanged(bool online) {
220 if (!waiting_for_network_) 229 if (!waiting_for_network_)
221 return; 230 return;
222 231
223 if (online) 232 if (online && !network_config_requested_)
224 startup_app_launcher_->ContinueWithNetworkReady(); 233 startup_app_launcher_->ContinueWithNetworkReady();
225 else if (network_wait_timedout_) 234 else if (network_wait_timedout_)
226 MaybeShowNetworkConfigureUI(); 235 MaybeShowNetworkConfigureUI();
227 } 236 }
228 237
229 void AppLaunchController::OnProfileLoaded(Profile* profile) { 238 void AppLaunchController::OnProfileLoaded(Profile* profile) {
230 DVLOG(1) << "Profile loaded... Starting app launch."; 239 DVLOG(1) << "Profile loaded... Starting app launch.";
231 profile_ = profile; 240 profile_ = profile;
232 241
233 kiosk_profile_loader_.reset(); 242 kiosk_profile_loader_.reset();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 return need_owner_auth_to_configure_network_callback_->Run(); 302 return need_owner_auth_to_configure_network_callback_->Run();
294 303
295 policy::BrowserPolicyConnectorChromeOS* connector = 304 policy::BrowserPolicyConnectorChromeOS* connector =
296 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 305 g_browser_process->platform_part()->browser_policy_connector_chromeos();
297 return !connector->IsEnterpriseManaged(); 306 return !connector->IsEnterpriseManaged();
298 } 307 }
299 308
300 void AppLaunchController::MaybeShowNetworkConfigureUI() { 309 void AppLaunchController::MaybeShowNetworkConfigureUI() {
301 if (CanConfigureNetwork()) { 310 if (CanConfigureNetwork()) {
302 if (NeedOwnerAuthToConfigureNetwork()) { 311 if (NeedOwnerAuthToConfigureNetwork()) {
303 app_launch_splash_screen_actor_->ToggleNetworkConfig(true); 312 if (network_config_requested_)
313 OnConfigureNetwork();
314 else
315 app_launch_splash_screen_actor_->ToggleNetworkConfig(true);
304 } else { 316 } else {
305 showing_network_dialog_ = true; 317 showing_network_dialog_ = true;
306 app_launch_splash_screen_actor_->ShowNetworkConfigureUI(); 318 app_launch_splash_screen_actor_->ShowNetworkConfigureUI();
307 } 319 }
308 } else { 320 } else {
309 app_launch_splash_screen_actor_->UpdateAppLaunchState( 321 app_launch_splash_screen_actor_->UpdateAppLaunchState(
310 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT); 322 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT);
311 } 323 }
312 } 324 }
313 325
314 void AppLaunchController::InitializeNetwork() { 326 void AppLaunchController::InitializeNetwork() {
315 // Show the network configration dialog if network is not initialized 327 // Show the network configuration dialog if network is not initialized
316 // after a brief wait time. 328 // after a brief wait time.
317 waiting_for_network_ = true; 329 waiting_for_network_ = true;
318 network_wait_timer_.Start( 330 network_wait_timer_.Start(
319 FROM_HERE, 331 FROM_HERE,
320 base::TimeDelta::FromSeconds(network_wait_time_), 332 base::TimeDelta::FromSeconds(network_wait_time_),
321 this, &AppLaunchController::OnNetworkWaitTimedout); 333 this, &AppLaunchController::OnNetworkWaitTimedout);
322 334
323 app_launch_splash_screen_actor_->UpdateAppLaunchState( 335 app_launch_splash_screen_actor_->UpdateAppLaunchState(
324 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_PREPARING_NETWORK); 336 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_PREPARING_NETWORK);
325 } 337 }
(...skipping 24 matching lines...) Expand all
350 // configuration dialog if it is being shown. 362 // configuration dialog if it is being shown.
351 if (showing_network_dialog_) { 363 if (showing_network_dialog_) {
352 app_launch_splash_screen_actor_->Show(app_id_); 364 app_launch_splash_screen_actor_->Show(app_id_);
353 showing_network_dialog_ = false; 365 showing_network_dialog_ = false;
354 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue(); 366 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue();
355 } 367 }
356 } 368 }
357 369
358 void AppLaunchController::OnReadyToLaunch() { 370 void AppLaunchController::OnReadyToLaunch() {
359 launcher_ready_ = true; 371 launcher_ready_ = true;
372
373 if (network_config_requested_)
374 return;
375
360 if (!webui_visible_) 376 if (!webui_visible_)
361 return; 377 return;
362 378
363 if (splash_wait_timer_.IsRunning()) 379 if (splash_wait_timer_.IsRunning())
364 return; 380 return;
365 381
366 const int64 time_taken_ms = (base::TimeTicks::Now() - 382 const int64 time_taken_ms = (base::TimeTicks::Now() -
367 base::TimeTicks::FromInternalValue(launch_splash_start_time_)). 383 base::TimeTicks::FromInternalValue(launch_splash_start_time_)).
368 InMilliseconds(); 384 InMilliseconds();
369 385
(...skipping 25 matching lines...) Expand all
395 LOG(ERROR) << "Kiosk launch failed. Will now shut down." 411 LOG(ERROR) << "Kiosk launch failed. Will now shut down."
396 << ", error=" << error; 412 << ", error=" << error;
397 DCHECK_NE(KioskAppLaunchError::NONE, error); 413 DCHECK_NE(KioskAppLaunchError::NONE, error);
398 414
399 // Saves the error and ends the session to go back to login screen. 415 // Saves the error and ends the session to go back to login screen.
400 KioskAppLaunchError::Save(error); 416 KioskAppLaunchError::Save(error);
401 chrome::AttemptUserExit(); 417 chrome::AttemptUserExit();
402 CleanUp(); 418 CleanUp();
403 } 419 }
404 420
421 bool AppLaunchController::IsShowingNetworkConfigScreen() {
422 return network_config_requested_;
423 }
424
405 } // namespace chromeos 425 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/app_launch_controller.h ('k') | chrome/browser/chromeos/login/kiosk_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698