Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/wizard_controller.h" | 5 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 #include <signal.h> | 8 #include <signal.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 25 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 26 #include "chrome/browser/chromeos/language_preferences.h" | 26 #include "chrome/browser/chromeos/language_preferences.h" |
| 27 #include "chrome/browser/chromeos/login/account_screen.h" | 27 #include "chrome/browser/chromeos/login/account_screen.h" |
| 28 #include "chrome/browser/chromeos/login/apply_services_customization.h" | 28 #include "chrome/browser/chromeos/login/apply_services_customization.h" |
| 29 #include "chrome/browser/chromeos/login/background_view.h" | 29 #include "chrome/browser/chromeos/login/background_view.h" |
| 30 #include "chrome/browser/chromeos/login/eula_view.h" | 30 #include "chrome/browser/chromeos/login/eula_view.h" |
| 31 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 31 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 32 #include "chrome/browser/chromeos/login/helper.h" | 32 #include "chrome/browser/chromeos/login/helper.h" |
| 33 #include "chrome/browser/chromeos/login/html_page_screen.h" | 33 #include "chrome/browser/chromeos/login/html_page_screen.h" |
| 34 #include "chrome/browser/chromeos/login/language_switch_menu.h" | 34 #include "chrome/browser/chromeos/login/language_switch_menu.h" |
| 35 #include "chrome/browser/chromeos/login/login_screen.h" | |
| 36 #include "chrome/browser/chromeos/login/login_utils.h" | 35 #include "chrome/browser/chromeos/login/login_utils.h" |
| 37 #include "chrome/browser/chromeos/login/network_screen.h" | 36 #include "chrome/browser/chromeos/login/network_screen.h" |
| 38 #include "chrome/browser/chromeos/login/registration_screen.h" | 37 #include "chrome/browser/chromeos/login/registration_screen.h" |
| 39 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 38 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
| 40 #include "chrome/browser/chromeos/login/update_screen.h" | 39 #include "chrome/browser/chromeos/login/update_screen.h" |
| 41 #include "chrome/browser/chromeos/login/user_image_screen.h" | 40 #include "chrome/browser/chromeos/login/user_image_screen.h" |
| 42 #include "chrome/browser/chromeos/login/user_manager.h" | 41 #include "chrome/browser/chromeos/login/user_manager.h" |
| 43 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" | 42 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
| 44 #include "chrome/browser/chromeos/wm_ipc.h" | 43 #include "chrome/browser/chromeos/wm_ipc.h" |
| 45 #include "chrome/browser/prefs/pref_service.h" | 44 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 background_widget_(NULL), | 252 background_widget_(NULL), |
| 254 background_view_(NULL), | 253 background_view_(NULL), |
| 255 contents_(NULL), | 254 contents_(NULL), |
| 256 current_screen_(NULL), | 255 current_screen_(NULL), |
| 257 #if defined(OFFICIAL_BUILD) | 256 #if defined(OFFICIAL_BUILD) |
| 258 is_official_build_(true), | 257 is_official_build_(true), |
| 259 #else | 258 #else |
| 260 is_official_build_(false), | 259 is_official_build_(false), |
| 261 #endif | 260 #endif |
| 262 is_out_of_box_(false), | 261 is_out_of_box_(false), |
| 263 is_test_mode_(false), | |
| 264 observer_(NULL) { | 262 observer_(NULL) { |
| 265 DCHECK(default_controller_ == NULL); | 263 DCHECK(default_controller_ == NULL); |
| 266 default_controller_ = this; | 264 default_controller_ = this; |
| 267 registrar_.Add( | 265 registrar_.Add( |
| 268 this, | 266 this, |
| 269 NotificationType::APP_TERMINATING, | 267 NotificationType::APP_TERMINATING, |
| 270 NotificationService::AllSources()); | 268 NotificationService::AllSources()); |
| 271 } | 269 } |
| 272 | 270 |
| 273 WizardController::~WizardController() { | 271 WizardController::~WizardController() { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 341 GetUpdateScreen()->CancelUpdate(); | 339 GetUpdateScreen()->CancelUpdate(); |
| 342 } | 340 } |
| 343 } | 341 } |
| 344 | 342 |
| 345 chromeos::NetworkScreen* WizardController::GetNetworkScreen() { | 343 chromeos::NetworkScreen* WizardController::GetNetworkScreen() { |
| 346 if (!network_screen_.get()) | 344 if (!network_screen_.get()) |
| 347 network_screen_.reset(new chromeos::NetworkScreen(this)); | 345 network_screen_.reset(new chromeos::NetworkScreen(this)); |
| 348 return network_screen_.get(); | 346 return network_screen_.get(); |
| 349 } | 347 } |
| 350 | 348 |
| 351 chromeos::LoginScreen* WizardController::GetLoginScreen() { | |
| 352 if (!login_screen_.get()) | |
| 353 login_screen_.reset(new chromeos::LoginScreen(this)); | |
| 354 return login_screen_.get(); | |
| 355 } | |
| 356 | |
| 357 chromeos::AccountScreen* WizardController::GetAccountScreen() { | 349 chromeos::AccountScreen* WizardController::GetAccountScreen() { |
| 358 if (!account_screen_.get()) | 350 if (!account_screen_.get()) |
| 359 account_screen_.reset(new chromeos::AccountScreen(this)); | 351 account_screen_.reset(new chromeos::AccountScreen(this)); |
| 360 return account_screen_.get(); | 352 return account_screen_.get(); |
| 361 } | 353 } |
| 362 | 354 |
| 363 chromeos::UpdateScreen* WizardController::GetUpdateScreen() { | 355 chromeos::UpdateScreen* WizardController::GetUpdateScreen() { |
| 364 if (!update_screen_.get()) { | 356 if (!update_screen_.get()) { |
| 365 update_screen_.reset(new chromeos::UpdateScreen(this)); | 357 update_screen_.reset(new chromeos::UpdateScreen(this)); |
| 366 update_screen_->SetRebootCheckDelay(kWaitForRebootTimeSec); | 358 update_screen_->SetRebootCheckDelay(kWaitForRebootTimeSec); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 background_view_->SetOobeProgress(chromeos::BackgroundView::SELECT_NETWORK); | 401 background_view_->SetOobeProgress(chromeos::BackgroundView::SELECT_NETWORK); |
| 410 } | 402 } |
| 411 | 403 |
| 412 chromeos::ExistingUserController* WizardController::ShowLoginScreen() { | 404 chromeos::ExistingUserController* WizardController::ShowLoginScreen() { |
| 413 SetStatusAreaVisible(true); | 405 SetStatusAreaVisible(true); |
| 414 background_view_->SetOobeProgress(chromeos::BackgroundView::SIGNIN); | 406 background_view_->SetOobeProgress(chromeos::BackgroundView::SIGNIN); |
| 415 | 407 |
| 416 // Initiate services customization. | 408 // Initiate services customization. |
| 417 chromeos::ApplyServicesCustomization::StartIfNeeded(); | 409 chromeos::ApplyServicesCustomization::StartIfNeeded(); |
| 418 | 410 |
| 419 // When run under automation test show plain login screen. | 411 std::vector<chromeos::UserManager::User> users; |
| 420 if (!is_test_mode_ && | 412 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) |
| 421 chromeos::CrosLibrary::Get()->EnsureLoaded() && | 413 users = chromeos::UserManager::Get()->GetUsers(); |
| 422 CommandLine::ForCurrentProcess()->HasSwitch( | |
| 423 switches::kEnableLoginImages)) { | |
| 424 std::vector<chromeos::UserManager::User> users = | |
| 425 chromeos::UserManager::Get()->GetUsers(); | |
| 426 // ExistingUserController deletes itself. | |
| 427 gfx::Rect screen_bounds; | |
| 428 background_widget_->GetBounds(&screen_bounds, true); | |
| 429 chromeos::ExistingUserController* controller = | |
| 430 new chromeos::ExistingUserController(users, screen_bounds); | |
| 431 controller->OwnBackground(background_widget_, background_view_); | |
| 432 controller->Init(); | |
| 433 background_widget_ = NULL; | |
| 434 background_view_ = NULL; | |
| 435 | 414 |
| 436 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 415 // ExistingUserController deletes itself. |
| 416 gfx::Rect screen_bounds; | |
| 417 background_widget_->GetBounds(&screen_bounds, true); | |
| 418 chromeos::ExistingUserController* controller = | |
| 419 new chromeos::ExistingUserController(users, screen_bounds); | |
| 420 controller->OwnBackground(background_widget_, background_view_); | |
| 421 controller->Init(); | |
| 422 background_widget_ = NULL; | |
| 423 background_view_ = NULL; | |
| 437 | 424 |
| 438 return controller; | 425 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 439 } | |
| 440 | 426 |
| 441 SetCurrentScreen(GetLoginScreen()); | 427 return controller; |
| 442 return NULL; | |
| 443 } | 428 } |
| 444 | 429 |
| 445 void WizardController::ShowAccountScreen() { | 430 void WizardController::ShowAccountScreen() { |
| 446 VLOG(1) << "Showing create account screen."; | 431 VLOG(1) << "Showing create account screen."; |
| 447 SetStatusAreaVisible(true); | 432 SetStatusAreaVisible(true); |
| 448 SetCurrentScreen(GetAccountScreen()); | 433 SetCurrentScreen(GetAccountScreen()); |
| 449 } | 434 } |
| 450 | 435 |
| 451 void WizardController::ShowUpdateScreen() { | 436 void WizardController::ShowUpdateScreen() { |
| 452 VLOG(1) << "Showing update screen."; | 437 VLOG(1) << "Showing update screen."; |
| 453 SetStatusAreaVisible(true); | 438 SetStatusAreaVisible(true); |
| 454 SetCurrentScreen(GetUpdateScreen()); | 439 SetCurrentScreen(GetUpdateScreen()); |
| 455 // There is no special step for update. | 440 // There is no special step for update. |
| 456 #if defined(OFFICIAL_BUILD) | 441 #if defined(OFFICIAL_BUILD) |
| 457 background_view_->SetOobeProgress(chromeos::BackgroundView::EULA); | 442 background_view_->SetOobeProgress(chromeos::BackgroundView::EULA); |
| 458 #else | 443 #else |
| 459 background_view_->SetOobeProgress(chromeos::BackgroundView::SELECT_NETWORK); | 444 background_view_->SetOobeProgress(chromeos::BackgroundView::SELECT_NETWORK); |
| 460 #endif | 445 #endif |
| 461 } | 446 } |
| 462 | 447 |
| 463 void WizardController::ShowUserImageScreen() { | 448 void WizardController::ShowUserImageScreen() { |
| 449 if (IsAutomationTest()) | |
| 450 OnUserImageSkipped(); | |
| 464 VLOG(1) << "Showing user image screen."; | 451 VLOG(1) << "Showing user image screen."; |
| 465 SetStatusAreaVisible(false); | 452 SetStatusAreaVisible(false); |
| 466 SetCurrentScreen(GetUserImageScreen()); | 453 SetCurrentScreen(GetUserImageScreen()); |
| 467 background_view_->SetOobeProgress(chromeos::BackgroundView::PICTURE); | 454 background_view_->SetOobeProgress(chromeos::BackgroundView::PICTURE); |
| 468 background_view_->EnableShutdownButton(false); | 455 background_view_->EnableShutdownButton(false); |
| 469 } | 456 } |
| 470 | 457 |
| 471 void WizardController::ShowEulaScreen() { | 458 void WizardController::ShowEulaScreen() { |
| 472 VLOG(1) << "Showing EULA screen."; | 459 VLOG(1) << "Showing EULA screen."; |
| 473 SetStatusAreaVisible(false); | 460 SetStatusAreaVisible(false); |
| 474 SetCurrentScreen(GetEulaScreen()); | 461 SetCurrentScreen(GetEulaScreen()); |
| 475 #if defined(OFFICIAL_BUILD) | 462 #if defined(OFFICIAL_BUILD) |
| 476 background_view_->SetOobeProgress(chromeos::BackgroundView::EULA); | 463 background_view_->SetOobeProgress(chromeos::BackgroundView::EULA); |
| 477 #endif | 464 #endif |
| 478 } | 465 } |
| 479 | 466 |
| 480 void WizardController::ShowRegistrationScreen() { | 467 void WizardController::ShowRegistrationScreen() { |
| 468 if (IsAutomationTest()) | |
| 469 OnUserImageSkipped(); | |
| 481 if (!IsRegistrationScreenValid(GetCustomization())) { | 470 if (!IsRegistrationScreenValid(GetCustomization())) { |
| 482 VLOG(1) << "Skipping registration screen: manifest not defined or invalid " | 471 VLOG(1) << "Skipping registration screen: manifest not defined or invalid " |
| 483 "URL."; | 472 "URL."; |
| 484 OnRegistrationSkipped(); | 473 OnRegistrationSkipped(); |
| 485 return; | 474 return; |
| 486 } | 475 } |
| 487 VLOG(1) << "Showing registration screen."; | 476 VLOG(1) << "Showing registration screen."; |
| 488 SetStatusAreaVisible(true); | 477 SetStatusAreaVisible(true); |
| 489 SetCurrentScreen(GetRegistrationScreen()); | 478 SetCurrentScreen(GetRegistrationScreen()); |
| 490 #if defined(OFFICIAL_BUILD) | 479 #if defined(OFFICIAL_BUILD) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 534 local_state->RegisterBooleanPref(kEulaAccepted, false); | 523 local_state->RegisterBooleanPref(kEulaAccepted, false); |
| 535 // Check if the pref is already registered in case | 524 // Check if the pref is already registered in case |
| 536 // Preferences::RegisterUserPrefs runs before this code in the future. | 525 // Preferences::RegisterUserPrefs runs before this code in the future. |
| 537 if (local_state->FindPreference(prefs::kAccessibilityEnabled) == NULL) { | 526 if (local_state->FindPreference(prefs::kAccessibilityEnabled) == NULL) { |
| 538 local_state->RegisterBooleanPref(prefs::kAccessibilityEnabled, false); | 527 local_state->RegisterBooleanPref(prefs::kAccessibilityEnabled, false); |
| 539 } | 528 } |
| 540 } | 529 } |
| 541 | 530 |
| 542 /////////////////////////////////////////////////////////////////////////////// | 531 /////////////////////////////////////////////////////////////////////////////// |
| 543 // WizardController, ExitHandlers: | 532 // WizardController, ExitHandlers: |
| 544 void WizardController::OnLoginSignInSelected() { | |
| 545 // Don't show user image screen in case of automated testing. | |
| 546 if (is_test_mode_) { | |
| 547 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | |
| 548 return; | |
| 549 } | |
| 550 // Don't launch browser until we pass image screen. | |
| 551 chromeos::LoginUtils::Get()->EnableBrowserLaunch(false); | |
| 552 ShowUserImageScreen(); | |
| 553 } | |
| 554 | |
| 555 void WizardController::OnLoginGuestUser() { | |
| 556 // We're on the stack, so don't try and delete us now. | |
| 557 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | |
| 558 } | |
| 559 | |
| 560 void WizardController::OnLoginCreateAccount() { | |
| 561 ShowAccountScreen(); | |
| 562 } | |
| 563 | |
| 564 void WizardController::OnNetworkConnected() { | 533 void WizardController::OnNetworkConnected() { |
| 565 if (is_official_build_) { | 534 if (is_official_build_) { |
| 566 if (!IsEulaAccepted()) { | 535 if (!IsEulaAccepted()) { |
| 567 ShowEulaScreen(); | 536 ShowEulaScreen(); |
| 568 } else { | 537 } else { |
| 569 // Possible cases: | 538 // Possible cases: |
| 570 // 1. EULA was accepted, forced shutdown/reboot during update. | 539 // 1. EULA was accepted, forced shutdown/reboot during update. |
| 571 // 2. EULA was accepted, planned reboot after update. | 540 // 2. EULA was accepted, planned reboot after update. |
| 572 // Make sure that device is up-to-date. | 541 // Make sure that device is up-to-date. |
| 573 InitiateOOBEUpdate(); | 542 InitiateOOBEUpdate(); |
| 574 } | 543 } |
| 575 } else { | 544 } else { |
| 576 InitiateOOBEUpdate(); | 545 InitiateOOBEUpdate(); |
| 577 } | 546 } |
| 578 } | 547 } |
| 579 | 548 |
| 580 void WizardController::OnNetworkOffline() { | 549 void WizardController::OnNetworkOffline() { |
| 581 // TODO(dpolukhin): if(is_out_of_box_) we cannot work offline and | 550 // TODO(dpolukhin): if(is_out_of_box_) we cannot work offline and |
| 582 // should report some error message here and stay on the same screen. | 551 // should report some error message here and stay on the same screen. |
| 583 ShowLoginScreen(); | 552 ShowLoginScreen(); |
| 584 } | 553 } |
| 585 | 554 |
| 586 void WizardController::OnAccountCreateBack() { | 555 void WizardController::OnAccountCreateBack() { |
| 587 chromeos::ExistingUserController* controller = ShowLoginScreen(); | 556 chromeos::ExistingUserController* controller = ShowLoginScreen(); |
| 588 if (controller) | 557 DCHECK(controller); |
| 589 controller->SelectNewUser(); | 558 controller->SelectNewUser(); |
| 590 } | 559 } |
| 591 | 560 |
| 592 void WizardController::OnAccountCreated() { | 561 void WizardController::OnAccountCreated() { |
| 593 chromeos::ExistingUserController* controller = ShowLoginScreen(); | 562 chromeos::ExistingUserController* controller = ShowLoginScreen(); |
| 594 if (controller) | 563 DCHECK(controller); |
| 595 controller->LoginNewUser(username_, password_); | 564 controller->LoginNewUser(username_, password_); |
| 596 else | |
| 597 Login(username_, password_); | |
| 598 // TODO(dpolukhin): clear password memory for real. Now it is not | 565 // TODO(dpolukhin): clear password memory for real. Now it is not |
| 599 // a problem because we can't extract password from the form. | 566 // a problem because we can't extract password from the form. |
| 600 password_.clear(); | 567 password_.clear(); |
| 601 } | 568 } |
| 602 | 569 |
| 603 void WizardController::OnConnectionFailed() { | 570 void WizardController::OnConnectionFailed() { |
| 604 // TODO(dpolukhin): show error message after login screen is displayed. | 571 // TODO(dpolukhin): show error message after login screen is displayed. |
| 605 ShowLoginScreen(); | 572 ShowLoginScreen(); |
| 606 } | 573 } |
| 607 | 574 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 757 // to WizardController it happens after screen is shown. | 724 // to WizardController it happens after screen is shown. |
| 758 if (background_view_) { | 725 if (background_view_) { |
| 759 background_view_->SetStatusAreaVisible(visible); | 726 background_view_->SetStatusAreaVisible(visible); |
| 760 } | 727 } |
| 761 } | 728 } |
| 762 | 729 |
| 763 void WizardController::ShowFirstScreen(const std::string& first_screen_name) { | 730 void WizardController::ShowFirstScreen(const std::string& first_screen_name) { |
| 764 if (first_screen_name == kNetworkScreenName) { | 731 if (first_screen_name == kNetworkScreenName) { |
| 765 ShowNetworkScreen(); | 732 ShowNetworkScreen(); |
| 766 } else if (first_screen_name == kLoginScreenName) { | 733 } else if (first_screen_name == kLoginScreenName) { |
| 767 // This flag is passed if we're running under automation test. | |
| 768 is_test_mode_ = true; | |
| 769 ShowLoginScreen(); | 734 ShowLoginScreen(); |
| 770 } else if (first_screen_name == kAccountScreenName) { | 735 } else if (first_screen_name == kAccountScreenName) { |
| 771 ShowAccountScreen(); | 736 ShowAccountScreen(); |
| 772 } else if (first_screen_name == kUpdateScreenName) { | 737 } else if (first_screen_name == kUpdateScreenName) { |
| 773 InitiateOOBEUpdate(); | 738 InitiateOOBEUpdate(); |
| 774 } else if (first_screen_name == kUserImageScreenName) { | 739 } else if (first_screen_name == kUserImageScreenName) { |
| 775 ShowUserImageScreen(); | 740 ShowUserImageScreen(); |
| 776 } else if (first_screen_name == kEulaScreenName) { | 741 } else if (first_screen_name == kEulaScreenName) { |
| 777 ShowEulaScreen(); | 742 ShowEulaScreen(); |
| 778 } else if (first_screen_name == kRegistrationScreenName) { | 743 } else if (first_screen_name == kRegistrationScreenName) { |
| 779 if (is_official_build_) { | 744 if (is_official_build_) { |
| 780 ShowRegistrationScreen(); | 745 ShowRegistrationScreen(); |
| 781 } else { | 746 } else { |
| 782 // Just proceed to image screen. | 747 // Just proceed to image screen. |
| 783 OnRegistrationSuccess(); | 748 OnRegistrationSuccess(); |
| 784 } | 749 } |
| 785 } else if (first_screen_name == kHTMLPageScreenName) { | 750 } else if (first_screen_name == kHTMLPageScreenName) { |
| 786 ShowHTMLPageScreen(); | 751 ShowHTMLPageScreen(); |
| 787 } else if (first_screen_name != kTestNoScreenName) { | 752 } else if (first_screen_name != kTestNoScreenName) { |
| 788 if (is_out_of_box_) { | 753 if (is_out_of_box_) { |
| 789 ShowNetworkScreen(); | 754 ShowNetworkScreen(); |
| 790 } else { | 755 } else { |
| 791 ShowLoginScreen(); | 756 ShowLoginScreen(); |
| 792 } | 757 } |
| 793 } | 758 } |
| 794 } | 759 } |
| 795 | 760 |
| 796 void WizardController::Login(const std::string& username, | |
| 797 const std::string& password) { | |
| 798 chromeos::LoginScreen* login = GetLoginScreen(); | |
| 799 if (username.empty()) | |
| 800 return; | |
| 801 login->view()->SetUsername(username); | |
| 802 | |
| 803 if (password.empty()) | |
| 804 return; | |
| 805 login->view()->SetPassword(password); | |
| 806 login->view()->Login(); | |
| 807 } | |
| 808 | |
| 809 // static | 761 // static |
| 810 bool WizardController::IsEulaAccepted() { | 762 bool WizardController::IsEulaAccepted() { |
| 811 return g_browser_process->local_state()->GetBoolean(kEulaAccepted); | 763 return g_browser_process->local_state()->GetBoolean(kEulaAccepted); |
| 812 } | 764 } |
| 813 | 765 |
| 814 // static | 766 // static |
| 815 bool WizardController::IsOobeCompleted() { | 767 bool WizardController::IsOobeCompleted() { |
| 816 return g_browser_process->local_state()->GetBoolean(kOobeComplete); | 768 return g_browser_process->local_state()->GetBoolean(kOobeComplete); |
| 817 } | 769 } |
| 818 | 770 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 842 else | 794 else |
| 843 manifest = LoadStartupManifest(); | 795 manifest = LoadStartupManifest(); |
| 844 return IsRegistrationScreenValid(manifest); | 796 return IsRegistrationScreenValid(manifest); |
| 845 } | 797 } |
| 846 | 798 |
| 847 // static | 799 // static |
| 848 void WizardController::MarkDeviceRegistered() { | 800 void WizardController::MarkDeviceRegistered() { |
| 849 // Create flag file for boot-time init scripts. | 801 // Create flag file for boot-time init scripts. |
| 850 FilePath oobe_complete_path(kOobeCompleteFlagFilePath); | 802 FilePath oobe_complete_path(kOobeCompleteFlagFilePath); |
| 851 FILE* oobe_flag_file = file_util::OpenFile(oobe_complete_path, "w+b"); | 803 FILE* oobe_flag_file = file_util::OpenFile(oobe_complete_path, "w+b"); |
| 852 DCHECK(oobe_flag_file != NULL) << kOobeCompleteFlagFilePath; | 804 if (oobe_flag_file == NULL) |
| 853 if (oobe_flag_file != NULL) | 805 DLOG(WARNING) << kOobeCompleteFlagFilePath << " doesn't exist."; |
| 806 else | |
| 854 file_util::CloseFile(oobe_flag_file); | 807 file_util::CloseFile(oobe_flag_file); |
| 855 } | 808 } |
| 856 | 809 |
| 810 // static | |
| 811 bool WizardController::IsAutomationTest() { | |
|
Dmitry Polukhin
2011/01/21 10:26:23
Please remove it and make appropriate check in Exi
whywhat
2011/01/25 08:24:00
Done.
| |
| 812 const CommandLine* const command_line = CommandLine::ForCurrentProcess(); | |
| 813 return command_line->GetSwitchValueASCII(switches::kLoginScreen) == | |
| 814 kLoginScreenName; | |
| 815 } | |
| 816 | |
| 857 /////////////////////////////////////////////////////////////////////////////// | 817 /////////////////////////////////////////////////////////////////////////////// |
| 858 // WizardController, chromeos::ScreenObserver overrides: | 818 // WizardController, chromeos::ScreenObserver overrides: |
| 859 void WizardController::OnExit(ExitCodes exit_code) { | 819 void WizardController::OnExit(ExitCodes exit_code) { |
| 860 LOG(INFO) << "Wizard screen exit code: " << exit_code; | 820 LOG(INFO) << "Wizard screen exit code: " << exit_code; |
| 861 switch (exit_code) { | 821 switch (exit_code) { |
| 862 case LOGIN_SIGN_IN_SELECTED: | |
| 863 OnLoginSignInSelected(); | |
| 864 break; | |
| 865 case LOGIN_GUEST_SELECTED: | |
| 866 OnLoginGuestUser(); | |
| 867 break; | |
| 868 case LOGIN_CREATE_ACCOUNT: | |
| 869 OnLoginCreateAccount(); | |
| 870 break; | |
| 871 case NETWORK_CONNECTED: | 822 case NETWORK_CONNECTED: |
| 872 OnNetworkConnected(); | 823 OnNetworkConnected(); |
| 873 break; | 824 break; |
| 874 case NETWORK_OFFLINE: | 825 case NETWORK_OFFLINE: |
| 875 OnNetworkOffline(); | 826 OnNetworkOffline(); |
| 876 break; | 827 break; |
| 877 case ACCOUNT_CREATE_BACK: | 828 case ACCOUNT_CREATE_BACK: |
| 878 OnAccountCreateBack(); | 829 OnAccountCreateBack(); |
| 879 break; | 830 break; |
| 880 case ACCOUNT_CREATED: | 831 case ACCOUNT_CREATED: |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 955 chromeos::language_prefs::kPreferredKeyboardLayout); | 906 chromeos::language_prefs::kPreferredKeyboardLayout); |
| 956 chromeos::input_method::EnableInputMethods( | 907 chromeos::input_method::EnableInputMethods( |
| 957 locale, chromeos::input_method::kKeyboardLayoutsOnly, | 908 locale, chromeos::input_method::kKeyboardLayoutsOnly, |
| 958 initial_input_method_id); | 909 initial_input_method_id); |
| 959 } | 910 } |
| 960 | 911 |
| 961 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(size)); | 912 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(size)); |
| 962 | 913 |
| 963 // Check whether we need to execute OOBE process. | 914 // Check whether we need to execute OOBE process. |
| 964 bool oobe_complete = WizardController::IsOobeCompleted(); | 915 bool oobe_complete = WizardController::IsOobeCompleted(); |
| 916 bool show_login_screen = | |
| 917 (first_screen_name.empty() && oobe_complete) || | |
| 918 first_screen_name == WizardController::kLoginScreenName; | |
| 965 | 919 |
| 966 if (first_screen_name.empty() && | 920 if (show_login_screen && chromeos::CrosLibrary::Get()->EnsureLoaded()) { |
| 967 oobe_complete && | |
| 968 chromeos::CrosLibrary::Get()->EnsureLoaded() && | |
| 969 CommandLine::ForCurrentProcess()->HasSwitch( | |
| 970 switches::kEnableLoginImages)) { | |
| 971 std::vector<chromeos::UserManager::User> users = | 921 std::vector<chromeos::UserManager::User> users = |
| 972 chromeos::UserManager::Get()->GetUsers(); | 922 chromeos::UserManager::Get()->GetUsers(); |
| 973 | 923 |
| 974 // Fix for users who updated device and thus never passed register screen. | 924 // Fix for users who updated device and thus never passed register screen. |
| 975 // If we already have user we assume that it is not a second part of OOBE. | 925 // If we already have users, we assume that it is not a second part of |
| 976 // See http://crosbug.com/6289 | 926 // OOBE. See http://crosbug.com/6289 |
| 977 if (!WizardController::IsDeviceRegistered() && !users.empty()) { | 927 if (!WizardController::IsDeviceRegistered() && !users.empty()) { |
| 978 VLOG(1) << "Mark device registered because there are remembered users: " | 928 VLOG(1) << "Mark device registered because there are remembered users: " |
| 979 << users.size(); | 929 << users.size(); |
| 980 WizardController::MarkDeviceRegistered(); | 930 WizardController::MarkDeviceRegistered(); |
| 981 } | 931 } |
| 982 | 932 |
| 983 // ExistingUserController deletes itself. | 933 // ExistingUserController deletes itself. |
| 984 (new chromeos::ExistingUserController(users, screen_bounds))->Init(); | 934 (new chromeos::ExistingUserController(users, screen_bounds))->Init(); |
| 985 | 935 |
| 986 // Initiate services customization. | 936 // Initiate services customization. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1037 // user has changed to during OOBE. | 987 // user has changed to during OOBE. |
| 1038 if (!timezone_name.empty()) { | 988 if (!timezone_name.empty()) { |
| 1039 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( | 989 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( |
| 1040 icu::UnicodeString::fromUTF8(timezone_name)); | 990 icu::UnicodeString::fromUTF8(timezone_name)); |
| 1041 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); | 991 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); |
| 1042 } | 992 } |
| 1043 } | 993 } |
| 1044 } | 994 } |
| 1045 | 995 |
| 1046 } // namespace browser | 996 } // namespace browser |
| OLD | NEW |