| 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'); |
| 6 |
| 7 /** |
| 8 * @typedef {{appId: string, |
| 9 * appName: (string|undefined), |
| 10 * embeddingOrigin: (string|undefined), |
| 11 * origin: string, |
| 12 * setting: string, |
| 13 * source: string, |
| 14 * video: (string|undefined)}} |
| 15 */ |
| 16 options.Exception; |
| 17 |
| 5 cr.define('options', function() { | 18 cr.define('options', function() { |
| 6 /** @const */ var Page = cr.ui.pageManager.Page; | 19 /** @const */ var Page = cr.ui.pageManager.Page; |
| 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 20 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
| 8 | 21 |
| 9 // Lookup table to generate the i18n strings. | 22 // Lookup table to generate the i18n strings. |
| 10 /** @const */ var permissionsLookup = { | 23 /** @const */ var permissionsLookup = { |
| 11 'location': 'location', | 24 'location': 'location', |
| 12 'notifications': 'notifications', | 25 'notifications': 'notifications', |
| 13 'media-stream': 'mediaStream', | 26 'media-stream': 'mediaStream', |
| 14 'cookies': 'cookies', | 27 'cookies': 'cookies', |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 }; | 124 }; |
| 112 | 125 |
| 113 ContentSettings.updateHandlersEnabledRadios = function(enabled) { | 126 ContentSettings.updateHandlersEnabledRadios = function(enabled) { |
| 114 var selector = '#content-settings-page input[type=radio][value=' + | 127 var selector = '#content-settings-page input[type=radio][value=' + |
| 115 (enabled ? 'allow' : 'block') + '].handler-radio'; | 128 (enabled ? 'allow' : 'block') + '].handler-radio'; |
| 116 document.querySelector(selector).checked = true; | 129 document.querySelector(selector).checked = true; |
| 117 }; | 130 }; |
| 118 | 131 |
| 119 /** | 132 /** |
| 120 * Sets the values for all the content settings radios and labels. | 133 * Sets the values for all the content settings radios and labels. |
| 121 * @param {Object} dict A mapping from radio groups to the checked value for | 134 * @param {Object.<string, {managedBy: string, value: string}>} dict A mapping |
| 122 * that group. | 135 * from radio groups to the checked value for that group. |
| 123 */ | 136 */ |
| 124 ContentSettings.setContentFilterSettingsValue = function(dict) { | 137 ContentSettings.setContentFilterSettingsValue = function(dict) { |
| 125 for (var group in dict) { | 138 for (var group in dict) { |
| 126 var settingLabel = $(group + '-default-string'); | 139 var settingLabel = $(group + '-default-string'); |
| 127 if (settingLabel) { | 140 if (settingLabel) { |
| 128 var value = dict[group].value; | 141 var value = dict[group].value; |
| 129 var valueId = | 142 var valueId = |
| 130 permissionsLookup[group] + value[0].toUpperCase() + value.slice(1); | 143 permissionsLookup[group] + value[0].toUpperCase() + value.slice(1); |
| 131 settingLabel.textContent = loadTimeData.getString(valueId); | 144 settingLabel.textContent = loadTimeData.getString(valueId); |
| 132 } | 145 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 'textpolicy', loadTimeData.getString(mediaSettings.bubbleText)); | 211 'textpolicy', loadTimeData.getString(mediaSettings.bubbleText)); |
| 199 $('media-indicator').location = cr.ui.ArrowLocation.TOP_START; | 212 $('media-indicator').location = cr.ui.ArrowLocation.TOP_START; |
| 200 } | 213 } |
| 201 | 214 |
| 202 $('media-indicator').handlePrefChange(event); | 215 $('media-indicator').handlePrefChange(event); |
| 203 }; | 216 }; |
| 204 | 217 |
| 205 /** | 218 /** |
| 206 * Initializes an exceptions list. | 219 * Initializes an exceptions list. |
| 207 * @param {string} type The content type that we are setting exceptions for. | 220 * @param {string} type The content type that we are setting exceptions for. |
| 208 * @param {Array} exceptions An array of pairs, where the first element of | 221 * @param {Array.<options.Exception>} exceptions An array of pairs, where the |
| 209 * each pair is the filter string, and the second is the setting | 222 * first element of each pair is the filter string, and the second is the |
| 210 * (allow/block). | 223 * setting (allow/block). |
| 211 */ | 224 */ |
| 212 ContentSettings.setExceptions = function(type, exceptions) { | 225 ContentSettings.setExceptions = function(type, exceptions) { |
| 213 this.getExceptionsList(type, 'normal').setExceptions(exceptions); | 226 this.getExceptionsList(type, 'normal').setExceptions(exceptions); |
| 214 }; | 227 }; |
| 215 | 228 |
| 216 ContentSettings.setHandlers = function(handlers) { | 229 ContentSettings.setHandlers = function(handlers) { |
| 217 $('handlers-list').setHandlers(handlers); | 230 $('handlers-list').setHandlers(handlers); |
| 218 }; | 231 }; |
| 219 | 232 |
| 220 ContentSettings.setIgnoredHandlers = function(ignoredHandlers) { | 233 ContentSettings.setIgnoredHandlers = function(ignoredHandlers) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 var deviceSelect = $('media-select-camera'); | 360 var deviceSelect = $('media-select-camera'); |
| 348 chrome.send('setDefaultCaptureDevice', ['camera', deviceSelect.value]); | 361 chrome.send('setDefaultCaptureDevice', ['camera', deviceSelect.value]); |
| 349 }; | 362 }; |
| 350 | 363 |
| 351 // Export | 364 // Export |
| 352 return { | 365 return { |
| 353 ContentSettings: ContentSettings | 366 ContentSettings: ContentSettings |
| 354 }; | 367 }; |
| 355 | 368 |
| 356 }); | 369 }); |
| OLD | NEW |