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

Unified Diff: chrome/browser/ui/webui/options2/browser_options_handler2.cc

Issue 9296038: [uber] Redoing the homepage selection UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: set prefs explicitly when OK clicked Created 8 years, 11 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/options2/browser_options_handler2.cc
diff --git a/chrome/browser/ui/webui/options2/browser_options_handler2.cc b/chrome/browser/ui/webui/options2/browser_options_handler2.cc
index fb34661ee954cf108ae240a0ee53836d700cd79e..853ea96b42acedccaec09176bcfb95f554523b3d 100644
--- a/chrome/browser/ui/webui/options2/browser_options_handler2.cc
+++ b/chrome/browser/ui/webui/options2/browser_options_handler2.cc
@@ -117,9 +117,14 @@ void BrowserOptionsHandler::GetLocalizedValues(
{ "changeHomePage", IDS_OPTIONS_CHANGE_HOME_PAGE },
{ "customizeSync", IDS_OPTIONS2_CUSTOMIZE_SYNC_BUTTON_LABEL },
{ "defaultSearchManageEngines", IDS_OPTIONS_DEFAULTSEARCH_MANAGE_ENGINES },
+ { "homePage", IDS_OPTIONS2_HOMEPAGE },
+ { "homePageChoose", IDS_OPTIONS2_HOMEPAGE_CHOOSE },
+ { "homePageDialogLabel", IDS_OPTIONS2_HOMEPAGE_DIALOG_LABEL },
{ "homePageTitle", IDS_OPTIONS2_HOMEPAGE_TITLE },
- { "homepageUseNewTab", IDS_OPTIONS_HOMEPAGE_USE_NEWTAB },
- { "homepageUseURL", IDS_OPTIONS_HOMEPAGE_USE_URL },
+ { "homePageNone", IDS_OPTIONS2_HOMEPAGE_NONE },
+ { "homePageNtp", IDS_OPTIONS2_HOMEPAGE_NTP },
+ { "homePageUseNewTab", IDS_OPTIONS_HOMEPAGE_USE_NEWTAB },
+ { "homePageUseURL", IDS_OPTIONS_HOMEPAGE_USE_URL },
{ "instantConfirmMessage", IDS_INSTANT_OPT_IN_MESSAGE },
{ "instantConfirmTitle", IDS_INSTANT_OPT_IN_TITLE },
{ "importData", IDS_OPTIONS_IMPORT_DATA_BUTTON },
@@ -138,7 +143,7 @@ void BrowserOptionsHandler::GetLocalizedValues(
{ "sectionTitleSync", IDS_SYNC_OPTIONS_GROUP_NAME },
{ "startupSetPages", IDS_OPTIONS2_STARTUP_SET_PAGES },
{ "startupShowDefaultAndNewTab",
- IDS_OPTIONS_STARTUP_SHOW_DEFAULT_AND_NEWTAB},
+ IDS_OPTIONS2_STARTUP_SHOW_DEFAULT_AND_NEWTAB},
{ "startupShowLastSession", IDS_OPTIONS_STARTUP_SHOW_LAST_SESSION },
{ "startupShowPages", IDS_OPTIONS2_STARTUP_SHOW_PAGES },
{ "themesGallery", IDS_THEMES_GALLERY_BUTTON },
@@ -386,10 +391,6 @@ void BrowserOptionsHandler::Initialize() {
this);
UpdateDefaultBrowserState();
- pref_change_registrar_.Init(profile->GetPrefs());
- pref_change_registrar_.Add(prefs::kHomePageIsNewTabPage, this);
- pref_change_registrar_.Add(prefs::kHomePage, this);
-
registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
content::NotificationService::AllSources());
#if defined(OS_CHROMEOS)
@@ -401,7 +402,6 @@ void BrowserOptionsHandler::Initialize() {
ThemeServiceFactory::GetForProfile(profile)));
UpdateSearchEngines();
- UpdateHomePageLabel();
ObserveThemeChanged();
autocomplete_controller_.reset(new AutocompleteController(profile, this));
@@ -593,25 +593,6 @@ void BrowserOptionsHandler::UpdateSearchEngines() {
}
}
-void BrowserOptionsHandler::UpdateHomePageLabel() const {
- Profile* profile = Profile::FromWebUI(web_ui());
- PrefService* prefs = profile->GetPrefs();
- scoped_ptr<Value> label;
- string16 str;
-
- if (prefs->GetBoolean(prefs::kHomePageIsNewTabPage)) {
- str = l10n_util::GetStringUTF16(IDS_OPTIONS_SHOW_HOME_BUTTON_FOR_NTP);
- } else {
- str = l10n_util::GetStringFUTF16(
- IDS_OPTIONS_SHOW_HOME_BUTTON_FOR_URL,
- UTF8ToUTF16(prefs->GetString(prefs::kHomePage)));
- }
-
- label.reset(Value::CreateStringValue(str));
- web_ui()->CallJavascriptFunction("BrowserOptions.updateHomePageLabel",
- *label);
-}
-
void BrowserOptionsHandler::Observe(
int type,
const content::NotificationSource& source,
@@ -626,9 +607,6 @@ void BrowserOptionsHandler::Observe(
std::string* pref = content::Details<std::string>(details).ptr();
if (*pref == prefs::kDefaultBrowserSettingEnabled) {
UpdateDefaultBrowserState();
- } else if (*pref == prefs::kHomePageIsNewTabPage ||
- *pref == prefs::kHomePage) {
- UpdateHomePageLabel();
} else {
NOTREACHED();
}

Powered by Google App Engine
This is Rietveld 408576698