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 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
7 var ArrayDataModel = cr.ui.ArrayDataModel; | 7 var ArrayDataModel = cr.ui.ArrayDataModel; |
8 var RepeatingButton = cr.ui.RepeatingButton; | 8 var RepeatingButton = cr.ui.RepeatingButton; |
9 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; | 9 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; |
10 | 10 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 Preferences.getInstance().addEventListener('homepage_is_newtabpage', | 171 Preferences.getInstance().addEventListener('homepage_is_newtabpage', |
172 this.onHomePageIsNtpChanged_.bind(this)); | 172 this.onHomePageIsNtpChanged_.bind(this)); |
173 | 173 |
174 $('change-home-page').onclick = function(event) { | 174 $('change-home-page').onclick = function(event) { |
175 OptionsPage.navigateToPage('homePageOverlay'); | 175 OptionsPage.navigateToPage('homePageOverlay'); |
176 chrome.send('coreOptionsUserMetricsAction', | 176 chrome.send('coreOptionsUserMetricsAction', |
177 ['Options_Homepage_ShowSettings']); | 177 ['Options_Homepage_ShowSettings']); |
178 }; | 178 }; |
179 | 179 |
180 chrome.send('requestHotwordAvailable'); | 180 chrome.send('requestHotwordAvailable'); |
| 181 var hotwordIndicator = $('hotword-search-setting-indicator'); |
| 182 HotwordSearchSettingIndicator.decorate(hotwordIndicator); |
| 183 hotwordIndicator.disabledOnErrorSection = $('hotword-search-enable'); |
181 | 184 |
182 if ($('set-wallpaper')) { | 185 if ($('set-wallpaper')) { |
183 $('set-wallpaper').onclick = function(event) { | 186 $('set-wallpaper').onclick = function(event) { |
184 chrome.send('openWallpaperManager'); | 187 chrome.send('openWallpaperManager'); |
185 chrome.send('coreOptionsUserMetricsAction', | 188 chrome.send('coreOptionsUserMetricsAction', |
186 ['Options_OpenWallpaperManager']); | 189 ['Options_OpenWallpaperManager']); |
187 }; | 190 }; |
188 } | 191 } |
189 | 192 |
190 $('themes-gallery').onclick = function(event) { | 193 $('themes-gallery').onclick = function(event) { |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 else | 986 else |
984 this.hideSectionWithAnimation_(section, container); | 987 this.hideSectionWithAnimation_(section, container); |
985 } else { | 988 } else { |
986 section.hidden = !event.value.value; | 989 section.hidden = !event.value.value; |
987 this.onShowHomeButtonChangedCalled_ = true; | 990 this.onShowHomeButtonChangedCalled_ = true; |
988 } | 991 } |
989 }, | 992 }, |
990 | 993 |
991 /** | 994 /** |
992 * Activates the Hotword section from the System settings page. | 995 * Activates the Hotword section from the System settings page. |
| 996 * @param {string} opt_error The error message to display. |
| 997 * @param {string} opt_help_link The link to a troubleshooting page. |
993 * @private | 998 * @private |
994 */ | 999 */ |
995 showHotwordSection_: function(opt_error) { | 1000 showHotwordSection_: function(opt_error, opt_help_link) { |
996 $('hotword-search').hidden = false; | 1001 $('hotword-search').hidden = false; |
| 1002 $('hotword-search-setting-indicator').errorText = opt_error; |
| 1003 $('hotword-search-setting-indicator').helpLink = opt_help_link; |
997 }, | 1004 }, |
998 | 1005 |
999 /** | 1006 /** |
1000 * Event listener for the 'homepage is NTP' preference. Updates the label | 1007 * Event listener for the 'homepage is NTP' preference. Updates the label |
1001 * next to the 'Change' button. | 1008 * next to the 'Change' button. |
1002 * @param {Event} event The preference change event. | 1009 * @param {Event} event The preference change event. |
1003 */ | 1010 */ |
1004 onHomePageIsNtpChanged_: function(event) { | 1011 onHomePageIsNtpChanged_: function(event) { |
1005 if (!event.value.uncommitted) { | 1012 if (!event.value.uncommitted) { |
1006 $('home-page-url').hidden = event.value.value; | 1013 $('home-page-url').hidden = event.value.value; |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 BrowserOptions.getLoggedInUsername = function() { | 1829 BrowserOptions.getLoggedInUsername = function() { |
1823 return BrowserOptions.getInstance().username_; | 1830 return BrowserOptions.getInstance().username_; |
1824 }; | 1831 }; |
1825 } | 1832 } |
1826 | 1833 |
1827 // Export | 1834 // Export |
1828 return { | 1835 return { |
1829 BrowserOptions: BrowserOptions | 1836 BrowserOptions: BrowserOptions |
1830 }; | 1837 }; |
1831 }); | 1838 }); |
OLD | NEW |