OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/sync_setup_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 | 674 |
675 service->ShowErrorUI(); | 675 service->ShowErrorUI(); |
676 } | 676 } |
677 | 677 |
678 void SyncSetupHandler::HandleShowSetupUI(const ListValue* args) { | 678 void SyncSetupHandler::HandleShowSetupUI(const ListValue* args) { |
679 DCHECK(!flow_); | 679 DCHECK(!flow_); |
680 if (FocusExistingWizard()) { | 680 if (FocusExistingWizard()) { |
681 CloseOverlay(); | 681 CloseOverlay(); |
682 return; | 682 return; |
683 } | 683 } |
| 684 |
| 685 StepWizardForShowSetupUI(); |
684 ShowSetupUI(); | 686 ShowSetupUI(); |
685 } | 687 } |
686 | 688 |
687 void SyncSetupHandler::CloseSyncSetup() { | 689 void SyncSetupHandler::CloseSyncSetup() { |
688 if (flow_) { | 690 if (flow_) { |
689 flow_->OnDialogClosed(std::string()); | 691 flow_->OnDialogClosed(std::string()); |
690 flow_ = NULL; | 692 flow_ = NULL; |
691 } | 693 } |
692 } | 694 } |
693 | 695 |
(...skipping 11 matching lines...) Expand all Loading... |
705 return; | 707 return; |
706 } | 708 } |
707 | 709 |
708 // If the wizard is already visible, it must be attached to another flow | 710 // If the wizard is already visible, it must be attached to another flow |
709 // handler. | 711 // handler. |
710 if (FocusExistingWizard()) { | 712 if (FocusExistingWizard()) { |
711 CloseOverlay(); | 713 CloseOverlay(); |
712 return; | 714 return; |
713 } | 715 } |
714 | 716 |
| 717 // The wizard must be stepped before attaching. Allow subclasses to step the |
| 718 // wizard to appropriate state. |
| 719 StepWizardForShowSetupUI(); |
| 720 |
715 // Attach this as the sync setup handler, before calling ShowSetupUI(). | 721 // Attach this as the sync setup handler, before calling ShowSetupUI(). |
716 if (!service->get_wizard().AttachSyncSetupHandler(this)) { | 722 if (!service->get_wizard().AttachSyncSetupHandler(this)) { |
717 LOG(ERROR) << "SyncSetupHandler attach failed!"; | 723 LOG(ERROR) << "SyncSetupHandler attach failed!"; |
718 CloseOverlay(); | 724 CloseOverlay(); |
719 return; | 725 return; |
720 } | 726 } |
721 | 727 |
722 ShowSetupUI(); | 728 ShowSetupUI(); |
723 } | 729 } |
724 | 730 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 } | 776 } |
771 | 777 |
772 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { | 778 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { |
773 DictionaryValue args; | 779 DictionaryValue args; |
774 Profile* profile = Profile::FromWebUI(web_ui_); | 780 Profile* profile = Profile::FromWebUI(web_ui_); |
775 ProfileSyncService* service = profile->GetProfileSyncService(); | 781 ProfileSyncService* service = profile->GetProfileSyncService(); |
776 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); | 782 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); |
777 args.SetString("error_message", error_message); | 783 args.SetString("error_message", error_message); |
778 ShowGaiaLogin(args); | 784 ShowGaiaLogin(args); |
779 } | 785 } |
OLD | NEW |