| 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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 OpenSyncSetup(); | 629 OpenSyncSetup(); |
| 630 } | 630 } |
| 631 | 631 |
| 632 void SyncSetupHandler::HandleShowErrorUI(const ListValue* args) { | 632 void SyncSetupHandler::HandleShowErrorUI(const ListValue* args) { |
| 633 DCHECK(!flow_); | 633 DCHECK(!flow_); |
| 634 | 634 |
| 635 Profile* profile = Profile::FromWebUI(web_ui_); | 635 Profile* profile = Profile::FromWebUI(web_ui_); |
| 636 ProfileSyncService* service = profile->GetProfileSyncService(); | 636 ProfileSyncService* service = profile->GetProfileSyncService(); |
| 637 DCHECK(service); | 637 DCHECK(service); |
| 638 | 638 |
| 639 service->get_wizard().Step(SyncSetupWizard::NONFATAL_ERROR); | 639 service->ShowErrorUI(); |
| 640 | |
| 641 // Show the Sync Setup page. | |
| 642 if (service->get_wizard().IsVisible()) { | |
| 643 service->get_wizard().Focus(); | |
| 644 } else { | |
| 645 StringValue page("syncSetup"); | |
| 646 web_ui_->CallJavascriptFunction("OptionsPage.navigateToPage", page); | |
| 647 } | |
| 648 } | 640 } |
| 649 | 641 |
| 650 void SyncSetupHandler::HandleShowSetupUI(const ListValue* args) { | 642 void SyncSetupHandler::HandleShowSetupUI(const ListValue* args) { |
| 651 DCHECK(!flow_); | 643 DCHECK(!flow_); |
| 652 if (FocusExistingWizard()) { | 644 if (FocusExistingWizard()) { |
| 653 CloseOverlay(); | 645 CloseOverlay(); |
| 654 return; | 646 return; |
| 655 } | 647 } |
| 656 ShowSetupUI(); | 648 ShowSetupUI(); |
| 657 } | 649 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 } | 732 } |
| 741 | 733 |
| 742 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { | 734 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { |
| 743 DictionaryValue args; | 735 DictionaryValue args; |
| 744 Profile* profile = Profile::FromWebUI(web_ui_); | 736 Profile* profile = Profile::FromWebUI(web_ui_); |
| 745 ProfileSyncService* service = profile->GetProfileSyncService(); | 737 ProfileSyncService* service = profile->GetProfileSyncService(); |
| 746 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); | 738 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); |
| 747 args.SetString("error_message", error_message); | 739 args.SetString("error_message", error_message); |
| 748 ShowGaiaLogin(args); | 740 ShowGaiaLogin(args); |
| 749 } | 741 } |
| OLD | NEW |