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

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: Rebase 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} sectionId The id of the section to display.
1131 * @param {string} opt_error The error message to display. 1135 * @param {string} indicatorId The id of the indicator 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(sectionId, indicatorId,
1135 $('hotword-search').hidden = false; 1140 opt_error) {
1136 $('hotword-search-setting-indicator').setError(opt_error); 1141 $(sectionId).hidden = false;
1137 if (opt_enabled && opt_error) 1142 $(indicatorId).setError(opt_error);
1138 $('hotword-search-setting-indicator').updateBasedOnError(); 1143 if (opt_error)
1144 $(indicatorId).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_(
1154 'hotword-search',
1155 'hotword-search-setting-indicator',
1156 opt_error);
1139 }, 1157 },
1140 1158
1141 /** 1159 /**
1142 * Activates the Audio History and Always-On Hotword sections from the 1160 * Activates the Audio History and Always-On Hotword sections from the
1143 * System settings page. 1161 * System settings page.
1162 * @param {string=} opt_error The error message to display.
1144 * @private 1163 * @private
1145 */ 1164 */
1146 showHotwordAlwaysOnSection_: function() { 1165 showHotwordAlwaysOnSection_: function(opt_error) {
1147 $('hotword-always-on-search').hidden = false; 1166 this.showHotwordCheckboxAndIndicator_(
1167 'hotword-always-on-search',
1168 'hotword-always-on-search-setting-indicator',
1169 opt_error);
1148 $('audio-logging').hidden = false; 1170 $('audio-logging').hidden = false;
1149 }, 1171 },
1150 1172
1151 /** 1173 /**
1152 * Activates the Hotword section on devices with no DSP 1174 * Activates the Hotword section on devices with no DSP
1153 * from the System settings page. 1175 * from the System settings page.
1176 * @param {string=} opt_error The error message to display.
1154 * @private 1177 * @private
1155 */ 1178 */
1156 showHotwordNoDSPSection_: function() { 1179 showHotwordNoDspSection_: function(opt_error) {
1157 $('hotword-no-dsp-search').hidden = false; 1180 this.showHotwordCheckboxAndIndicator_(
1181 'hotword-no-dsp-search',
1182 'hotword-no-dsp-search-setting-indicator',
1183 opt_error);
1158 }, 1184 },
1159 1185
1160 /** 1186 /**
1161 * Event listener for the 'homepage is NTP' preference. Updates the label 1187 * Event listener for the 'homepage is NTP' preference. Updates the label
1162 * next to the 'Change' button. 1188 * next to the 'Change' button.
1163 * @param {Event} event The preference change event. 1189 * @param {Event} event The preference change event.
1164 */ 1190 */
1165 onHomePageIsNtpChanged_: function(event) { 1191 onHomePageIsNtpChanged_: function(event) {
1166 if (!event.value.uncommitted) { 1192 if (!event.value.uncommitted) {
1167 $('home-page-url').hidden = event.value.value; 1193 $('home-page-url').hidden = event.value.value;
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
2047 'setSpokenFeedbackCheckboxState', 2073 'setSpokenFeedbackCheckboxState',
2048 'setThemesResetButtonEnabled', 2074 'setThemesResetButtonEnabled',
2049 'setVirtualKeyboardCheckboxState', 2075 'setVirtualKeyboardCheckboxState',
2050 'setupPageZoomSelector', 2076 'setupPageZoomSelector',
2051 'setupProxySettingsButton', 2077 'setupProxySettingsButton',
2052 'showBluetoothSettings', 2078 'showBluetoothSettings',
2053 'showCreateProfileError', 2079 'showCreateProfileError',
2054 'showCreateProfileSuccess', 2080 'showCreateProfileSuccess',
2055 'showCreateProfileWarning', 2081 'showCreateProfileWarning',
2056 'showHotwordAlwaysOnSection', 2082 'showHotwordAlwaysOnSection',
2057 'showHotwordNoDSPSection', 2083 'showHotwordNoDspSection',
2058 'showHotwordSection', 2084 'showHotwordSection',
2059 'showMouseControls', 2085 'showMouseControls',
2060 'showSupervisedUserImportError', 2086 'showSupervisedUserImportError',
2061 'showSupervisedUserImportSuccess', 2087 'showSupervisedUserImportSuccess',
2062 'showTouchpadControls', 2088 'showTouchpadControls',
2063 'toggleExtensionIndicators', 2089 'toggleExtensionIndicators',
2064 'updateAccountPicture', 2090 'updateAccountPicture',
2065 'updateAutoLaunchState', 2091 'updateAutoLaunchState',
2066 'updateDefaultBrowserState', 2092 'updateDefaultBrowserState',
2067 'updateEasyUnlock', 2093 'updateEasyUnlock',
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 } 2142 }
2117 button.textContent = loadTimeData.getString(strId); 2143 button.textContent = loadTimeData.getString(strId);
2118 }; 2144 };
2119 } 2145 }
2120 2146
2121 // Export 2147 // Export
2122 return { 2148 return {
2123 BrowserOptions: BrowserOptions 2149 BrowserOptions: BrowserOptions
2124 }; 2150 };
2125 }); 2151 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698