Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1748)

Unified Diff: chrome/browser/ui/webui/sync_setup_handler.cc

Issue 1421893005: Settings Rewrite: Fork SyncSetupHandler for MD-Settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/sync_setup_handler.cc
diff --git a/chrome/browser/ui/webui/options/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc
similarity index 84%
rename from chrome/browser/ui/webui/options/sync_setup_handler.cc
rename to chrome/browser/ui/webui/sync_setup_handler.cc
index 5c9a617927970760b460e0667eca5a4675daed7a..ebefb6630a778564c8258320e39dc6c8804e5971 100644
--- a/chrome/browser/ui/webui/options/sync_setup_handler.cc
+++ b/chrome/browser/ui/webui/sync_setup_handler.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/options/sync_setup_handler.h"
+#include "chrome/browser/ui/webui/sync_setup_handler.h"
#include "base/basictypes.h"
#include "base/bind.h"
@@ -14,10 +14,7 @@
#include "base/json/json_writer.h"
#include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h"
-#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
-#include "chrome/app/chrome_command_ids.h"
-#include "chrome/browser/browser_process.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
@@ -35,11 +32,7 @@
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/url_constants.h"
-#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
-#include "chrome/grit/locale_settings.h"
-#include "components/google/core/browser/google_util.h"
#include "components/signin/core/browser/signin_error_controller.h"
#include "components/signin/core/browser/signin_header_helper.h"
#include "components/signin/core/browser/signin_metrics.h"
@@ -50,7 +43,6 @@
#include "content/public/browser/web_contents_delegate.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/gaia_constants.h"
-#include "grit/components_strings.h"
#include "net/base/url_util.h"
#include "ui/base/l10n/l10n_util.h"
@@ -152,8 +144,8 @@ bool GetConfiguration(const std::string& json, SyncConfigInfo* config) {
} // namespace
-SyncSetupHandler::SyncSetupHandler()
- : configuring_sync_(false) {
+SyncSetupHandler::SyncSetupHandler(content::WebUI* web_ui)
+ : content::WebUIMessageHandler(web_ui), configuring_sync_(false) {
}
SyncSetupHandler::~SyncSetupHandler() {
@@ -165,114 +157,6 @@ SyncSetupHandler::~SyncSetupHandler() {
CloseSyncSetup();
}
-void SyncSetupHandler::GetLocalizedValues(
- base::DictionaryValue* localized_strings) {
- GetStaticLocalizedValues(localized_strings, web_ui());
-}
-
-void SyncSetupHandler::GetStaticLocalizedValues(
- base::DictionaryValue* localized_strings,
- content::WebUI* web_ui) {
- DCHECK(localized_strings);
-
- base::string16 product_name(GetStringUTF16(IDS_PRODUCT_NAME));
- localized_strings->SetString(
- "chooseDataTypesInstructions",
- GetStringFUTF16(IDS_SYNC_CHOOSE_DATATYPES_INSTRUCTIONS, product_name));
- localized_strings->SetString(
- "encryptionInstructions",
- GetStringFUTF16(IDS_SYNC_ENCRYPTION_INSTRUCTIONS, product_name));
- localized_strings->SetString(
- "encryptionHelpURL", chrome::kSyncEncryptionHelpURL);
- localized_strings->SetString(
- "encryptionSectionMessage",
- GetStringFUTF16(IDS_SYNC_ENCRYPTION_SECTION_MESSAGE, product_name));
- localized_strings->SetString(
- "passphraseRecover",
- GetStringFUTF16(
- IDS_SYNC_PASSPHRASE_RECOVER,
- base::ASCIIToUTF16(
- google_util::AppendGoogleLocaleParam(
- GURL(chrome::kSyncGoogleDashboardURL),
- g_browser_process->GetApplicationLocale()).spec())));
- localized_strings->SetString(
- "stopSyncingExplanation",
- l10n_util::GetStringFUTF16(
- IDS_SYNC_STOP_SYNCING_EXPLANATION_LABEL,
- l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
- base::ASCIIToUTF16(
- google_util::AppendGoogleLocaleParam(
- GURL(chrome::kSyncGoogleDashboardURL),
- g_browser_process->GetApplicationLocale()).spec())));
- localized_strings->SetString("deleteProfileLabel",
- l10n_util::GetStringUTF16(IDS_SYNC_STOP_DELETE_PROFILE_LABEL));
- localized_strings->SetString("stopSyncingTitle",
- l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_DIALOG_TITLE));
- localized_strings->SetString("stopSyncingConfirm",
- l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_CONFIRM_BUTTON_LABEL));
-
- localized_strings->SetString(
- "syncEverythingHelpURL", chrome::kSyncEverythingLearnMoreURL);
- localized_strings->SetString(
- "syncErrorHelpURL", chrome::kSyncErrorsHelpURL);
-
- static OptionsStringResource resources[] = {
- { "syncSetupConfigureTitle", IDS_SYNC_SETUP_CONFIGURE_TITLE },
- { "syncSetupSpinnerTitle", IDS_SYNC_SETUP_SPINNER_TITLE },
- { "syncSetupTimeoutTitle", IDS_SYNC_SETUP_TIME_OUT_TITLE },
- { "syncSetupTimeoutContent", IDS_SYNC_SETUP_TIME_OUT_CONTENT },
- { "errorLearnMore", IDS_LEARN_MORE },
- { "cancel", IDS_CANCEL },
- { "loginSuccess", IDS_SYNC_SUCCESS },
- { "settingUp", IDS_SYNC_LOGIN_SETTING_UP },
- { "syncAllDataTypes", IDS_SYNC_EVERYTHING },
- { "chooseDataTypes", IDS_SYNC_CHOOSE_DATATYPES },
- { "syncNothing", IDS_SYNC_NOTHING },
- { "bookmarks", IDS_SYNC_DATATYPE_BOOKMARKS },
- { "preferences", IDS_SYNC_DATATYPE_PREFERENCES },
- { "autofill", IDS_SYNC_DATATYPE_AUTOFILL },
- { "themes", IDS_SYNC_DATATYPE_THEMES },
- { "passwords", IDS_SYNC_DATATYPE_PASSWORDS },
- { "extensions", IDS_SYNC_DATATYPE_EXTENSIONS },
- { "typedURLs", IDS_SYNC_DATATYPE_TYPED_URLS },
- { "apps", IDS_SYNC_DATATYPE_APPS },
- { "wifiCredentials", IDS_SYNC_DATATYPE_WIFI_CREDENTIALS },
- { "openTabs", IDS_SYNC_DATATYPE_TABS },
- { "serviceUnavailableError", IDS_SYNC_SETUP_ABORTED_BY_PENDING_CLEAR },
- { "confirmLabel", IDS_SYNC_CONFIRM_PASSPHRASE_LABEL },
- { "emptyErrorMessage", IDS_SYNC_EMPTY_PASSPHRASE_ERROR },
- { "mismatchErrorMessage", IDS_SYNC_PASSPHRASE_MISMATCH_ERROR },
- { "customizeLinkLabel", IDS_SYNC_CUSTOMIZE_LINK_LABEL },
- { "confirmSyncPreferences", IDS_SYNC_CONFIRM_SYNC_PREFERENCES },
- { "syncEverything", IDS_SYNC_SYNC_EVERYTHING },
- { "useDefaultSettings", IDS_SYNC_USE_DEFAULT_SETTINGS },
- { "enterPassphraseBody", IDS_SYNC_ENTER_PASSPHRASE_BODY },
- { "enterGooglePassphraseBody", IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY },
- { "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL },
- { "incorrectPassphrase", IDS_SYNC_INCORRECT_PASSPHRASE },
- { "passphraseWarning", IDS_SYNC_PASSPHRASE_WARNING },
- { "yes", IDS_SYNC_PASSPHRASE_CANCEL_YES },
- { "no", IDS_SYNC_PASSPHRASE_CANCEL_NO },
- { "sectionExplicitMessagePrefix", IDS_SYNC_PASSPHRASE_MSG_EXPLICIT_PREFIX },
- { "sectionExplicitMessagePostfix",
- IDS_SYNC_PASSPHRASE_MSG_EXPLICIT_POSTFIX },
- // TODO(rogerta): browser/resource/sync_promo/sync_promo.html and related
- // file may not be needed any more. If not, then the following promo
- // strings can also be removed.
- { "promoPageTitle", IDS_SYNC_PROMO_TAB_TITLE },
- { "promoSkipButton", IDS_SYNC_PROMO_SKIP_BUTTON },
- { "promoAdvanced", IDS_SYNC_PROMO_ADVANCED },
- { "promoLearnMore", IDS_LEARN_MORE },
- { "promoTitleShort", IDS_SYNC_PROMO_MESSAGE_TITLE_SHORT },
- { "encryptionSectionTitle", IDS_SYNC_ENCRYPTION_SECTION_TITLE },
- { "basicEncryptionOption", IDS_SYNC_BASIC_ENCRYPTION_DATA },
- { "fullEncryptionOption", IDS_SYNC_FULL_ENCRYPTION_DATA },
- };
-
- RegisterStrings(localized_strings, resources, arraysize(resources));
- RegisterTitle(localized_strings, "syncSetupOverlay", IDS_SYNC_SETUP_TITLE);
-}
-
void SyncSetupHandler::ConfigureSyncDone() {
base::StringValue page("done");
web_ui()->CallJavascriptFunction(
@@ -469,8 +353,7 @@ Profile* SyncSetupHandler::GetProfile() const {
}
ProfileSyncService* SyncSetupHandler::GetSyncService() const {
- Profile* profile = GetProfile();
- return profile->IsSyncAllowed() ?
+ return GetProfile()->IsSyncAllowed() ?
ProfileSyncServiceFactory::GetForProfile(GetProfile()) : NULL;
}

Powered by Google App Engine
This is Rietveld 408576698