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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 221 |
222 /////////////////////////////////////////////////////////////////////////////// | 222 /////////////////////////////////////////////////////////////////////////////// |
223 // WizardController, public: | 223 // WizardController, public: |
224 | 224 |
225 WizardController::WizardController() | 225 WizardController::WizardController() |
226 : widget_(NULL), | 226 : widget_(NULL), |
227 background_widget_(NULL), | 227 background_widget_(NULL), |
228 background_view_(NULL), | 228 background_view_(NULL), |
229 contents_(NULL), | 229 contents_(NULL), |
230 current_screen_(NULL), | 230 current_screen_(NULL), |
| 231 #if defined(OFFICIAL_BUILD) |
| 232 is_official_build_(true), |
| 233 #else |
| 234 is_official_build_(false), |
| 235 #endif |
231 is_out_of_box_(false), | 236 is_out_of_box_(false), |
232 is_test_mode_(false), | 237 is_test_mode_(false), |
233 observer_(NULL) { | 238 observer_(NULL) { |
234 DCHECK(default_controller_ == NULL); | 239 DCHECK(default_controller_ == NULL); |
235 default_controller_ = this; | 240 default_controller_ = this; |
236 } | 241 } |
237 | 242 |
238 WizardController::~WizardController() { | 243 WizardController::~WizardController() { |
239 // Close ends up deleting the widget. | 244 // Close ends up deleting the widget. |
240 if (background_widget_) | 245 if (background_widget_) |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 LOG(INFO) << "Showing user image screen."; | 420 LOG(INFO) << "Showing user image screen."; |
416 SetStatusAreaVisible(true); | 421 SetStatusAreaVisible(true); |
417 SetCurrentScreen(GetUserImageScreen()); | 422 SetCurrentScreen(GetUserImageScreen()); |
418 background_view_->SetOobeProgress(chromeos::BackgroundView::PICTURE); | 423 background_view_->SetOobeProgress(chromeos::BackgroundView::PICTURE); |
419 } | 424 } |
420 | 425 |
421 void WizardController::ShowEulaScreen() { | 426 void WizardController::ShowEulaScreen() { |
422 LOG(INFO) << "Showing EULA screen."; | 427 LOG(INFO) << "Showing EULA screen."; |
423 SetStatusAreaVisible(false); | 428 SetStatusAreaVisible(false); |
424 SetCurrentScreen(GetEulaScreen()); | 429 SetCurrentScreen(GetEulaScreen()); |
| 430 #if defined(OFFICIAL_BUILD) |
425 background_view_->SetOobeProgress(chromeos::BackgroundView::EULA); | 431 background_view_->SetOobeProgress(chromeos::BackgroundView::EULA); |
| 432 #endif |
426 } | 433 } |
427 | 434 |
428 void WizardController::ShowRegistrationScreen() { | 435 void WizardController::ShowRegistrationScreen() { |
429 LOG(INFO) << "Showing registration screen."; | 436 LOG(INFO) << "Showing registration screen."; |
430 SetStatusAreaVisible(true); | 437 SetStatusAreaVisible(true); |
431 SetCurrentScreen(GetRegistrationScreen()); | 438 SetCurrentScreen(GetRegistrationScreen()); |
| 439 #if defined(OFFICIAL_BUILD) |
432 background_view_->SetOobeProgress(chromeos::BackgroundView::REGISTRATION); | 440 background_view_->SetOobeProgress(chromeos::BackgroundView::REGISTRATION); |
| 441 #endif |
433 } | 442 } |
434 | 443 |
435 void WizardController::SetStatusAreaVisible(bool visible) { | 444 void WizardController::SetStatusAreaVisible(bool visible) { |
436 // When ExistingUserController passes background ownership | 445 // When ExistingUserController passes background ownership |
437 // to WizardController it happens after screen is shown. | 446 // to WizardController it happens after screen is shown. |
438 if (background_view_) { | 447 if (background_view_) { |
439 background_view_->SetStatusAreaVisible(visible); | 448 background_view_->SetStatusAreaVisible(visible); |
440 } | 449 } |
441 } | 450 } |
442 | 451 |
(...skipping 28 matching lines...) Expand all Loading... |
471 void WizardController::OnLoginGuestUser() { | 480 void WizardController::OnLoginGuestUser() { |
472 // We're on the stack, so don't try and delete us now. | 481 // We're on the stack, so don't try and delete us now. |
473 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 482 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
474 } | 483 } |
475 | 484 |
476 void WizardController::OnLoginCreateAccount() { | 485 void WizardController::OnLoginCreateAccount() { |
477 ShowAccountScreen(); | 486 ShowAccountScreen(); |
478 } | 487 } |
479 | 488 |
480 void WizardController::OnNetworkConnected() { | 489 void WizardController::OnNetworkConnected() { |
481 if (is_out_of_box_) { | 490 if (is_official_build_) { |
482 ShowUpdateScreen(); | 491 ShowUpdateScreen(); |
483 GetUpdateScreen()->StartUpdate(); | 492 GetUpdateScreen()->StartUpdate(); |
484 } else { | 493 } else { |
485 // TODO(nkostylev): Remove this path after accelerator is removed. | 494 OnOOBECompleted(); |
486 ShowLoginScreen(); | |
487 } | 495 } |
488 } | 496 } |
489 | 497 |
490 void WizardController::OnNetworkOffline() { | 498 void WizardController::OnNetworkOffline() { |
491 // TODO(dpolukhin): if(is_out_of_box_) we cannot work offline and | 499 // TODO(dpolukhin): if(is_out_of_box_) we cannot work offline and |
492 // should report some error message here and stay on the same screen. | 500 // should report some error message here and stay on the same screen. |
493 ShowLoginScreen(); | 501 ShowLoginScreen(); |
494 } | 502 } |
495 | 503 |
496 void WizardController::OnAccountCreateBack() { | 504 void WizardController::OnAccountCreateBack() { |
(...skipping 29 matching lines...) Expand all Loading... |
526 void WizardController::OnConnectionFailed() { | 534 void WizardController::OnConnectionFailed() { |
527 // TODO(dpolukhin): show error message after login screen is displayed. | 535 // TODO(dpolukhin): show error message after login screen is displayed. |
528 ShowLoginScreen(); | 536 ShowLoginScreen(); |
529 } | 537 } |
530 | 538 |
531 void WizardController::OnUpdateCompleted() { | 539 void WizardController::OnUpdateCompleted() { |
532 ShowEulaScreen(); | 540 ShowEulaScreen(); |
533 } | 541 } |
534 | 542 |
535 void WizardController::OnEulaAccepted() { | 543 void WizardController::OnEulaAccepted() { |
536 MarkOobeCompleted(); | 544 OnOOBECompleted(); |
537 ShowLoginScreen(); | |
538 } | 545 } |
539 | 546 |
540 void WizardController::OnUpdateErrorCheckingForUpdate() { | 547 void WizardController::OnUpdateErrorCheckingForUpdate() { |
541 // TODO(nkostylev): Update should be required during OOBE. | 548 // TODO(nkostylev): Update should be required during OOBE. |
542 // We do not want to block users from being able to proceed to the login | 549 // We do not want to block users from being able to proceed to the login |
543 // screen if there is any error checking for an update. | 550 // screen if there is any error checking for an update. |
544 // They could use "browse without sign-in" feature to set up the network to be | 551 // They could use "browse without sign-in" feature to set up the network to be |
545 // able to perform the update later. | 552 // able to perform the update later. |
546 ShowEulaScreen(); | 553 ShowEulaScreen(); |
547 } | 554 } |
(...skipping 26 matching lines...) Expand all Loading... |
574 void WizardController::OnRegistrationSuccess() { | 581 void WizardController::OnRegistrationSuccess() { |
575 MarkDeviceRegistered(); | 582 MarkDeviceRegistered(); |
576 ShowUserImageScreen(); | 583 ShowUserImageScreen(); |
577 } | 584 } |
578 | 585 |
579 void WizardController::OnRegistrationSkipped() { | 586 void WizardController::OnRegistrationSkipped() { |
580 // TODO(nkostylev): Track in a histogram? | 587 // TODO(nkostylev): Track in a histogram? |
581 OnRegistrationSuccess(); | 588 OnRegistrationSuccess(); |
582 } | 589 } |
583 | 590 |
| 591 void WizardController::OnOOBECompleted() { |
| 592 MarkOobeCompleted(); |
| 593 ShowLoginScreen(); |
| 594 } |
| 595 |
584 /////////////////////////////////////////////////////////////////////////////// | 596 /////////////////////////////////////////////////////////////////////////////// |
585 // WizardController, private: | 597 // WizardController, private: |
586 | 598 |
587 void WizardController::SetCurrentScreen(WizardScreen* new_current) { | 599 void WizardController::SetCurrentScreen(WizardScreen* new_current) { |
588 if (current_screen_ == new_current) | 600 if (current_screen_ == new_current) |
589 return; | 601 return; |
590 if (current_screen_) | 602 if (current_screen_) |
591 current_screen_->Hide(); | 603 current_screen_->Hide(); |
592 current_screen_ = new_current; | 604 current_screen_ = new_current; |
593 if (current_screen_) { | 605 if (current_screen_) { |
(...skipping 19 matching lines...) Expand all Loading... |
613 } else if (first_screen_name == kAccountScreenName) { | 625 } else if (first_screen_name == kAccountScreenName) { |
614 ShowAccountScreen(); | 626 ShowAccountScreen(); |
615 } else if (first_screen_name == kUpdateScreenName) { | 627 } else if (first_screen_name == kUpdateScreenName) { |
616 ShowUpdateScreen(); | 628 ShowUpdateScreen(); |
617 GetUpdateScreen()->StartUpdate(); | 629 GetUpdateScreen()->StartUpdate(); |
618 } else if (first_screen_name == kUserImageScreenName) { | 630 } else if (first_screen_name == kUserImageScreenName) { |
619 ShowUserImageScreen(); | 631 ShowUserImageScreen(); |
620 } else if (first_screen_name == kEulaScreenName) { | 632 } else if (first_screen_name == kEulaScreenName) { |
621 ShowEulaScreen(); | 633 ShowEulaScreen(); |
622 } else if (first_screen_name == kRegistrationScreenName) { | 634 } else if (first_screen_name == kRegistrationScreenName) { |
623 ShowRegistrationScreen(); | 635 if (is_official_build_) { |
| 636 ShowRegistrationScreen(); |
| 637 } else { |
| 638 // Just proceed to image screen. |
| 639 OnRegistrationSuccess(); |
| 640 } |
624 } else if (first_screen_name != kTestNoScreenName) { | 641 } else if (first_screen_name != kTestNoScreenName) { |
625 if (is_out_of_box_) { | 642 if (is_out_of_box_) { |
626 ShowNetworkScreen(); | 643 ShowNetworkScreen(); |
627 } else { | 644 } else { |
628 ShowLoginScreen(); | 645 ShowLoginScreen(); |
629 } | 646 } |
630 } | 647 } |
631 } | 648 } |
632 | 649 |
633 void WizardController::MarkOobeCompleted() { | 650 void WizardController::MarkOobeCompleted() { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 // user has changed to during OOBE. | 832 // user has changed to during OOBE. |
816 if (!timezone_name.empty()) { | 833 if (!timezone_name.empty()) { |
817 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( | 834 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( |
818 icu::UnicodeString::fromUTF8(timezone_name)); | 835 icu::UnicodeString::fromUTF8(timezone_name)); |
819 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); | 836 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); |
820 } | 837 } |
821 } | 838 } |
822 } | 839 } |
823 | 840 |
824 } // namespace browser | 841 } // namespace browser |
OLD | NEW |