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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 cr.define('options', function() { 5 cr.define('options', function() {
6 const OptionsPage = options.OptionsPage; 6 const OptionsPage = options.OptionsPage;
7 const SettingsDialog = options.SettingsDialog; 7 const SettingsDialog = options.SettingsDialog;
8 8
9 /** 9 /**
10 * HomePageOverlay class 10 * HomePageOverlay class
(...skipping 11 matching lines...) Expand all
22 __proto__: SettingsDialog.prototype, 22 __proto__: SettingsDialog.prototype,
23 23
24 /** 24 /**
25 * Initialize the page. 25 * Initialize the page.
26 */ 26 */
27 initializePage: function() { 27 initializePage: function() {
28 // Call base class implementation to start preference initialization. 28 // Call base class implementation to start preference initialization.
29 SettingsDialog.prototype.initializePage.call(this); 29 SettingsDialog.prototype.initializePage.call(this);
30 30
31 var self = this; 31 var self = this;
32 $('homepage-use-ntp').onchange = this.updateHomePageInput_.bind(this);
33 $('homepage-use-url').onchange = this.updateHomePageInput_.bind(this);
34
35 $('homepageURL').addEventListener('keydown', function(event) { 32 $('homepageURL').addEventListener('keydown', function(event) {
36 // Focus the 'OK' button when the user hits enter since people expect 33 // Focus the 'OK' button when the user hits enter since people expect
37 // feedback indicating that they are done editing. 34 // feedback indicating that they are done editing.
38 if (event.keyIdentifier == 'Enter') 35 if (event.keyIdentifier == 'Enter')
39 $('home-page-confirm').focus(); 36 $('home-page-confirm').focus();
40 }); 37 });
41 38
42 // TODO(jhawkins): Refactor BrowserOptions.autocompleteList and use it 39 // TODO(jhawkins): Refactor BrowserOptions.autocompleteList and use it
43 // here. 40 // here.
44 },
45 41
46 /** 42 // Extra functionality for the OK/cancel buttons, separate from what the
47 * @inheritDoc 43 // SettingsDialog provides
48 */
49 didShowPage: function() {
50 // Set initial state.
51 this.updateHomePageInput_();
52 },
53 44
54 /** 45 // TODO(tbreisacher): This doesn't quite work because users can also
55 * Updates the state of the homepage text input. The input is enabled only 46 // cancel by pressing 'ESC'. We could just override the handleCancel_
56 * if the |homepageUseURLBUtton| radio is checked. 47 // method from SettingsDialog, but it's private.
57 * @private 48
58 */ 49 $('home-page-cancel').addEventListener('click', function() {
59 updateHomePageInput_: function() { 50 BrowserOptions.getInstance().updateHomePageSelector();
60 var homepageInput = $('homepageURL'); 51 });
61 var homepageUseURL = $('homepage-use-url'); 52
62 homepageInput.setDisabled('radio-choice', !homepageUseURL.checked); 53 $('home-page-confirm').addEventListener('click', function() {
54 Preferences.setBooleanPref('browser.show_home_button', true);
55 Preferences.setBooleanPref('homepage_is_newtabpage', false);
56 });
57
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.
63 }, 58 },
64 }; 59 };
65 60
66 // Export 61 // Export
67 return { 62 return {
68 HomePageOverlay: HomePageOverlay 63 HomePageOverlay: HomePageOverlay
69 }; 64 };
70 }); 65 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698