Chromium Code Reviews| 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 696 } | 696 } |
| 697 | 697 |
| 698 ShowSetupUI(); | 698 ShowSetupUI(); |
| 699 } | 699 } |
| 700 | 700 |
| 701 // Private member functions. | 701 // Private member functions. |
| 702 | 702 |
| 703 bool SyncSetupHandler::FocusExistingWizard() { | 703 bool SyncSetupHandler::FocusExistingWizard() { |
| 704 Profile* profile = Profile::FromWebUI(web_ui_); | 704 Profile* profile = Profile::FromWebUI(web_ui_); |
| 705 ProfileSyncService* service = profile->GetProfileSyncService(); | 705 ProfileSyncService* service = profile->GetProfileSyncService(); |
| 706 DCHECK(service); | 706 if (!service) |
|
James Hawkins
2011/11/17 02:23:53
When is |service| NULL?
binji
2011/11/17 21:02:09
When using an incognito profile.
| |
| 707 return false; | |
| 708 | |
| 707 // If the wizard is already visible, focus it. | 709 // If the wizard is already visible, focus it. |
| 708 if (service->get_wizard().IsVisible()) { | 710 if (service->get_wizard().IsVisible()) { |
| 709 service->get_wizard().Focus(); | 711 service->get_wizard().Focus(); |
| 710 return true; | 712 return true; |
| 711 } | 713 } |
| 712 return false; | 714 return false; |
| 713 } | 715 } |
| 714 | 716 |
| 715 void SyncSetupHandler::CloseOverlay() { | 717 void SyncSetupHandler::CloseOverlay() { |
| 716 web_ui_->CallJavascriptFunction("OptionsPage.closeOverlay"); | 718 web_ui_->CallJavascriptFunction("OptionsPage.closeOverlay"); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 744 } | 746 } |
| 745 | 747 |
| 746 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { | 748 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { |
| 747 DictionaryValue args; | 749 DictionaryValue args; |
| 748 Profile* profile = Profile::FromWebUI(web_ui_); | 750 Profile* profile = Profile::FromWebUI(web_ui_); |
| 749 ProfileSyncService* service = profile->GetProfileSyncService(); | 751 ProfileSyncService* service = profile->GetProfileSyncService(); |
| 750 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); | 752 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); |
| 751 args.SetString("error_message", error_message); | 753 args.SetString("error_message", error_message); |
| 752 ShowGaiaLogin(args); | 754 ShowGaiaLogin(args); |
| 753 } | 755 } |
| OLD | NEW |