OLD | NEW |
---|---|
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 Loading... | |
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.disabled = !homepageUseURL.checked; | 53 $('home-page-confirm').addEventListener('click', function() { |
54 BrowserOptions.getInstance().homePageSelectUrl(); | |
55 }); | |
56 | |
csilv
2012/02/01 20:37:29
My preference is to not do this... and instead let
Tyler Breisacher (Chromium)
2012/02/01 21:49:38
If the user cancels then the preference doesn't ch
| |
63 }, | 57 }, |
64 }; | 58 }; |
65 | 59 |
66 // Export | 60 // Export |
67 return { | 61 return { |
68 HomePageOverlay: HomePageOverlay | 62 HomePageOverlay: HomePageOverlay |
69 }; | 63 }; |
70 }); | 64 }); |
OLD | NEW |