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

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: rebase Created 6 years, 9 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 LOG(ERROR) << "OnNetworkConfigRequested: " << requested;
xiyuan 2014/03/26 16:24:16 nit: Do we still need the LOG here and around line
zel 2014/03/26 17:30:58 Done.
222 network_config_requested_ = requested;
223 if (requested)
224 MaybeShowNetworkConfigureUI();
225 else
226 startup_app_launcher_->RestartLauncher();
227 }
228
219 void AppLaunchController::OnNetworkStateChanged(bool online) { 229 void AppLaunchController::OnNetworkStateChanged(bool online) {
230 LOG(ERROR) << "OnNetworkStateChanged: "
231 << "online: " << online
232 << ", waiting_for_network_: " << waiting_for_network_
233 << ", network_config_requested_: " << network_config_requested_
234 << ", network_wait_timedout_: " << network_wait_timedout_;
220 if (!waiting_for_network_) 235 if (!waiting_for_network_)
221 return; 236 return;
222 237
223 if (online) 238 if (online && !network_config_requested_)
224 startup_app_launcher_->ContinueWithNetworkReady(); 239 startup_app_launcher_->ContinueWithNetworkReady();
225 else if (network_wait_timedout_) 240 else if (network_wait_timedout_)
226 MaybeShowNetworkConfigureUI(); 241 MaybeShowNetworkConfigureUI();
227 } 242 }
228 243
229 void AppLaunchController::OnProfileLoaded(Profile* profile) { 244 void AppLaunchController::OnProfileLoaded(Profile* profile) {
230 DVLOG(1) << "Profile loaded... Starting app launch."; 245 DVLOG(1) << "Profile loaded... Starting app launch.";
231 profile_ = profile; 246 profile_ = profile;
232 247
233 kiosk_profile_loader_.reset(); 248 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(); 308 return need_owner_auth_to_configure_network_callback_->Run();
294 309
295 policy::BrowserPolicyConnectorChromeOS* connector = 310 policy::BrowserPolicyConnectorChromeOS* connector =
296 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 311 g_browser_process->platform_part()->browser_policy_connector_chromeos();
297 return !connector->IsEnterpriseManaged(); 312 return !connector->IsEnterpriseManaged();
298 } 313 }
299 314
300 void AppLaunchController::MaybeShowNetworkConfigureUI() { 315 void AppLaunchController::MaybeShowNetworkConfigureUI() {
301 if (CanConfigureNetwork()) { 316 if (CanConfigureNetwork()) {
302 if (NeedOwnerAuthToConfigureNetwork()) { 317 if (NeedOwnerAuthToConfigureNetwork()) {
303 app_launch_splash_screen_actor_->ToggleNetworkConfig(true); 318 if (network_config_requested_)
319 OnConfigureNetwork();
320 else
321 app_launch_splash_screen_actor_->ToggleNetworkConfig(true);
304 } else { 322 } else {
305 showing_network_dialog_ = true; 323 showing_network_dialog_ = true;
306 app_launch_splash_screen_actor_->ShowNetworkConfigureUI(); 324 app_launch_splash_screen_actor_->ShowNetworkConfigureUI();
307 } 325 }
308 } else { 326 } else {
309 app_launch_splash_screen_actor_->UpdateAppLaunchState( 327 app_launch_splash_screen_actor_->UpdateAppLaunchState(
310 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT); 328 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT);
311 } 329 }
312 } 330 }
313 331
314 void AppLaunchController::InitializeNetwork() { 332 void AppLaunchController::InitializeNetwork() {
315 // Show the network configration dialog if network is not initialized 333 // Show the network configuration dialog if network is not initialized
316 // after a brief wait time. 334 // after a brief wait time.
317 waiting_for_network_ = true; 335 waiting_for_network_ = true;
318 network_wait_timer_.Start( 336 network_wait_timer_.Start(
319 FROM_HERE, 337 FROM_HERE,
320 base::TimeDelta::FromSeconds(network_wait_time_), 338 base::TimeDelta::FromSeconds(network_wait_time_),
321 this, &AppLaunchController::OnNetworkWaitTimedout); 339 this, &AppLaunchController::OnNetworkWaitTimedout);
322 340
323 app_launch_splash_screen_actor_->UpdateAppLaunchState( 341 app_launch_splash_screen_actor_->UpdateAppLaunchState(
324 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_PREPARING_NETWORK); 342 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_PREPARING_NETWORK);
325 } 343 }
(...skipping 24 matching lines...) Expand all
350 // configuration dialog if it is being shown. 368 // configuration dialog if it is being shown.
351 if (showing_network_dialog_) { 369 if (showing_network_dialog_) {
352 app_launch_splash_screen_actor_->Show(app_id_); 370 app_launch_splash_screen_actor_->Show(app_id_);
353 showing_network_dialog_ = false; 371 showing_network_dialog_ = false;
354 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue(); 372 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue();
355 } 373 }
356 } 374 }
357 375
358 void AppLaunchController::OnReadyToLaunch() { 376 void AppLaunchController::OnReadyToLaunch() {
359 launcher_ready_ = true; 377 launcher_ready_ = true;
378
379 if (network_config_requested_)
380 return;
381
360 if (!webui_visible_) 382 if (!webui_visible_)
361 return; 383 return;
362 384
363 if (splash_wait_timer_.IsRunning()) 385 if (splash_wait_timer_.IsRunning())
364 return; 386 return;
365 387
366 const int64 time_taken_ms = (base::TimeTicks::Now() - 388 const int64 time_taken_ms = (base::TimeTicks::Now() -
367 base::TimeTicks::FromInternalValue(launch_splash_start_time_)). 389 base::TimeTicks::FromInternalValue(launch_splash_start_time_)).
368 InMilliseconds(); 390 InMilliseconds();
369 391
(...skipping 25 matching lines...) Expand all
395 LOG(ERROR) << "Kiosk launch failed. Will now shut down." 417 LOG(ERROR) << "Kiosk launch failed. Will now shut down."
396 << ", error=" << error; 418 << ", error=" << error;
397 DCHECK_NE(KioskAppLaunchError::NONE, error); 419 DCHECK_NE(KioskAppLaunchError::NONE, error);
398 420
399 // Saves the error and ends the session to go back to login screen. 421 // Saves the error and ends the session to go back to login screen.
400 KioskAppLaunchError::Save(error); 422 KioskAppLaunchError::Save(error);
401 chrome::AttemptUserExit(); 423 chrome::AttemptUserExit();
402 CleanUp(); 424 CleanUp();
403 } 425 }
404 426
427 bool AppLaunchController::IsShowingNetworkConfigScreen() {
428 return network_config_requested_;
429 }
430
431
xiyuan 2014/03/26 16:24:16 nit: nuke one empty line
zel 2014/03/26 17:30:58 Done.
405 } // namespace chromeos 432 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698