| 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 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/chromeos/cros/login_library.h" | 21 #include "chrome/browser/chromeos/cros/login_library.h" |
| 22 #include "chrome/browser/chromeos/cros/system_library.h" | 22 #include "chrome/browser/chromeos/cros/system_library.h" |
| 23 #include "chrome/browser/chromeos/customization_document.h" | 23 #include "chrome/browser/chromeos/customization_document.h" |
| 24 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 24 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 25 #include "chrome/browser/chromeos/login/account_screen.h" | 25 #include "chrome/browser/chromeos/login/account_screen.h" |
| 26 #include "chrome/browser/chromeos/login/apply_services_customization.h" | 26 #include "chrome/browser/chromeos/login/apply_services_customization.h" |
| 27 #include "chrome/browser/chromeos/login/background_view.h" | 27 #include "chrome/browser/chromeos/login/background_view.h" |
| 28 #include "chrome/browser/chromeos/login/eula_view.h" | 28 #include "chrome/browser/chromeos/login/eula_view.h" |
| 29 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 29 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 30 #include "chrome/browser/chromeos/login/helper.h" | 30 #include "chrome/browser/chromeos/login/helper.h" |
| 31 #include "chrome/browser/chromeos/login/html_page_screen.h" |
| 31 #include "chrome/browser/chromeos/login/language_switch_menu.h" | 32 #include "chrome/browser/chromeos/login/language_switch_menu.h" |
| 32 #include "chrome/browser/chromeos/login/login_screen.h" | 33 #include "chrome/browser/chromeos/login/login_screen.h" |
| 33 #include "chrome/browser/chromeos/login/login_utils.h" | 34 #include "chrome/browser/chromeos/login/login_utils.h" |
| 34 #include "chrome/browser/chromeos/login/network_screen.h" | 35 #include "chrome/browser/chromeos/login/network_screen.h" |
| 35 #include "chrome/browser/chromeos/login/registration_screen.h" | 36 #include "chrome/browser/chromeos/login/registration_screen.h" |
| 36 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 37 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
| 37 #include "chrome/browser/chromeos/login/update_screen.h" | 38 #include "chrome/browser/chromeos/login/update_screen.h" |
| 38 #include "chrome/browser/chromeos/login/user_image_screen.h" | 39 #include "chrome/browser/chromeos/login/user_image_screen.h" |
| 39 #include "chrome/browser/chromeos/login/user_manager.h" | 40 #include "chrome/browser/chromeos/login/user_manager.h" |
| 40 #include "chrome/browser/chromeos/language_preferences.h" | 41 #include "chrome/browser/chromeos/language_preferences.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 204 |
| 204 } // namespace | 205 } // namespace |
| 205 | 206 |
| 206 const char WizardController::kNetworkScreenName[] = "network"; | 207 const char WizardController::kNetworkScreenName[] = "network"; |
| 207 const char WizardController::kLoginScreenName[] = "login"; | 208 const char WizardController::kLoginScreenName[] = "login"; |
| 208 const char WizardController::kAccountScreenName[] = "account"; | 209 const char WizardController::kAccountScreenName[] = "account"; |
| 209 const char WizardController::kUpdateScreenName[] = "update"; | 210 const char WizardController::kUpdateScreenName[] = "update"; |
| 210 const char WizardController::kUserImageScreenName[] = "image"; | 211 const char WizardController::kUserImageScreenName[] = "image"; |
| 211 const char WizardController::kEulaScreenName[] = "eula"; | 212 const char WizardController::kEulaScreenName[] = "eula"; |
| 212 const char WizardController::kRegistrationScreenName[] = "register"; | 213 const char WizardController::kRegistrationScreenName[] = "register"; |
| 214 const char WizardController::kHTMLPageScreenName[] = "html"; |
| 213 | 215 |
| 214 // Passing this parameter as a "first screen" initiates full OOBE flow. | 216 // Passing this parameter as a "first screen" initiates full OOBE flow. |
| 215 const char WizardController::kOutOfBoxScreenName[] = "oobe"; | 217 const char WizardController::kOutOfBoxScreenName[] = "oobe"; |
| 216 | 218 |
| 217 // Special test value that commands not to create any window yet. | 219 // Special test value that commands not to create any window yet. |
| 218 const char WizardController::kTestNoScreenName[] = "test:nowindow"; | 220 const char WizardController::kTestNoScreenName[] = "test:nowindow"; |
| 219 | 221 |
| 220 // Initialize default controller. | 222 // Initialize default controller. |
| 221 // static | 223 // static |
| 222 WizardController* WizardController::default_controller_ = NULL; | 224 WizardController* WizardController::default_controller_ = NULL; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 eula_screen_.reset(new chromeos::EulaScreen(this)); | 360 eula_screen_.reset(new chromeos::EulaScreen(this)); |
| 359 return eula_screen_.get(); | 361 return eula_screen_.get(); |
| 360 } | 362 } |
| 361 | 363 |
| 362 chromeos::RegistrationScreen* WizardController::GetRegistrationScreen() { | 364 chromeos::RegistrationScreen* WizardController::GetRegistrationScreen() { |
| 363 if (!registration_screen_.get()) | 365 if (!registration_screen_.get()) |
| 364 registration_screen_.reset(new chromeos::RegistrationScreen(this)); | 366 registration_screen_.reset(new chromeos::RegistrationScreen(this)); |
| 365 return registration_screen_.get(); | 367 return registration_screen_.get(); |
| 366 } | 368 } |
| 367 | 369 |
| 370 chromeos::HTMLPageScreen* WizardController::GetHTMLPageScreen() { |
| 371 if (!html_page_screen_.get()) { |
| 372 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 373 std::string url; |
| 374 // It's strange but args may contains empty strings. |
| 375 for (size_t i = 0; i < command_line->args().size(); i++) { |
| 376 if (!command_line->args()[i].empty()) { |
| 377 DCHECK(url.empty()) << "More than one URL in command line"; |
| 378 url = command_line->args()[i]; |
| 379 } |
| 380 } |
| 381 DCHECK(!url.empty()) << "No URL in commane line"; |
| 382 html_page_screen_.reset(new chromeos::HTMLPageScreen(this, url)); |
| 383 } |
| 384 return html_page_screen_.get(); |
| 385 } |
| 386 |
| 368 void WizardController::ShowNetworkScreen() { | 387 void WizardController::ShowNetworkScreen() { |
| 369 SetStatusAreaVisible(false); | 388 SetStatusAreaVisible(false); |
| 370 SetCurrentScreen(GetNetworkScreen()); | 389 SetCurrentScreen(GetNetworkScreen()); |
| 371 background_view_->SetOobeProgress(chromeos::BackgroundView::SELECT_NETWORK); | 390 background_view_->SetOobeProgress(chromeos::BackgroundView::SELECT_NETWORK); |
| 372 } | 391 } |
| 373 | 392 |
| 374 chromeos::ExistingUserController* WizardController::ShowLoginScreen() { | 393 chromeos::ExistingUserController* WizardController::ShowLoginScreen() { |
| 375 SetStatusAreaVisible(true); | 394 SetStatusAreaVisible(true); |
| 376 background_view_->SetOobeProgress(chromeos::BackgroundView::SIGNIN); | 395 background_view_->SetOobeProgress(chromeos::BackgroundView::SIGNIN); |
| 377 | 396 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 455 |
| 437 void WizardController::ShowRegistrationScreen() { | 456 void WizardController::ShowRegistrationScreen() { |
| 438 LOG(INFO) << "Showing registration screen."; | 457 LOG(INFO) << "Showing registration screen."; |
| 439 SetStatusAreaVisible(true); | 458 SetStatusAreaVisible(true); |
| 440 SetCurrentScreen(GetRegistrationScreen()); | 459 SetCurrentScreen(GetRegistrationScreen()); |
| 441 #if defined(OFFICIAL_BUILD) | 460 #if defined(OFFICIAL_BUILD) |
| 442 background_view_->SetOobeProgress(chromeos::BackgroundView::REGISTRATION); | 461 background_view_->SetOobeProgress(chromeos::BackgroundView::REGISTRATION); |
| 443 #endif | 462 #endif |
| 444 } | 463 } |
| 445 | 464 |
| 465 void WizardController::ShowHTMLPageScreen() { |
| 466 LOG(INFO) << "Showing HTML page screen."; |
| 467 SetStatusAreaVisible(true); |
| 468 background_view_->SetOobeProgressBarVisible(false); |
| 469 SetCurrentScreen(GetHTMLPageScreen()); |
| 470 } |
| 471 |
| 446 void WizardController::SetStatusAreaVisible(bool visible) { | 472 void WizardController::SetStatusAreaVisible(bool visible) { |
| 447 // When ExistingUserController passes background ownership | 473 // When ExistingUserController passes background ownership |
| 448 // to WizardController it happens after screen is shown. | 474 // to WizardController it happens after screen is shown. |
| 449 if (background_view_) { | 475 if (background_view_) { |
| 450 background_view_->SetStatusAreaVisible(visible); | 476 background_view_->SetStatusAreaVisible(visible); |
| 451 } | 477 } |
| 452 } | 478 } |
| 453 | 479 |
| 454 void WizardController::SetCustomization( | 480 void WizardController::SetCustomization( |
| 455 const chromeos::StartupCustomizationDocument* customization) { | 481 const chromeos::StartupCustomizationDocument* customization) { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 ShowUserImageScreen(); | 659 ShowUserImageScreen(); |
| 634 } else if (first_screen_name == kEulaScreenName) { | 660 } else if (first_screen_name == kEulaScreenName) { |
| 635 ShowEulaScreen(); | 661 ShowEulaScreen(); |
| 636 } else if (first_screen_name == kRegistrationScreenName) { | 662 } else if (first_screen_name == kRegistrationScreenName) { |
| 637 if (is_official_build_) { | 663 if (is_official_build_) { |
| 638 ShowRegistrationScreen(); | 664 ShowRegistrationScreen(); |
| 639 } else { | 665 } else { |
| 640 // Just proceed to image screen. | 666 // Just proceed to image screen. |
| 641 OnRegistrationSuccess(); | 667 OnRegistrationSuccess(); |
| 642 } | 668 } |
| 669 } else if (first_screen_name == kHTMLPageScreenName) { |
| 670 ShowHTMLPageScreen(); |
| 643 } else if (first_screen_name != kTestNoScreenName) { | 671 } else if (first_screen_name != kTestNoScreenName) { |
| 644 if (is_out_of_box_) { | 672 if (is_out_of_box_) { |
| 645 ShowNetworkScreen(); | 673 ShowNetworkScreen(); |
| 646 } else { | 674 } else { |
| 647 ShowLoginScreen(); | 675 ShowLoginScreen(); |
| 648 } | 676 } |
| 649 } | 677 } |
| 650 } | 678 } |
| 651 | 679 |
| 652 void WizardController::MarkOobeCompleted() { | 680 void WizardController::MarkOobeCompleted() { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 // user has changed to during OOBE. | 862 // user has changed to during OOBE. |
| 835 if (!timezone_name.empty()) { | 863 if (!timezone_name.empty()) { |
| 836 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( | 864 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( |
| 837 icu::UnicodeString::fromUTF8(timezone_name)); | 865 icu::UnicodeString::fromUTF8(timezone_name)); |
| 838 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); | 866 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); |
| 839 } | 867 } |
| 840 } | 868 } |
| 841 } | 869 } |
| 842 | 870 |
| 843 } // namespace browser | 871 } // namespace browser |
| OLD | NEW |