OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 GetStringFUTF16(IDS_SYNC_PASSPHRASE_RECOVER, | 221 GetStringFUTF16(IDS_SYNC_PASSPHRASE_RECOVER, |
222 base::ASCIIToUTF16( | 222 base::ASCIIToUTF16( |
223 google_util::StringAppendGoogleLocaleParam( | 223 google_util::StringAppendGoogleLocaleParam( |
224 chrome::kSyncGoogleDashboardURL)))); | 224 chrome::kSyncGoogleDashboardURL)))); |
225 localized_strings->SetString("stopSyncingExplanation", | 225 localized_strings->SetString("stopSyncingExplanation", |
226 l10n_util::GetStringFUTF16( | 226 l10n_util::GetStringFUTF16( |
227 IDS_SYNC_STOP_SYNCING_EXPLANATION_LABEL, | 227 IDS_SYNC_STOP_SYNCING_EXPLANATION_LABEL, |
228 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 228 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
229 base::ASCIIToUTF16(google_util::StringAppendGoogleLocaleParam( | 229 base::ASCIIToUTF16(google_util::StringAppendGoogleLocaleParam( |
230 chrome::kSyncGoogleDashboardURL)))); | 230 chrome::kSyncGoogleDashboardURL)))); |
| 231 localized_strings->SetString("deleteProfileLabel", |
| 232 l10n_util::GetStringUTF16(IDS_SYNC_STOP_DELETE_PROFILE_LABEL)); |
231 localized_strings->SetString("stopSyncingTitle", | 233 localized_strings->SetString("stopSyncingTitle", |
232 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_DIALOG_TITLE)); | 234 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_DIALOG_TITLE)); |
233 localized_strings->SetString("stopSyncingConfirm", | 235 localized_strings->SetString("stopSyncingConfirm", |
234 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_CONFIRM_BUTTON_LABEL)); | 236 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_CONFIRM_BUTTON_LABEL)); |
235 | 237 |
236 localized_strings->SetString( | 238 localized_strings->SetString( |
237 "syncEverythingHelpURL", chrome::kSyncEverythingLearnMoreURL); | 239 "syncEverythingHelpURL", chrome::kSyncEverythingLearnMoreURL); |
238 localized_strings->SetString( | 240 localized_strings->SetString( |
239 "syncErrorHelpURL", chrome::kSyncErrorsHelpURL); | 241 "syncErrorHelpURL", chrome::kSyncErrorsHelpURL); |
240 | 242 |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 // Should only be called if the user is not already signed in. | 774 // Should only be called if the user is not already signed in. |
773 DCHECK(SigninManagerFactory::GetForProfile(GetProfile())-> | 775 DCHECK(SigninManagerFactory::GetForProfile(GetProfile())-> |
774 GetAuthenticatedUsername().empty()); | 776 GetAuthenticatedUsername().empty()); |
775 OpenSyncSetup(); | 777 OpenSyncSetup(); |
776 } | 778 } |
777 | 779 |
778 void SyncSetupHandler::HandleStopSyncing(const base::ListValue* args) { | 780 void SyncSetupHandler::HandleStopSyncing(const base::ListValue* args) { |
779 if (GetSyncService()) | 781 if (GetSyncService()) |
780 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); | 782 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); |
781 SigninManagerFactory::GetForProfile(GetProfile())->SignOut(); | 783 SigninManagerFactory::GetForProfile(GetProfile())->SignOut(); |
| 784 |
| 785 bool delete_profile = false; |
| 786 if (args->GetBoolean(0, &delete_profile) && delete_profile) { |
| 787 web_ui()->CallJavascriptFunction( |
| 788 "BrowserOptions.deleteCurrentProfile"); |
| 789 } |
782 } | 790 } |
783 #endif | 791 #endif |
784 | 792 |
785 void SyncSetupHandler::HandleCloseTimeout(const base::ListValue* args) { | 793 void SyncSetupHandler::HandleCloseTimeout(const base::ListValue* args) { |
786 CloseSyncSetup(); | 794 CloseSyncSetup(); |
787 } | 795 } |
788 | 796 |
789 void SyncSetupHandler::CloseSyncSetup() { | 797 void SyncSetupHandler::CloseSyncSetup() { |
790 // Stop a timer to handle timeout in waiting for checking network connection. | 798 // Stop a timer to handle timeout in waiting for checking network connection. |
791 backend_start_timer_.reset(); | 799 backend_start_timer_.reset(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 | 919 |
912 LoginUIService* service = GetLoginUIService(); | 920 LoginUIService* service = GetLoginUIService(); |
913 DCHECK(service); | 921 DCHECK(service); |
914 service->current_login_ui()->FocusUI(); | 922 service->current_login_ui()->FocusUI(); |
915 return true; | 923 return true; |
916 } | 924 } |
917 | 925 |
918 LoginUIService* SyncSetupHandler::GetLoginUIService() const { | 926 LoginUIService* SyncSetupHandler::GetLoginUIService() const { |
919 return LoginUIServiceFactory::GetForProfile(GetProfile()); | 927 return LoginUIServiceFactory::GetForProfile(GetProfile()); |
920 } | 928 } |
OLD | NEW |