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/sync/sync_setup_flow.h" | 5 #include "chrome/browser/sync/sync_setup_flow.h" |
6 | 6 |
7 #include "app/gfx/font_util.h" | 7 #include "app/gfx/font_util.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 switch (state) { | 458 switch (state) { |
459 case SyncSetupWizard::GAIA_LOGIN: | 459 case SyncSetupWizard::GAIA_LOGIN: |
460 return current_state_ == SyncSetupWizard::FATAL_ERROR || | 460 return current_state_ == SyncSetupWizard::FATAL_ERROR || |
461 current_state_ == SyncSetupWizard::GAIA_LOGIN; | 461 current_state_ == SyncSetupWizard::GAIA_LOGIN; |
462 case SyncSetupWizard::GAIA_SUCCESS: | 462 case SyncSetupWizard::GAIA_SUCCESS: |
463 return current_state_ == SyncSetupWizard::GAIA_LOGIN; | 463 return current_state_ == SyncSetupWizard::GAIA_LOGIN; |
464 case SyncSetupWizard::CONFIGURE: | 464 case SyncSetupWizard::CONFIGURE: |
465 return current_state_ == SyncSetupWizard::GAIA_SUCCESS; | 465 return current_state_ == SyncSetupWizard::GAIA_SUCCESS; |
466 case SyncSetupWizard::CREATE_PASSPHRASE: | 466 case SyncSetupWizard::CREATE_PASSPHRASE: |
467 return current_state_ == SyncSetupWizard::CONFIGURE; | 467 return current_state_ == SyncSetupWizard::CONFIGURE; |
| 468 case SyncSetupWizard::ENTER_PASSPHRASE: |
| 469 return current_state_ == SyncSetupWizard::CONFIGURE || |
| 470 current_state_ == SyncSetupWizard::SETTING_UP; |
468 case SyncSetupWizard::SETUP_ABORTED_BY_PENDING_CLEAR: | 471 case SyncSetupWizard::SETUP_ABORTED_BY_PENDING_CLEAR: |
469 return current_state_ == SyncSetupWizard::CONFIGURE; | 472 return current_state_ == SyncSetupWizard::CONFIGURE; |
470 case SyncSetupWizard::SETTING_UP: | 473 case SyncSetupWizard::SETTING_UP: |
471 return current_state_ == SyncSetupWizard::CONFIGURE || | 474 return current_state_ == SyncSetupWizard::CONFIGURE || |
472 current_state_ == SyncSetupWizard::CREATE_PASSPHRASE; | 475 current_state_ == SyncSetupWizard::CREATE_PASSPHRASE || |
| 476 current_state_ == SyncSetupWizard::ENTER_PASSPHRASE; |
473 case SyncSetupWizard::FATAL_ERROR: | 477 case SyncSetupWizard::FATAL_ERROR: |
474 return true; // You can always hit the panic button. | 478 return true; // You can always hit the panic button. |
475 case SyncSetupWizard::DONE_FIRST_TIME: | 479 case SyncSetupWizard::DONE_FIRST_TIME: |
476 case SyncSetupWizard::DONE: | 480 case SyncSetupWizard::DONE: |
477 return current_state_ == SyncSetupWizard::SETTING_UP; | 481 return current_state_ == SyncSetupWizard::SETTING_UP || |
| 482 current_state_ == SyncSetupWizard::ENTER_PASSPHRASE; |
478 default: | 483 default: |
479 NOTREACHED() << "Unhandled State: " << state; | 484 NOTREACHED() << "Unhandled State: " << state; |
480 return false; | 485 return false; |
481 } | 486 } |
482 } | 487 } |
483 | 488 |
484 void SyncSetupFlow::Advance(SyncSetupWizard::State advance_state) { | 489 void SyncSetupFlow::Advance(SyncSetupWizard::State advance_state) { |
485 if (!ShouldAdvance(advance_state)) { | 490 if (!ShouldAdvance(advance_state)) { |
486 LOG(WARNING) << "Invalid state change from " | 491 LOG(WARNING) << "Invalid state change from " |
487 << current_state_ << " to " << advance_state; | 492 << current_state_ << " to " << advance_state; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 !service_->IsUsingSecondaryPassphrase()) | 652 !service_->IsUsingSecondaryPassphrase()) |
648 service_->SetSecondaryPassphrase(configuration_.secondary_passphrase); | 653 service_->SetSecondaryPassphrase(configuration_.secondary_passphrase); |
649 | 654 |
650 service_->OnUserChoseDatatypes(configuration_.sync_everything, | 655 service_->OnUserChoseDatatypes(configuration_.sync_everything, |
651 configuration_.data_types); | 656 configuration_.data_types); |
652 | 657 |
653 configuration_pending_ = false; | 658 configuration_pending_ = false; |
654 } | 659 } |
655 | 660 |
656 void SyncSetupFlow::OnPassphraseEntry(const std::string& passphrase) { | 661 void SyncSetupFlow::OnPassphraseEntry(const std::string& passphrase) { |
657 if (configuration_pending_) { | 662 if (current_state_ == SyncSetupWizard::ENTER_PASSPHRASE) { |
| 663 service_->SetSecondaryPassphrase(passphrase); |
| 664 Advance(SyncSetupWizard::SETTING_UP); |
| 665 } else if (configuration_pending_) { |
658 configuration_.secondary_passphrase = passphrase; | 666 configuration_.secondary_passphrase = passphrase; |
659 OnConfigurationComplete(); | 667 OnConfigurationComplete(); |
660 } | 668 } |
661 } | 669 } |
OLD | NEW |