| 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/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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 226 |
| 227 bool is_launch_page = web_ui && SyncPromoUI::GetIsLaunchPageForSyncPromoURL( | 227 bool is_launch_page = web_ui && SyncPromoUI::GetIsLaunchPageForSyncPromoURL( |
| 228 web_ui->GetWebContents()->GetURL()); | 228 web_ui->GetWebContents()->GetURL()); |
| 229 int title_id = is_launch_page ? IDS_SYNC_PROMO_TITLE_SHORT : | 229 int title_id = is_launch_page ? IDS_SYNC_PROMO_TITLE_SHORT : |
| 230 IDS_SYNC_PROMO_TITLE_EXISTING_USER; | 230 IDS_SYNC_PROMO_TITLE_EXISTING_USER; |
| 231 string16 short_product_name(GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); | 231 string16 short_product_name(GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); |
| 232 localized_strings->SetString( | 232 localized_strings->SetString( |
| 233 "promoTitle", GetStringFUTF16(title_id, short_product_name)); | 233 "promoTitle", GetStringFUTF16(title_id, short_product_name)); |
| 234 | 234 |
| 235 localized_strings->SetString( | 235 localized_strings->SetString( |
| 236 "promoMessageTitle", | |
| 237 GetStringFUTF16(IDS_SYNC_PROMO_MESSAGE_TITLE, short_product_name)); | |
| 238 localized_strings->SetString( | |
| 239 "syncEverythingHelpURL", chrome::kSyncEverythingLearnMoreURL); | 236 "syncEverythingHelpURL", chrome::kSyncEverythingLearnMoreURL); |
| 240 localized_strings->SetString( | 237 localized_strings->SetString( |
| 241 "syncErrorHelpURL", chrome::kSyncErrorsHelpURL); | 238 "syncErrorHelpURL", chrome::kSyncErrorsHelpURL); |
| 242 | 239 |
| 243 std::string create_account_url = google_util::StringAppendGoogleLocaleParam( | 240 std::string create_account_url = google_util::StringAppendGoogleLocaleParam( |
| 244 chrome::kSyncCreateNewAccountURL); | 241 chrome::kSyncCreateNewAccountURL); |
| 245 string16 create_account = GetStringUTF16(IDS_SYNC_CREATE_ACCOUNT); | 242 string16 create_account = GetStringUTF16(IDS_SYNC_CREATE_ACCOUNT); |
| 246 create_account= UTF8ToUTF16("<a id='create-account-link' target='_blank' " | 243 create_account= UTF8ToUTF16("<a id='create-account-link' target='_blank' " |
| 247 "class='account-link' href='" + create_account_url + "'>") + | 244 "class='account-link' href='" + create_account_url + "'>") + |
| 248 create_account + UTF8ToUTF16("</a>"); | 245 create_account + UTF8ToUTF16("</a>"); |
| 249 localized_strings->SetString("createAccountLinkHTML", | 246 localized_strings->SetString("createAccountLinkHTML", |
| 250 GetStringFUTF16(IDS_SYNC_CREATE_ACCOUNT_PREFIX, create_account)); | 247 GetStringFUTF16(IDS_SYNC_CREATE_ACCOUNT_PREFIX, create_account)); |
| 251 | 248 |
| 252 localized_strings->SetString("promoVerboseTitle", short_product_name); | |
| 253 localized_strings->SetString("promoVerboseMessageBody", | |
| 254 GetStringFUTF16(IDS_SYNC_PROMO_V_MESSAGE_BODY, short_product_name)); | |
| 255 | |
| 256 string16 sync_benefits_url( | 249 string16 sync_benefits_url( |
| 257 UTF8ToUTF16(google_util::StringAppendGoogleLocaleParam( | 250 UTF8ToUTF16(google_util::StringAppendGoogleLocaleParam( |
| 258 chrome::kSyncLearnMoreURL))); | 251 chrome::kSyncLearnMoreURL))); |
| 259 localized_strings->SetString("promoVerboseLearnMore", | |
| 260 GetStringFUTF16(IDS_SYNC_PROMO_V_LEARN_MORE, sync_benefits_url)); | |
| 261 localized_strings->SetString("promoVerboseBackupBody", | |
| 262 GetStringFUTF16(IDS_SYNC_PROMO_V_BACKUP_BODY, short_product_name)); | |
| 263 localized_strings->SetString("signUpURL", create_account_url); | |
| 264 localized_strings->SetString("promoLearnMoreURL", sync_benefits_url); | 252 localized_strings->SetString("promoLearnMoreURL", sync_benefits_url); |
| 265 | 253 |
| 266 static OptionsStringResource resources[] = { | 254 static OptionsStringResource resources[] = { |
| 267 { "syncSetupConfigureTitle", IDS_SYNC_SETUP_CONFIGURE_TITLE }, | 255 { "syncSetupConfigureTitle", IDS_SYNC_SETUP_CONFIGURE_TITLE }, |
| 268 { "cannotBeBlank", IDS_SYNC_CANNOT_BE_BLANK }, | 256 { "cannotBeBlank", IDS_SYNC_CANNOT_BE_BLANK }, |
| 269 { "emailLabel", IDS_SYNC_LOGIN_EMAIL_NEW_LINE }, | 257 { "emailLabel", IDS_SYNC_LOGIN_EMAIL_NEW_LINE }, |
| 270 { "passwordLabel", IDS_SYNC_LOGIN_PASSWORD_NEW_LINE }, | 258 { "passwordLabel", IDS_SYNC_LOGIN_PASSWORD_NEW_LINE }, |
| 271 { "invalidCredentials", IDS_SYNC_INVALID_USER_CREDENTIALS }, | 259 { "invalidCredentials", IDS_SYNC_INVALID_USER_CREDENTIALS }, |
| 272 { "signin", IDS_SYNC_SIGNIN }, | 260 { "signin", IDS_SYNC_SIGNIN }, |
| 273 { "couldNotConnect", IDS_SYNC_LOGIN_COULD_NOT_CONNECT }, | 261 { "couldNotConnect", IDS_SYNC_LOGIN_COULD_NOT_CONNECT }, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 IDS_SYNC_PASSPHRASE_MSG_EXPLICIT_POSTFIX }, | 318 IDS_SYNC_PASSPHRASE_MSG_EXPLICIT_POSTFIX }, |
| 331 { "encryptedDataTypesTitle", IDS_SYNC_ENCRYPTION_DATA_TYPES_TITLE }, | 319 { "encryptedDataTypesTitle", IDS_SYNC_ENCRYPTION_DATA_TYPES_TITLE }, |
| 332 { "encryptSensitiveOption", IDS_SYNC_ENCRYPT_SENSITIVE_DATA }, | 320 { "encryptSensitiveOption", IDS_SYNC_ENCRYPT_SENSITIVE_DATA }, |
| 333 { "encryptAllOption", IDS_SYNC_ENCRYPT_ALL_DATA }, | 321 { "encryptAllOption", IDS_SYNC_ENCRYPT_ALL_DATA }, |
| 334 { "encryptAllOption", IDS_SYNC_ENCRYPT_ALL_DATA }, | 322 { "encryptAllOption", IDS_SYNC_ENCRYPT_ALL_DATA }, |
| 335 { "aspWarningText", IDS_SYNC_ASP_PASSWORD_WARNING_TEXT }, | 323 { "aspWarningText", IDS_SYNC_ASP_PASSWORD_WARNING_TEXT }, |
| 336 { "promoPageTitle", IDS_SYNC_PROMO_TAB_TITLE }, | 324 { "promoPageTitle", IDS_SYNC_PROMO_TAB_TITLE }, |
| 337 { "promoSkipButton", IDS_SYNC_PROMO_SKIP_BUTTON }, | 325 { "promoSkipButton", IDS_SYNC_PROMO_SKIP_BUTTON }, |
| 338 { "promoAdvanced", IDS_SYNC_PROMO_ADVANCED }, | 326 { "promoAdvanced", IDS_SYNC_PROMO_ADVANCED }, |
| 339 { "promoLearnMore", IDS_LEARN_MORE }, | 327 { "promoLearnMore", IDS_LEARN_MORE }, |
| 340 { "promoLearnMoreShow", IDS_SYNC_PROMO_LEARN_MORE_SHOW }, | |
| 341 { "promoLearnMoreHide", IDS_SYNC_PROMO_LEARN_MORE_HIDE }, | |
| 342 { "promoInformation", IDS_SYNC_PROMO_INFORMATION }, | |
| 343 { "promoVerboseSyncTitle", IDS_SYNC_PROMO_V_SYNC_TITLE }, | |
| 344 { "promoVerboseSyncBody", IDS_SYNC_PROMO_V_SYNC_BODY }, | |
| 345 { "promoVerboseBackupTitle", IDS_SYNC_PROMO_V_BACKUP_TITLE }, | |
| 346 { "promoVerboseServicesTitle", IDS_SYNC_PROMO_V_SERVICES_TITLE }, | |
| 347 { "promoVerboseServicesBody", IDS_SYNC_PROMO_V_SERVICES_BODY }, | |
| 348 { "promoVerboseSignUp", IDS_SYNC_PROMO_V_SIGN_UP }, | |
| 349 { "promoTitleShort", IDS_SYNC_PROMO_MESSAGE_TITLE_SHORT }, | 328 { "promoTitleShort", IDS_SYNC_PROMO_MESSAGE_TITLE_SHORT }, |
| 350 { "promoMessageBody", IDS_SYNC_PROMO_MESSAGE_BODY }, | |
| 351 }; | 329 }; |
| 352 | 330 |
| 353 RegisterStrings(localized_strings, resources, arraysize(resources)); | 331 RegisterStrings(localized_strings, resources, arraysize(resources)); |
| 354 RegisterTitle(localized_strings, "syncSetupOverlay", IDS_SYNC_SETUP_TITLE); | 332 RegisterTitle(localized_strings, "syncSetupOverlay", IDS_SYNC_SETUP_TITLE); |
| 355 } | 333 } |
| 356 | 334 |
| 357 void SyncSetupHandler::StartConfigureSync() { | 335 void SyncSetupHandler::StartConfigureSync() { |
| 358 DCHECK(!flow_); | 336 DCHECK(!flow_); |
| 359 // Should only be called if user is signed in, so no longer need our | 337 // Should only be called if user is signed in, so no longer need our |
| 360 // SigninTracker. | 338 // SigninTracker. |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 if (i != current_profile_index && AreUserNamesEqual( | 788 if (i != current_profile_index && AreUserNamesEqual( |
| 811 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { | 789 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { |
| 812 *error_message = l10n_util::GetStringUTF16( | 790 *error_message = l10n_util::GetStringUTF16( |
| 813 IDS_SYNC_USER_NAME_IN_USE_ERROR); | 791 IDS_SYNC_USER_NAME_IN_USE_ERROR); |
| 814 return false; | 792 return false; |
| 815 } | 793 } |
| 816 } | 794 } |
| 817 | 795 |
| 818 return true; | 796 return true; |
| 819 } | 797 } |
| OLD | NEW |