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 /** @const */ var Page = cr.ui.pageManager.Page; | 6 /** @const */ var Page = cr.ui.pageManager.Page; |
7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
8 | 8 |
9 ////////////////////////////////////////////////////////////////////////////// | 9 ////////////////////////////////////////////////////////////////////////////// |
10 // ContentSettings class: | 10 // ContentSettings class: |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // Settings for Guest hides many sections, so check for null first. | 187 // Settings for Guest hides many sections, so check for null first. |
188 if (exceptionsList) { | 188 if (exceptionsList) { |
189 exceptionsList.parentNode.hidden = false; | 189 exceptionsList.parentNode.hidden = false; |
190 exceptionsList.setExceptions(otrExceptions); | 190 exceptionsList.setExceptions(otrExceptions); |
191 } | 191 } |
192 }; | 192 }; |
193 | 193 |
194 /** | 194 /** |
195 * @param {string} type The type of exceptions (e.g. "location") to get. | 195 * @param {string} type The type of exceptions (e.g. "location") to get. |
196 * @param {string} mode The mode of the desired exceptions list (e.g. otr). | 196 * @param {string} mode The mode of the desired exceptions list (e.g. otr). |
197 * @return {?ExceptionsList} The corresponding exceptions list or null. | 197 * @return {?options.contentSettings.ExceptionsList} The corresponding |
| 198 * exceptions list or null. |
198 */ | 199 */ |
199 ContentSettings.getExceptionsList = function(type, mode) { | 200 ContentSettings.getExceptionsList = function(type, mode) { |
200 return document.querySelector( | 201 return document.querySelector( |
201 'div[contentType=' + type + '] list[mode=' + mode + ']'); | 202 'div[contentType=' + type + '] list[mode=' + mode + ']'); |
202 }; | 203 }; |
203 | 204 |
204 /** | 205 /** |
205 * The browser's response to a request to check the validity of a given URL | 206 * The browser's response to a request to check the validity of a given URL |
206 * pattern. | 207 * pattern. |
207 * @param {string} type The content type. | 208 * @param {string} type The content type. |
208 * @param {string} mode The browser mode. | 209 * @param {string} mode The browser mode. |
209 * @param {string} pattern The pattern. | 210 * @param {string} pattern The pattern. |
210 * @param {bool} valid Whether said pattern is valid in the context of | 211 * @param {boolean} valid Whether said pattern is valid in the context of |
211 * a content exception setting. | 212 * a content exception setting. |
212 */ | 213 */ |
213 ContentSettings.patternValidityCheckComplete = | 214 ContentSettings.patternValidityCheckComplete = |
214 function(type, mode, pattern, valid) { | 215 function(type, mode, pattern, valid) { |
215 this.getExceptionsList(type, mode).patternValidityCheckComplete(pattern, | 216 this.getExceptionsList(type, mode).patternValidityCheckComplete(pattern, |
216 valid); | 217 valid); |
217 }; | 218 }; |
218 | 219 |
219 /** | 220 /** |
220 * Shows/hides the link to the Pepper Flash camera and microphone default | 221 * Shows/hides the link to the Pepper Flash camera and microphone default |
(...skipping 10 matching lines...) Expand all Loading... |
231 * site-specific settings. | 232 * site-specific settings. |
232 * Please note that whether the link is actually showed or not is also | 233 * Please note that whether the link is actually showed or not is also |
233 * affected by the style class pepper-flash-settings. | 234 * affected by the style class pepper-flash-settings. |
234 */ | 235 */ |
235 ContentSettings.showMediaPepperFlashExceptionsLink = function(show) { | 236 ContentSettings.showMediaPepperFlashExceptionsLink = function(show) { |
236 $('media-pepper-flash-exceptions').hidden = !show; | 237 $('media-pepper-flash-exceptions').hidden = !show; |
237 }; | 238 }; |
238 | 239 |
239 /** | 240 /** |
240 * Shows/hides the whole Web MIDI settings. | 241 * Shows/hides the whole Web MIDI settings. |
241 * @param {bool} show Wether to show the whole Web MIDI settings. | 242 * @param {boolean} show Wether to show the whole Web MIDI settings. |
242 */ | 243 */ |
243 ContentSettings.showExperimentalWebMIDISettings = function(show) { | 244 ContentSettings.showExperimentalWebMIDISettings = function(show) { |
244 $('experimental-web-midi-settings').hidden = !show; | 245 $('experimental-web-midi-settings').hidden = !show; |
245 }; | 246 }; |
246 | 247 |
247 /** | 248 /** |
248 * Updates the microphone/camera devices menu with the given entries. | 249 * Updates the microphone/camera devices menu with the given entries. |
249 * @param {string} type The device type. | 250 * @param {string} type The device type. |
250 * @param {Array} devices List of available devices. | 251 * @param {Array} devices List of available devices. |
251 * @param {string} defaultdevice The unique id of the current default device. | 252 * @param {string} defaultdevice The unique id of the current default device. |
(...skipping 20 matching lines...) Expand all Loading... |
272 if (option.value == defaultdevice) | 273 if (option.value == defaultdevice) |
273 defaultIndex = i; | 274 defaultIndex = i; |
274 deviceSelect.appendChild(option); | 275 deviceSelect.appendChild(option); |
275 } | 276 } |
276 if (defaultIndex >= 0) | 277 if (defaultIndex >= 0) |
277 deviceSelect.selectedIndex = defaultIndex; | 278 deviceSelect.selectedIndex = defaultIndex; |
278 }; | 279 }; |
279 | 280 |
280 /** | 281 /** |
281 * Enables/disables the protected content exceptions button. | 282 * Enables/disables the protected content exceptions button. |
282 * @param {bool} enable Whether to enable the button. | 283 * @param {boolean} enable Whether to enable the button. |
283 */ | 284 */ |
284 ContentSettings.enableProtectedContentExceptions = function(enable) { | 285 ContentSettings.enableProtectedContentExceptions = function(enable) { |
285 var exceptionsButton = $('protected-content-exceptions'); | 286 var exceptionsButton = $('protected-content-exceptions'); |
286 if (exceptionsButton) | 287 if (exceptionsButton) |
287 exceptionsButton.disabled = !enable; | 288 exceptionsButton.disabled = !enable; |
288 }; | 289 }; |
289 | 290 |
290 /** | 291 /** |
291 * Set the default microphone device based on the popup selection. | 292 * Set the default microphone device based on the popup selection. |
292 * @private | 293 * @private |
(...skipping 11 matching lines...) Expand all Loading... |
304 var deviceSelect = $('media-select-camera'); | 305 var deviceSelect = $('media-select-camera'); |
305 chrome.send('setDefaultCaptureDevice', ['camera', deviceSelect.value]); | 306 chrome.send('setDefaultCaptureDevice', ['camera', deviceSelect.value]); |
306 }; | 307 }; |
307 | 308 |
308 // Export | 309 // Export |
309 return { | 310 return { |
310 ContentSettings: ContentSettings | 311 ContentSettings: ContentSettings |
311 }; | 312 }; |
312 | 313 |
313 }); | 314 }); |
OLD | NEW |