OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/webui/options/sync_options_handler.h" |
| 6 |
| 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/values.h" |
| 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/common/url_constants.h" |
| 12 #include "chrome/grit/chromium_strings.h" |
| 13 #include "chrome/grit/generated_resources.h" |
| 14 #include "components/google/core/browser/google_util.h" |
| 15 #include "grit/components_strings.h" |
| 16 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "url/gurl.h" |
| 18 |
| 19 using l10n_util::GetStringFUTF16; |
| 20 using l10n_util::GetStringUTF16; |
| 21 |
| 22 SyncOptionsHandler::SyncOptionsHandler(content::WebUI* web_ui) |
| 23 : sync_setup_handler_(web_ui) {} |
| 24 |
| 25 SyncOptionsHandler::~SyncOptionsHandler() {} |
| 26 |
| 27 void SyncOptionsHandler::GetLocalizedValues( |
| 28 base::DictionaryValue* localized_strings) { |
| 29 DCHECK(localized_strings); |
| 30 |
| 31 base::string16 product_name(GetStringUTF16(IDS_PRODUCT_NAME)); |
| 32 localized_strings->SetString( |
| 33 "chooseDataTypesInstructions", |
| 34 GetStringFUTF16(IDS_SYNC_CHOOSE_DATATYPES_INSTRUCTIONS, product_name)); |
| 35 localized_strings->SetString( |
| 36 "encryptionInstructions", |
| 37 GetStringFUTF16(IDS_SYNC_ENCRYPTION_INSTRUCTIONS, product_name)); |
| 38 localized_strings->SetString( |
| 39 "encryptionHelpURL", chrome::kSyncEncryptionHelpURL); |
| 40 localized_strings->SetString( |
| 41 "encryptionSectionMessage", |
| 42 GetStringFUTF16(IDS_SYNC_ENCRYPTION_SECTION_MESSAGE, product_name)); |
| 43 localized_strings->SetString( |
| 44 "passphraseRecover", |
| 45 GetStringFUTF16( |
| 46 IDS_SYNC_PASSPHRASE_RECOVER, |
| 47 base::ASCIIToUTF16( |
| 48 google_util::AppendGoogleLocaleParam( |
| 49 GURL(chrome::kSyncGoogleDashboardURL), |
| 50 g_browser_process->GetApplicationLocale()).spec()))); |
| 51 localized_strings->SetString( |
| 52 "stopSyncingExplanation", |
| 53 l10n_util::GetStringFUTF16( |
| 54 IDS_SYNC_STOP_SYNCING_EXPLANATION_LABEL, |
| 55 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
| 56 base::ASCIIToUTF16( |
| 57 google_util::AppendGoogleLocaleParam( |
| 58 GURL(chrome::kSyncGoogleDashboardURL), |
| 59 g_browser_process->GetApplicationLocale()).spec()))); |
| 60 localized_strings->SetString("deleteProfileLabel", |
| 61 l10n_util::GetStringUTF16(IDS_SYNC_STOP_DELETE_PROFILE_LABEL)); |
| 62 localized_strings->SetString("stopSyncingTitle", |
| 63 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_DIALOG_TITLE)); |
| 64 localized_strings->SetString("stopSyncingConfirm", |
| 65 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_CONFIRM_BUTTON_LABEL)); |
| 66 |
| 67 localized_strings->SetString( |
| 68 "syncEverythingHelpURL", chrome::kSyncEverythingLearnMoreURL); |
| 69 localized_strings->SetString( |
| 70 "syncErrorHelpURL", chrome::kSyncErrorsHelpURL); |
| 71 |
| 72 static OptionsStringResource resources[] = { |
| 73 { "syncSetupConfigureTitle", IDS_SYNC_SETUP_CONFIGURE_TITLE }, |
| 74 { "syncSetupSpinnerTitle", IDS_SYNC_SETUP_SPINNER_TITLE }, |
| 75 { "syncSetupTimeoutTitle", IDS_SYNC_SETUP_TIME_OUT_TITLE }, |
| 76 { "syncSetupTimeoutContent", IDS_SYNC_SETUP_TIME_OUT_CONTENT }, |
| 77 { "errorLearnMore", IDS_LEARN_MORE }, |
| 78 { "cancel", IDS_CANCEL }, |
| 79 { "loginSuccess", IDS_SYNC_SUCCESS }, |
| 80 { "settingUp", IDS_SYNC_LOGIN_SETTING_UP }, |
| 81 { "syncAllDataTypes", IDS_SYNC_EVERYTHING }, |
| 82 { "chooseDataTypes", IDS_SYNC_CHOOSE_DATATYPES }, |
| 83 { "syncNothing", IDS_SYNC_NOTHING }, |
| 84 { "bookmarks", IDS_SYNC_DATATYPE_BOOKMARKS }, |
| 85 { "preferences", IDS_SYNC_DATATYPE_PREFERENCES }, |
| 86 { "autofill", IDS_SYNC_DATATYPE_AUTOFILL }, |
| 87 { "themes", IDS_SYNC_DATATYPE_THEMES }, |
| 88 { "passwords", IDS_SYNC_DATATYPE_PASSWORDS }, |
| 89 { "extensions", IDS_SYNC_DATATYPE_EXTENSIONS }, |
| 90 { "typedURLs", IDS_SYNC_DATATYPE_TYPED_URLS }, |
| 91 { "apps", IDS_SYNC_DATATYPE_APPS }, |
| 92 { "wifiCredentials", IDS_SYNC_DATATYPE_WIFI_CREDENTIALS }, |
| 93 { "openTabs", IDS_SYNC_DATATYPE_TABS }, |
| 94 { "serviceUnavailableError", IDS_SYNC_SETUP_ABORTED_BY_PENDING_CLEAR }, |
| 95 { "confirmLabel", IDS_SYNC_CONFIRM_PASSPHRASE_LABEL }, |
| 96 { "emptyErrorMessage", IDS_SYNC_EMPTY_PASSPHRASE_ERROR }, |
| 97 { "mismatchErrorMessage", IDS_SYNC_PASSPHRASE_MISMATCH_ERROR }, |
| 98 { "customizeLinkLabel", IDS_SYNC_CUSTOMIZE_LINK_LABEL }, |
| 99 { "confirmSyncPreferences", IDS_SYNC_CONFIRM_SYNC_PREFERENCES }, |
| 100 { "syncEverything", IDS_SYNC_SYNC_EVERYTHING }, |
| 101 { "useDefaultSettings", IDS_SYNC_USE_DEFAULT_SETTINGS }, |
| 102 { "enterPassphraseBody", IDS_SYNC_ENTER_PASSPHRASE_BODY }, |
| 103 { "enterGooglePassphraseBody", IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY }, |
| 104 { "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL }, |
| 105 { "incorrectPassphrase", IDS_SYNC_INCORRECT_PASSPHRASE }, |
| 106 { "passphraseWarning", IDS_SYNC_PASSPHRASE_WARNING }, |
| 107 { "yes", IDS_SYNC_PASSPHRASE_CANCEL_YES }, |
| 108 { "no", IDS_SYNC_PASSPHRASE_CANCEL_NO }, |
| 109 { "sectionExplicitMessagePrefix", IDS_SYNC_PASSPHRASE_MSG_EXPLICIT_PREFIX }, |
| 110 { "sectionExplicitMessagePostfix", |
| 111 IDS_SYNC_PASSPHRASE_MSG_EXPLICIT_POSTFIX }, |
| 112 // TODO(rogerta): browser/resource/sync_promo/sync_promo.html and related |
| 113 // file may not be needed any more. If not, then the following promo |
| 114 // strings can also be removed. |
| 115 { "promoPageTitle", IDS_SYNC_PROMO_TAB_TITLE }, |
| 116 { "promoSkipButton", IDS_SYNC_PROMO_SKIP_BUTTON }, |
| 117 { "promoAdvanced", IDS_SYNC_PROMO_ADVANCED }, |
| 118 { "promoLearnMore", IDS_LEARN_MORE }, |
| 119 { "promoTitleShort", IDS_SYNC_PROMO_MESSAGE_TITLE_SHORT }, |
| 120 { "encryptionSectionTitle", IDS_SYNC_ENCRYPTION_SECTION_TITLE }, |
| 121 { "basicEncryptionOption", IDS_SYNC_BASIC_ENCRYPTION_DATA }, |
| 122 { "fullEncryptionOption", IDS_SYNC_FULL_ENCRYPTION_DATA }, |
| 123 }; |
| 124 |
| 125 RegisterStrings(localized_strings, resources, arraysize(resources)); |
| 126 RegisterTitle(localized_strings, "syncSetupOverlay", IDS_SYNC_SETUP_TITLE); |
| 127 } |
| 128 |
| 129 void SyncOptionsHandler::RegisterMessages() { |
| 130 sync_setup_handler_.RegisterMessages(); |
| 131 } |
OLD | NEW |