Chromium Code Reviews| Index: chrome/browser/resources/options/browser_options.js |
| diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js |
| index d76376337ce525b31456da3d9ce92c15d2b74197..e1eb52696e095046060a8a5c82d198b88c49cfc9 100644 |
| --- a/chrome/browser/resources/options/browser_options.js |
| +++ b/chrome/browser/resources/options/browser_options.js |
| @@ -224,8 +224,12 @@ cr.define('options', function() { |
| ['Options_Homepage_ShowSettings']); |
| }; |
| - var hotwordIndicator = $('hotword-search-setting-indicator'); |
| - HotwordSearchSettingIndicator.decorate(hotwordIndicator); |
| + HotwordSearchSettingIndicator.decorate( |
| + $('hotword-search-setting-indicator')); |
| + HotwordSearchSettingIndicator.decorate( |
| + $('hotword-no-dsp-search-setting-indicator')); |
| + HotwordSearchSettingIndicator.decorate( |
| + $('hotword-always-on-search-setting-indicator')); |
| chrome.send('requestHotwordAvailable'); |
| if ($('set-wallpaper')) { |
| @@ -1127,34 +1131,53 @@ cr.define('options', function() { |
| /** |
| * Activates the Hotword section from the System settings page. |
| - * @param {boolean} opt_enabled Current preference state for hotwording. |
| + * @param {string} section_id The id of the section to display. |
|
Dan Beam
2014/11/04 02:03:46
jsVarsLikeThis, opt_varsIsSillyButPartOfTheStyleGu
kcarattini
2014/11/04 06:01:21
Done.
|
| + * @param {string} indicator_id The id of the indicator to display. |
| * @param {string} opt_error The error message to display. |
|
Dan Beam
2014/11/04 02:03:45
this should only be opt_ if the type is string= (i
kcarattini
2014/11/04 06:01:20
Done.
|
| * @private |
| */ |
| - showHotwordSection_: function(opt_enabled, opt_error) { |
| - $('hotword-search').hidden = false; |
| - $('hotword-search-setting-indicator').setError(opt_error); |
| - if (opt_enabled && opt_error) |
| - $('hotword-search-setting-indicator').updateBasedOnError(); |
| + showHotwordCheckboxAndIndicator_: function(section_id, indicator_id, |
| + opt_error) { |
| + $(section_id).hidden = false; |
| + $(indicator_id).setError(opt_error); |
| + if (opt_error) |
| + $(indicator_id).updateBasedOnError(); |
| + }, |
| + |
| + /** |
| + * Activates the Hotword section from the System settings page. |
| + * @param {string} opt_error The error message to display. |
|
Dan Beam
2014/11/04 02:03:46
string=
kcarattini
2014/11/04 06:01:20
Done.
|
| + * @private |
| + */ |
| + showHotwordSection_: function(opt_error) { |
| + this.showHotwordCheckboxAndIndicator_('hotword-search', |
|
Dan Beam
2014/11/04 02:03:46
nit: wrap first arg, e.g.
this.showHotwordCheck
kcarattini
2014/11/04 06:01:21
Done.
|
| + 'hotword-search-setting-indicator', |
| + opt_error); |
| }, |
| /** |
| * Activates the Audio History and Always-On Hotword sections from the |
| * System settings page. |
| + * @param {string} opt_error The error message to display. |
| * @private |
| */ |
| - showHotwordAlwaysOnSection_: function() { |
| - $('hotword-always-on-search').hidden = false; |
| + showHotwordAlwaysOnSection_: function(opt_error) { |
| + this.showHotwordCheckboxAndIndicator_('hotword-always-on-search', |
| + 'hotword-always-on-search-setting-indicator', |
| + opt_error); |
| $('audio-logging').hidden = false; |
| }, |
| /** |
| * Activates the Hotword section on devices with no DSP |
| * from the System settings page. |
| + * @param {string} opt_error The error message to display. |
| * @private |
| */ |
| - showHotwordNoDSPSection_: function() { |
| - $('hotword-no-dsp-search').hidden = false; |
| + showHotwordNoDSPSection_: function(opt_error) { |
|
Dan Beam
2014/11/04 02:03:46
nit: showHotwordNoDspSection_ (e.g. HttpUrl instea
kcarattini
2014/11/04 06:01:20
Done.
|
| + this.showHotwordCheckboxAndIndicator_('hotword-no-dsp-search', |
| + 'hotword-no-dsp-search-setting-indicator', |
| + opt_error); |
| }, |
| /** |