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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 } | 708 } |
709 | 709 |
710 ShowSetupUI(); | 710 ShowSetupUI(); |
711 } | 711 } |
712 | 712 |
713 // Private member functions. | 713 // Private member functions. |
714 | 714 |
715 bool SyncSetupHandler::FocusExistingWizard() { | 715 bool SyncSetupHandler::FocusExistingWizard() { |
716 Profile* profile = Profile::FromWebUI(web_ui_); | 716 Profile* profile = Profile::FromWebUI(web_ui_); |
717 ProfileSyncService* service = profile->GetProfileSyncService(); | 717 ProfileSyncService* service = profile->GetProfileSyncService(); |
718 DCHECK(service); | 718 if (!service) |
| 719 return false; |
| 720 |
719 // If the wizard is already visible, focus it. | 721 // If the wizard is already visible, focus it. |
720 if (service->get_wizard().IsVisible()) { | 722 if (service->get_wizard().IsVisible()) { |
721 service->get_wizard().Focus(); | 723 service->get_wizard().Focus(); |
722 return true; | 724 return true; |
723 } | 725 } |
724 return false; | 726 return false; |
725 } | 727 } |
726 | 728 |
727 void SyncSetupHandler::CloseOverlay() { | 729 void SyncSetupHandler::CloseOverlay() { |
728 web_ui_->CallJavascriptFunction("OptionsPage.closeOverlay"); | 730 web_ui_->CallJavascriptFunction("OptionsPage.closeOverlay"); |
(...skipping 27 matching lines...) Expand all Loading... |
756 } | 758 } |
757 | 759 |
758 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { | 760 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { |
759 DictionaryValue args; | 761 DictionaryValue args; |
760 Profile* profile = Profile::FromWebUI(web_ui_); | 762 Profile* profile = Profile::FromWebUI(web_ui_); |
761 ProfileSyncService* service = profile->GetProfileSyncService(); | 763 ProfileSyncService* service = profile->GetProfileSyncService(); |
762 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); | 764 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); |
763 args.SetString("error_message", error_message); | 765 args.SetString("error_message", error_message); |
764 ShowGaiaLogin(args); | 766 ShowGaiaLogin(args); |
765 } | 767 } |
OLD | NEW |