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 Page = cr.ui.pageManager.Page; | 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 * @constructor |
| 13 * @extends {options.SettingsDialog} |
13 */ | 14 */ |
14 function HomePageOverlay() { | 15 function HomePageOverlay() { |
15 SettingsDialog.call(this, 'homePageOverlay', | 16 SettingsDialog.call(this, 'homePageOverlay', |
16 loadTimeData.getString('homePageOverlayTabTitle'), | 17 loadTimeData.getString('homePageOverlayTabTitle'), |
17 'home-page-overlay', | 18 'home-page-overlay', |
18 $('home-page-confirm'), $('home-page-cancel')); | 19 $('home-page-confirm'), $('home-page-cancel')); |
19 } | 20 } |
20 | 21 |
21 cr.addSingletonGetter(HomePageOverlay); | 22 cr.addSingletonGetter(HomePageOverlay); |
22 | 23 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 didShowPage: function() { | 68 didShowPage: function() { |
68 this.updateFavicon_(); | 69 this.updateFavicon_(); |
69 }, | 70 }, |
70 | 71 |
71 /** | 72 /** |
72 * Updates the state of the homepage text input and its controlled setting | 73 * Updates the state of the homepage text input and its controlled setting |
73 * indicator when the |homepage_is_newtabpage| pref changes. The input is | 74 * indicator when the |homepage_is_newtabpage| pref changes. The input is |
74 * enabled only if the homepage is not the NTP. The indicator is always | 75 * enabled only if the homepage is not the NTP. The indicator is always |
75 * enabled but treats the input's value as read-only if the homepage is the | 76 * enabled but treats the input's value as read-only if the homepage is the |
76 * NTP. | 77 * NTP. |
77 * @param {Event} Pref change event. | 78 * @param {Event} event Pref change event. |
78 */ | 79 */ |
79 handleHomepageIsNTPPrefChange: function(event) { | 80 handleHomepageIsNTPPrefChange: function(event) { |
80 var urlField = $('homepage-url-field'); | 81 var urlField = $('homepage-url-field'); |
81 var urlFieldIndicator = $('homepage-url-field-indicator'); | 82 var urlFieldIndicator = $('homepage-url-field-indicator'); |
82 urlField.setDisabled('homepage-is-ntp', event.value.value); | 83 urlField.setDisabled('homepage-is-ntp', event.value.value); |
83 urlFieldIndicator.readOnly = event.value.value; | 84 urlFieldIndicator.readOnly = event.value.value; |
84 }, | 85 }, |
85 | 86 |
86 /** | 87 /** |
87 * Updates the background of the url field to show the favicon for the | 88 * Updates the background of the url field to show the favicon for the |
(...skipping 11 matching lines...) Expand all Loading... |
99 * call updateAutocompleteSuggestions_. | 100 * call updateAutocompleteSuggestions_. |
100 * @param {string} query List of autocomplete suggestions. | 101 * @param {string} query List of autocomplete suggestions. |
101 * @private | 102 * @private |
102 */ | 103 */ |
103 requestAutocompleteSuggestions_: function(query) { | 104 requestAutocompleteSuggestions_: function(query) { |
104 chrome.send('requestAutocompleteSuggestionsForHomePage', [query]); | 105 chrome.send('requestAutocompleteSuggestionsForHomePage', [query]); |
105 }, | 106 }, |
106 | 107 |
107 /** | 108 /** |
108 * Updates the autocomplete suggestion list with the given entries. | 109 * Updates the autocomplete suggestion list with the given entries. |
109 * @param {Array} pages List of autocomplete suggestions. | 110 * @param {Array} suggestions List of autocomplete suggestions. |
110 * @private | 111 * @private |
111 */ | 112 */ |
112 updateAutocompleteSuggestions_: function(suggestions) { | 113 updateAutocompleteSuggestions_: function(suggestions) { |
113 var list = this.autocompleteList_; | 114 var list = this.autocompleteList_; |
114 // If the trigger for this update was a value being selected from the | 115 // If the trigger for this update was a value being selected from the |
115 // current list, do nothing. | 116 // current list, do nothing. |
116 if (list.targetInput && list.selectedItem && | 117 if (list.targetInput && list.selectedItem && |
117 list.selectedItem.url == list.targetInput.value) { | 118 list.selectedItem.url == list.targetInput.value) { |
118 return; | 119 return; |
119 } | 120 } |
(...skipping 23 matching lines...) Expand all Loading... |
143 HomePageOverlay.updateAutocompleteSuggestions = function() { | 144 HomePageOverlay.updateAutocompleteSuggestions = function() { |
144 var instance = HomePageOverlay.getInstance(); | 145 var instance = HomePageOverlay.getInstance(); |
145 instance.updateAutocompleteSuggestions_.apply(instance, arguments); | 146 instance.updateAutocompleteSuggestions_.apply(instance, arguments); |
146 }; | 147 }; |
147 | 148 |
148 // Export | 149 // Export |
149 return { | 150 return { |
150 HomePageOverlay: HomePageOverlay | 151 HomePageOverlay: HomePageOverlay |
151 }; | 152 }; |
152 }); | 153 }); |
OLD | NEW |