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

Side by Side 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 unified diff | Download patch
OLDNEW
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.exportPath('options'); 5 cr.exportPath('options');
6 6
7 /** 7 /**
8 * @typedef {{actionLinkText: (string|undefined), 8 * @typedef {{actionLinkText: (string|undefined),
9 * hasError: (boolean|undefined), 9 * hasError: (boolean|undefined),
10 * hasUnrecoverableError: (boolean|undefined), 10 * hasUnrecoverableError: (boolean|undefined),
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 this.onHomePageChanged_.bind(this)); 217 this.onHomePageChanged_.bind(this));
218 Preferences.getInstance().addEventListener('homepage_is_newtabpage', 218 Preferences.getInstance().addEventListener('homepage_is_newtabpage',
219 this.onHomePageIsNtpChanged_.bind(this)); 219 this.onHomePageIsNtpChanged_.bind(this));
220 220
221 $('change-home-page').onclick = function(event) { 221 $('change-home-page').onclick = function(event) {
222 PageManager.showPageByName('homePageOverlay'); 222 PageManager.showPageByName('homePageOverlay');
223 chrome.send('coreOptionsUserMetricsAction', 223 chrome.send('coreOptionsUserMetricsAction',
224 ['Options_Homepage_ShowSettings']); 224 ['Options_Homepage_ShowSettings']);
225 }; 225 };
226 226
227 var hotwordIndicator = $('hotword-search-setting-indicator'); 227 HotwordSearchSettingIndicator.decorate(
228 HotwordSearchSettingIndicator.decorate(hotwordIndicator); 228 $('hotword-search-setting-indicator'));
229 HotwordSearchSettingIndicator.decorate(
230 $('hotword-no-dsp-search-setting-indicator'));
231 HotwordSearchSettingIndicator.decorate(
232 $('hotword-always-on-search-setting-indicator'));
229 chrome.send('requestHotwordAvailable'); 233 chrome.send('requestHotwordAvailable');
230 234
231 if ($('set-wallpaper')) { 235 if ($('set-wallpaper')) {
232 $('set-wallpaper').onclick = function(event) { 236 $('set-wallpaper').onclick = function(event) {
233 chrome.send('openWallpaperManager'); 237 chrome.send('openWallpaperManager');
234 chrome.send('coreOptionsUserMetricsAction', 238 chrome.send('coreOptionsUserMetricsAction',
235 ['Options_OpenWallpaperManager']); 239 ['Options_OpenWallpaperManager']);
236 }; 240 };
237 } 241 }
238 242
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 else 1124 else
1121 this.hideSectionWithAnimation_(section, container); 1125 this.hideSectionWithAnimation_(section, container);
1122 } else { 1126 } else {
1123 section.hidden = !event.value.value; 1127 section.hidden = !event.value.value;
1124 this.onShowHomeButtonChangedCalled_ = true; 1128 this.onShowHomeButtonChangedCalled_ = true;
1125 } 1129 }
1126 }, 1130 },
1127 1131
1128 /** 1132 /**
1129 * Activates the Hotword section from the System settings page. 1133 * Activates the Hotword section from the System settings page.
1130 * @param {boolean} opt_enabled Current preference state for hotwording. 1134 * @param {string} section_id The id of the section to display.
1135 * @param {string} indicator_id The id of the indicator to display.
1131 * @param {string} opt_error The error message to display. 1136 * @param {string} opt_error The error message to display.
1132 * @private 1137 * @private
1133 */ 1138 */
1134 showHotwordSection_: function(opt_enabled, opt_error) { 1139 showHotwordCheckboxAndIndicator_: function(section_id, indicator_id,
1135 $('hotword-search').hidden = false; 1140 opt_error) {
1136 $('hotword-search-setting-indicator').setError(opt_error); 1141 $(section_id).hidden = false;
1137 if (opt_enabled && opt_error) 1142 $(indicator_id).setError(opt_error);
1138 $('hotword-search-setting-indicator').updateBasedOnError(); 1143 if (opt_error)
1144 $(indicator_id).updateBasedOnError();
1145 },
1146
1147 /**
1148 * Activates the Hotword section from the System settings page.
1149 * @param {string} opt_error The error message to display.
1150 * @private
1151 */
1152 showHotwordSection_: function(opt_error) {
1153 this.showHotwordCheckboxAndIndicator_('hotword-search',
1154 'hotword-search-setting-indicator',
1155 opt_error);
1139 }, 1156 },
1140 1157
1141 /** 1158 /**
1142 * Activates the Audio History and Always-On Hotword sections from the 1159 * Activates the Audio History and Always-On Hotword sections from the
1143 * System settings page. 1160 * System settings page.
1161 * @param {string} opt_error The error message to display.
1144 * @private 1162 * @private
1145 */ 1163 */
1146 showHotwordAlwaysOnSection_: function() { 1164 showHotwordAlwaysOnSection_: function(opt_error) {
1147 $('hotword-always-on-search').hidden = false; 1165 this.showHotwordCheckboxAndIndicator_('hotword-always-on-search',
1166 'hotword-always-on-search-setting-indicator',
1167 opt_error);
1148 $('audio-logging').hidden = false; 1168 $('audio-logging').hidden = false;
1149 }, 1169 },
1150 1170
1151 /** 1171 /**
1152 * Activates the Hotword section on devices with no DSP 1172 * Activates the Hotword section on devices with no DSP
1153 * from the System settings page. 1173 * from the System settings page.
1174 * @param {string} opt_error The error message to display.
1154 * @private 1175 * @private
1155 */ 1176 */
1156 showHotwordNoDSPSection_: function() { 1177 showHotwordNoDSPSection_: function(opt_error) {
1157 $('hotword-no-dsp-search').hidden = false; 1178 this.showHotwordCheckboxAndIndicator_('hotword-no-dsp-search',
1179 'hotword-no-dsp-search-setting-indicator',
1180 opt_error);
1158 }, 1181 },
1159 1182
1160 /** 1183 /**
1161 * Event listener for the 'homepage is NTP' preference. Updates the label 1184 * Event listener for the 'homepage is NTP' preference. Updates the label
1162 * next to the 'Change' button. 1185 * next to the 'Change' button.
1163 * @param {Event} event The preference change event. 1186 * @param {Event} event The preference change event.
1164 */ 1187 */
1165 onHomePageIsNtpChanged_: function(event) { 1188 onHomePageIsNtpChanged_: function(event) {
1166 if (!event.value.uncommitted) { 1189 if (!event.value.uncommitted) {
1167 $('home-page-url').hidden = event.value.value; 1190 $('home-page-url').hidden = event.value.value;
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 } 2139 }
2117 button.textContent = loadTimeData.getString(strId); 2140 button.textContent = loadTimeData.getString(strId);
2118 }; 2141 };
2119 } 2142 }
2120 2143
2121 // Export 2144 // Export
2122 return { 2145 return {
2123 BrowserOptions: BrowserOptions 2146 BrowserOptions: BrowserOptions
2124 }; 2147 };
2125 }); 2148 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698