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

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

Issue 2151113002: kiosk: Show network config UI after profile load (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a state/message while waiting Created 4 years, 5 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
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } else { 228 } else {
229 // If kiosk mode was configured through enterprise policy, we may 229 // If kiosk mode was configured through enterprise policy, we may
230 // not have an owner user. 230 // not have an owner user.
231 // TODO(tengs): We need to figure out the appropriate security meausres 231 // TODO(tengs): We need to figure out the appropriate security meausres
232 // for this case. 232 // for this case.
233 NOTREACHED(); 233 NOTREACHED();
234 } 234 }
235 } 235 }
236 236
237 void AppLaunchController::OnOwnerSigninSuccess() { 237 void AppLaunchController::OnOwnerSigninSuccess() {
238 app_launch_splash_screen_actor_->ShowNetworkConfigureUI(); 238 ShowNetworkConfigureUIWhenReady();
239 signin_screen_.reset(); 239 signin_screen_.reset();
240 } 240 }
241 241
242 void AppLaunchController::Observe( 242 void AppLaunchController::Observe(
243 int type, 243 int type,
244 const content::NotificationSource& source, 244 const content::NotificationSource& source,
245 const content::NotificationDetails& details) { 245 const content::NotificationDetails& details) {
246 DCHECK_EQ(chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, type); 246 DCHECK_EQ(chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, type);
247 DCHECK(!webui_visible_); 247 DCHECK(!webui_visible_);
248 webui_visible_ = true; 248 webui_visible_ = true;
249 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue(); 249 launch_splash_start_time_ = base::TimeTicks::Now().ToInternalValue();
250 if (launcher_ready_) 250 if (launcher_ready_)
251 OnReadyToLaunch(); 251 OnReadyToLaunch();
252 } 252 }
253 253
254 void AppLaunchController::OnCancelAppLaunch() { 254 void AppLaunchController::OnCancelAppLaunch() {
255 if (KioskAppManager::Get()->GetDisableBailoutShortcut()) 255 if (KioskAppManager::Get()->GetDisableBailoutShortcut())
256 return; 256 return;
257 257
258 OnLaunchFailed(KioskAppLaunchError::USER_CANCEL); 258 OnLaunchFailed(KioskAppLaunchError::USER_CANCEL);
259 } 259 }
260 260
261 void AppLaunchController::OnNetworkConfigRequested(bool requested) { 261 void AppLaunchController::OnNetworkConfigRequested(bool requested) {
262 network_config_requested_ = requested; 262 network_config_requested_ = requested;
263 if (requested) 263 if (requested) {
264 MaybeShowNetworkConfigureUI(); 264 MaybeShowNetworkConfigureUI();
265 else 265 } else {
266 app_launch_splash_screen_actor_->UpdateAppLaunchState(
267 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_PREPARING_NETWORK);
266 startup_app_launcher_->RestartLauncher(); 268 startup_app_launcher_->RestartLauncher();
269 }
267 } 270 }
268 271
269 void AppLaunchController::OnNetworkStateChanged(bool online) { 272 void AppLaunchController::OnNetworkStateChanged(bool online) {
270 if (!waiting_for_network_) 273 if (!waiting_for_network_)
271 return; 274 return;
272 275
273 if (online && !network_config_requested_) 276 if (online && !network_config_requested_)
274 startup_app_launcher_->ContinueWithNetworkReady(); 277 startup_app_launcher_->ContinueWithNetworkReady();
275 else if (network_wait_timedout_) 278 else if (network_wait_timedout_)
276 MaybeShowNetworkConfigureUI(); 279 MaybeShowNetworkConfigureUI();
277 } 280 }
278 281
279 void AppLaunchController::OnProfileLoaded(Profile* profile) { 282 void AppLaunchController::OnProfileLoaded(Profile* profile) {
280 DVLOG(1) << "Profile loaded... Starting app launch."; 283 DVLOG(1) << "Profile loaded... Starting app launch.";
281 profile_ = profile; 284 profile_ = profile;
282 285
283 // This is needed to trigger input method extensions being loaded. 286 // This is needed to trigger input method extensions being loaded.
284 profile_->InitChromeOSPreferences(); 287 profile_->InitChromeOSPreferences();
285 288
286 kiosk_profile_loader_.reset(); 289 kiosk_profile_loader_.reset();
287 startup_app_launcher_.reset( 290 startup_app_launcher_.reset(
288 new StartupAppLauncher(profile_, app_id_, diagnostic_mode_, this)); 291 new StartupAppLauncher(profile_, app_id_, diagnostic_mode_, this));
289 startup_app_launcher_->Initialize(); 292 startup_app_launcher_->Initialize();
293
294 if (show_network_config_ui_after_profile_load_)
295 ShowNetworkConfigureUIWhenReady();
290 } 296 }
291 297
292 void AppLaunchController::OnProfileLoadFailed( 298 void AppLaunchController::OnProfileLoadFailed(
293 KioskAppLaunchError::Error error) { 299 KioskAppLaunchError::Error error) {
294 OnLaunchFailed(error); 300 OnLaunchFailed(error);
295 } 301 }
296 302
297 void AppLaunchController::ClearNetworkWaitTimer() { 303 void AppLaunchController::ClearNetworkWaitTimer() {
298 waiting_for_network_ = false; 304 waiting_for_network_ = false;
299 network_wait_timer_.Stop(); 305 network_wait_timer_.Stop();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 359 }
354 360
355 void AppLaunchController::MaybeShowNetworkConfigureUI() { 361 void AppLaunchController::MaybeShowNetworkConfigureUI() {
356 if (CanConfigureNetwork()) { 362 if (CanConfigureNetwork()) {
357 if (NeedOwnerAuthToConfigureNetwork()) { 363 if (NeedOwnerAuthToConfigureNetwork()) {
358 if (network_config_requested_) 364 if (network_config_requested_)
359 OnConfigureNetwork(); 365 OnConfigureNetwork();
360 else 366 else
361 app_launch_splash_screen_actor_->ToggleNetworkConfig(true); 367 app_launch_splash_screen_actor_->ToggleNetworkConfig(true);
362 } else { 368 } else {
363 showing_network_dialog_ = true; 369 ShowNetworkConfigureUIWhenReady();
364 app_launch_splash_screen_actor_->ShowNetworkConfigureUI();
365 } 370 }
366 } else { 371 } else {
367 app_launch_splash_screen_actor_->UpdateAppLaunchState( 372 app_launch_splash_screen_actor_->UpdateAppLaunchState(
368 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT); 373 AppLaunchSplashScreenActor::APP_LAUNCH_STATE_NETWORK_WAIT_TIMEOUT);
369 } 374 }
370 } 375 }
371 376
377 void AppLaunchController::ShowNetworkConfigureUIWhenReady() {
378 if (!profile_) {
379 show_network_config_ui_after_profile_load_ = true;
380 app_launch_splash_screen_actor_->UpdateAppLaunchState(
381 AppLaunchSplashScreenActor::
382 APP_LAUNCH_STATE_SHOWING_NETWORK_CONFIGURE_UI);
383 return;
384 }
385
386 show_network_config_ui_after_profile_load_ = false;
387 showing_network_dialog_ = true;
388 app_launch_splash_screen_actor_->ShowNetworkConfigureUI();
389 }
390
372 void AppLaunchController::InitializeNetwork() { 391 void AppLaunchController::InitializeNetwork() {
373 // Show the network configuration dialog if network is not initialized 392 // Show the network configuration dialog if network is not initialized
374 // after a brief wait time. 393 // after a brief wait time.
375 waiting_for_network_ = true; 394 waiting_for_network_ = true;
376 network_wait_timer_.Start( 395 network_wait_timer_.Start(
377 FROM_HERE, 396 FROM_HERE,
378 base::TimeDelta::FromSeconds(network_wait_time_), 397 base::TimeDelta::FromSeconds(network_wait_time_),
379 this, &AppLaunchController::OnNetworkWaitTimedout); 398 this, &AppLaunchController::OnNetworkWaitTimedout);
380 399
381 app_launch_splash_screen_actor_->UpdateAppLaunchState( 400 app_launch_splash_screen_actor_->UpdateAppLaunchState(
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 KioskAppLaunchError::Save(error); 483 KioskAppLaunchError::Save(error);
465 chrome::AttemptUserExit(); 484 chrome::AttemptUserExit();
466 CleanUp(); 485 CleanUp();
467 } 486 }
468 487
469 bool AppLaunchController::IsShowingNetworkConfigScreen() { 488 bool AppLaunchController::IsShowingNetworkConfigScreen() {
470 return network_config_requested_; 489 return network_config_requested_;
471 } 490 }
472 491
473 } // namespace chromeos 492 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698