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

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

Issue 9353019: Revert 120803 - [uber] Redoing the homepage selection UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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
« no previous file with comments | « chrome/browser/ui/webui/options2/browser_options_handler2.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options2/browser_options_handler2.cc
===================================================================
--- chrome/browser/ui/webui/options2/browser_options_handler2.cc (revision 120816)
+++ chrome/browser/ui/webui/options2/browser_options_handler2.cc (working copy)
@@ -117,14 +117,8 @@
{ "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 },
- { "homePageNone", IDS_OPTIONS2_HOMEPAGE_NONE },
- { "homePageNtp", IDS_OPTIONS2_HOMEPAGE_NTP },
- { "homePageUseNewTab", IDS_OPTIONS_HOMEPAGE_USE_NEWTAB },
- { "homePageUseURL", IDS_OPTIONS_HOMEPAGE_USE_URL },
+ { "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 },
@@ -147,7 +141,7 @@
{ "settingsTitle", IDS_SETTINGS_TITLE },
{ "startupSetPages", IDS_OPTIONS2_STARTUP_SET_PAGES },
{ "startupShowDefaultAndNewTab",
- IDS_OPTIONS2_STARTUP_SHOW_DEFAULT_AND_NEWTAB},
+ IDS_OPTIONS_STARTUP_SHOW_DEFAULT_AND_NEWTAB},
{ "startupShowLastSession", IDS_OPTIONS_STARTUP_SHOW_LAST_SESSION },
{ "startupShowPages", IDS_OPTIONS2_STARTUP_SHOW_PAGES },
{ "themesGallery", IDS_THEMES_GALLERY_BUTTON },
@@ -396,6 +390,10 @@
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)
@@ -407,6 +405,7 @@
ThemeServiceFactory::GetForProfile(profile)));
UpdateSearchEngines();
+ UpdateHomePageLabel();
ObserveThemeChanged();
autocomplete_controller_.reset(new AutocompleteController(profile, this));
@@ -598,6 +597,25 @@
}
}
+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,
@@ -612,6 +630,9 @@
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();
}
Property changes on: chrome\browser\ui\webui\options2\browser_options_handler2.cc
___________________________________________________________________
Deleted: svn:mergeinfo
« no previous file with comments | « chrome/browser/ui/webui/options2/browser_options_handler2.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698