| 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.exportPath('options'); | 5 cr.exportPath('options'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @typedef {{appId: string, | 8 * @typedef {{appId: string, |
| 9 * appName: (string|undefined), | 9 * appName: (string|undefined), |
| 10 * embeddingOrigin: (string|undefined), | 10 * embeddingOrigin: (string|undefined), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 ////////////////////////////////////////////////////////////////////////////// | 35 ////////////////////////////////////////////////////////////////////////////// |
| 36 // ContentSettings class: | 36 // ContentSettings class: |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * Encapsulated handling of content settings page. | 39 * Encapsulated handling of content settings page. |
| 40 * @constructor | 40 * @constructor |
| 41 * @extends {cr.ui.pageManager.Page} | 41 * @extends {cr.ui.pageManager.Page} |
| 42 */ | 42 */ |
| 43 function ContentSettings() { | 43 function ContentSettings() { |
| 44 this.activeNavTab = null; | 44 this.activeNavTab = null; |
| 45 this.pluginsAllowOptionDisabled = false; | |
| 46 Page.call(this, 'content', | 45 Page.call(this, 'content', |
| 47 loadTimeData.getString('contentSettingsPageTabTitle'), | 46 loadTimeData.getString('contentSettingsPageTabTitle'), |
| 48 'content-settings-page'); | 47 'content-settings-page'); |
| 49 } | 48 } |
| 50 | 49 |
| 51 cr.addSingletonGetter(ContentSettings); | 50 cr.addSingletonGetter(ContentSettings); |
| 52 | 51 |
| 53 ContentSettings.prototype = { | 52 ContentSettings.prototype = { |
| 54 __proto__: Page.prototype, | 53 __proto__: Page.prototype, |
| 55 | 54 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // CoreOptionsHandler::CreateValueForPref() does. | 163 // CoreOptionsHandler::CreateValueForPref() does. |
| 165 var event = new Event(group); | 164 var event = new Event(group); |
| 166 event.value = { | 165 event.value = { |
| 167 value: dict[group].value, | 166 value: dict[group].value, |
| 168 controlledBy: controlledBy, | 167 controlledBy: controlledBy, |
| 169 }; | 168 }; |
| 170 for (var i = 0; i < indicators.length; i++) { | 169 for (var i = 0; i < indicators.length; i++) { |
| 171 indicators[i].handlePrefChange(event); | 170 indicators[i].handlePrefChange(event); |
| 172 } | 171 } |
| 173 } | 172 } |
| 174 | |
| 175 if (this.pluginsAllowOptionDisabled) { | |
| 176 $('plugins-allow-radio').disabled = true; | |
| 177 } | |
| 178 }; | 173 }; |
| 179 | 174 |
| 180 /** | 175 /** |
| 181 * Updates the labels and indicators for the Media settings. Those require | 176 * Updates the labels and indicators for the Media settings. Those require |
| 182 * special handling because they are backed by multiple prefs and can change | 177 * special handling because they are backed by multiple prefs and can change |
| 183 * their scope based on the managed state of the backing prefs. | 178 * their scope based on the managed state of the backing prefs. |
| 184 * @param {{askText: string, blockText: string, cameraDisabled: boolean, | 179 * @param {{askText: string, blockText: string, cameraDisabled: boolean, |
| 185 * micDisabled: boolean, showBubble: boolean, bubbleText: string}} | 180 * micDisabled: boolean, showBubble: boolean, bubbleText: string}} |
| 186 * mediaSettings A dictionary containing the following fields: | 181 * mediaSettings A dictionary containing the following fields: |
| 187 * askText The label for the ask radio button. | 182 * askText The label for the ask radio button. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 * Shows/hides the link to the Pepper Flash camera and microphone | 286 * Shows/hides the link to the Pepper Flash camera and microphone |
| 292 * site-specific settings. | 287 * site-specific settings. |
| 293 * Please note that whether the link is actually showed or not is also | 288 * Please note that whether the link is actually showed or not is also |
| 294 * affected by the style class pepper-flash-settings. | 289 * affected by the style class pepper-flash-settings. |
| 295 */ | 290 */ |
| 296 ContentSettings.showMediaPepperFlashExceptionsLink = function(show) { | 291 ContentSettings.showMediaPepperFlashExceptionsLink = function(show) { |
| 297 $('media-pepper-flash-exceptions').hidden = !show; | 292 $('media-pepper-flash-exceptions').hidden = !show; |
| 298 }; | 293 }; |
| 299 | 294 |
| 300 /** | 295 /** |
| 301 * Disable the 'allow' option in the Plugins section. | |
| 302 */ | |
| 303 ContentSettings.disablePluginsAllowOption = function() { | |
| 304 this.pluginsAllowOptionDisabled = true; | |
| 305 $('plugins-allow-radio').disabled = true; | |
| 306 }; | |
| 307 | |
| 308 /** | |
| 309 * Updates the microphone/camera devices menu with the given entries. | 296 * Updates the microphone/camera devices menu with the given entries. |
| 310 * @param {string} type The device type. | 297 * @param {string} type The device type. |
| 311 * @param {Array} devices List of available devices. | 298 * @param {Array} devices List of available devices. |
| 312 * @param {string} defaultdevice The unique id of the current default device. | 299 * @param {string} defaultdevice The unique id of the current default device. |
| 313 */ | 300 */ |
| 314 ContentSettings.updateDevicesMenu = function(type, devices, defaultdevice) { | 301 ContentSettings.updateDevicesMenu = function(type, devices, defaultdevice) { |
| 315 var deviceSelect = ''; | 302 var deviceSelect = ''; |
| 316 if (type == 'mic') { | 303 if (type == 'mic') { |
| 317 deviceSelect = $('media-select-mic'); | 304 deviceSelect = $('media-select-mic'); |
| 318 } else if (type == 'camera') { | 305 } else if (type == 'camera') { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 var deviceSelect = $('media-select-camera'); | 352 var deviceSelect = $('media-select-camera'); |
| 366 chrome.send('setDefaultCaptureDevice', ['camera', deviceSelect.value]); | 353 chrome.send('setDefaultCaptureDevice', ['camera', deviceSelect.value]); |
| 367 }; | 354 }; |
| 368 | 355 |
| 369 // Export | 356 // Export |
| 370 return { | 357 return { |
| 371 ContentSettings: ContentSettings | 358 ContentSettings: ContentSettings |
| 372 }; | 359 }; |
| 373 | 360 |
| 374 }); | 361 }); |
| OLD | NEW |