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 */ var OptionsPage = options.OptionsPage; | 6 /** @const */ var Page = cr.ui.pageManager.Page; |
7 /** @const */ var SettingsDialog = options.SettingsDialog; | 7 /** @const */ var SettingsDialog = options.SettingsDialog; |
8 | 8 |
9 /** | 9 /** |
10 * HomePageOverlay class | 10 * HomePageOverlay class |
11 * Dialog that allows users to set the home page. | 11 * Dialog that allows users to set the home page. |
12 * @extends {SettingsDialog} | 12 * @extends {SettingsDialog} |
13 */ | 13 */ |
14 function HomePageOverlay() { | 14 function HomePageOverlay() { |
15 SettingsDialog.call(this, 'homePageOverlay', | 15 SettingsDialog.call(this, 'homePageOverlay', |
16 loadTimeData.getString('homePageOverlayTabTitle'), | 16 loadTimeData.getString('homePageOverlayTabTitle'), |
17 'home-page-overlay', | 17 'home-page-overlay', |
18 $('home-page-confirm'), $('home-page-cancel')); | 18 $('home-page-confirm'), $('home-page-cancel')); |
19 } | 19 } |
20 | 20 |
21 cr.addSingletonGetter(HomePageOverlay); | 21 cr.addSingletonGetter(HomePageOverlay); |
22 | 22 |
23 HomePageOverlay.prototype = { | 23 HomePageOverlay.prototype = { |
24 __proto__: SettingsDialog.prototype, | 24 __proto__: SettingsDialog.prototype, |
25 | 25 |
26 /** | 26 /** |
27 * An autocomplete list that can be attached to the home page URL field. | 27 * An autocomplete list that can be attached to the home page URL field. |
28 * @type {cr.ui.AutocompleteList} | 28 * @type {cr.ui.AutocompleteList} |
29 * @private | 29 * @private |
30 */ | 30 */ |
31 autocompleteList_: null, | 31 autocompleteList_: null, |
32 | 32 |
33 /** @override */ | 33 /** @override */ |
34 initializePage: function() { | 34 initializePage: function() { |
35 // Call base class implementation to start preference initialization. | |
36 SettingsDialog.prototype.initializePage.call(this); | 35 SettingsDialog.prototype.initializePage.call(this); |
37 | 36 |
38 var self = this; | 37 var self = this; |
39 options.Preferences.getInstance().addEventListener( | 38 options.Preferences.getInstance().addEventListener( |
40 'homepage_is_newtabpage', | 39 'homepage_is_newtabpage', |
41 this.handleHomepageIsNTPPrefChange.bind(this)); | 40 this.handleHomepageIsNTPPrefChange.bind(this)); |
42 | 41 |
43 var urlField = $('homepage-url-field'); | 42 var urlField = $('homepage-url-field'); |
44 urlField.addEventListener('keydown', function(event) { | 43 urlField.addEventListener('keydown', function(event) { |
45 // Don't auto-submit when the user selects something from the | 44 // Don't auto-submit when the user selects something from the |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 HomePageOverlay.updateAutocompleteSuggestions = function() { | 143 HomePageOverlay.updateAutocompleteSuggestions = function() { |
145 var instance = HomePageOverlay.getInstance(); | 144 var instance = HomePageOverlay.getInstance(); |
146 instance.updateAutocompleteSuggestions_.apply(instance, arguments); | 145 instance.updateAutocompleteSuggestions_.apply(instance, arguments); |
147 }; | 146 }; |
148 | 147 |
149 // Export | 148 // Export |
150 return { | 149 return { |
151 HomePageOverlay: HomePageOverlay | 150 HomePageOverlay: HomePageOverlay |
152 }; | 151 }; |
153 }); | 152 }); |
OLD | NEW |