Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6723)

Unified Diff: chrome/browser/resources/options/browser_options.js

Issue 693393004: Add error indicators to always-on andno-dsp hotword checkboxes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove error conditions used for testing Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
+ * @param {string} indicator_id The id of the indicator to display.
* @param {string} opt_error The error message to display.
* @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.
+ * @private
+ */
+ showHotwordSection_: function(opt_error) {
+ this.showHotwordCheckboxAndIndicator_('hotword-search',
+ '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) {
+ this.showHotwordCheckboxAndIndicator_('hotword-no-dsp-search',
+ 'hotword-no-dsp-search-setting-indicator',
+ opt_error);
},
/**

Powered by Google App Engine
This is Rietveld 408576698