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

Unified Diff: chrome/browser/resources/options2/home_page_overlay.js

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/resources/options2/home_page_overlay.js
diff --git a/chrome/browser/resources/options2/home_page_overlay.js b/chrome/browser/resources/options2/home_page_overlay.js
index 780f412922e5372bf725e801f3619544be7d65ff..838181fd3de1a8394d0f14dbf258e6538340be3f 100644
--- a/chrome/browser/resources/options2/home_page_overlay.js
+++ b/chrome/browser/resources/options2/home_page_overlay.js
@@ -29,9 +29,6 @@ cr.define('options', function() {
SettingsDialog.prototype.initializePage.call(this);
var self = this;
- $('homepage-use-ntp').onchange = this.updateHomePageInput_.bind(this);
- $('homepage-use-url').onchange = this.updateHomePageInput_.bind(this);
-
$('homepageURL').addEventListener('keydown', function(event) {
// Focus the 'OK' button when the user hits enter since people expect
// feedback indicating that they are done editing.
@@ -41,25 +38,23 @@ cr.define('options', function() {
// TODO(jhawkins): Refactor BrowserOptions.autocompleteList and use it
// here.
- },
- /**
- * @inheritDoc
- */
- didShowPage: function() {
- // Set initial state.
- this.updateHomePageInput_();
- },
+ // Extra functionality for the OK/cancel buttons, separate from what the
+ // SettingsDialog provides
+
+ // TODO(tbreisacher): This doesn't quite work because users can also
+ // cancel by pressing 'ESC'. We could just override the handleCancel_
+ // method from SettingsDialog, but it's private.
+
+ $('home-page-cancel').addEventListener('click', function() {
+ BrowserOptions.getInstance().updateHomePageSelector();
+ });
+
+ $('home-page-confirm').addEventListener('click', function() {
+ Preferences.setBooleanPref('browser.show_home_button', true);
+ Preferences.setBooleanPref('homepage_is_newtabpage', false);
+ });
csilv 2012/02/02 01:36:40 We should probably change SettingsDialog so that t
Tyler Breisacher (Chromium) 2012/02/02 18:52:45 Done.
- /**
- * Updates the state of the homepage text input. The input is enabled only
- * if the |homepageUseURLBUtton| radio is checked.
- * @private
- */
- updateHomePageInput_: function() {
- var homepageInput = $('homepageURL');
- var homepageUseURL = $('homepage-use-url');
- homepageInput.setDisabled('radio-choice', !homepageUseURL.checked);
},
};

Powered by Google App Engine
This is Rietveld 408576698