| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 }; | 130 }; |
| 118 | 131 |
| 119 ContentSettings.updateHandlersEnabledRadios = function(enabled) { | 132 ContentSettings.updateHandlersEnabledRadios = function(enabled) { |
| 120 var selector = '#content-settings-page input[type=radio][value=' + | 133 var selector = '#content-settings-page input[type=radio][value=' + |
| 121 (enabled ? 'allow' : 'block') + '].handler-radio'; | 134 (enabled ? 'allow' : 'block') + '].handler-radio'; |
| 122 document.querySelector(selector).checked = true; | 135 document.querySelector(selector).checked = true; |
| 123 }; | 136 }; |
| 124 | 137 |
| 125 /** | 138 /** |
| 126 * Sets the values for all the content settings radios and labels. | 139 * Sets the values for all the content settings radios and labels. |
| 127 * @param {Object} dict A mapping from radio groups to the checked value for | 140 * @param {Object.<string, {managedBy: string, value: string}>} dict A mapping |
| 128 * that group. | 141 * from radio groups to the checked value for that group. |
| 129 */ | 142 */ |
| 130 ContentSettings.setContentFilterSettingsValue = function(dict) { | 143 ContentSettings.setContentFilterSettingsValue = function(dict) { |
| 131 for (var group in dict) { | 144 for (var group in dict) { |
| 132 var settingLabel = $(group + '-default-string'); | 145 var settingLabel = $(group + '-default-string'); |
| 133 if (settingLabel) { | 146 if (settingLabel) { |
| 134 var value = dict[group].value; | 147 var value = dict[group].value; |
| 135 var valueId = | 148 var valueId = |
| 136 permissionsLookup[group] + value[0].toUpperCase() + value.slice(1); | 149 permissionsLookup[group] + value[0].toUpperCase() + value.slice(1); |
| 137 settingLabel.textContent = loadTimeData.getString(valueId); | 150 settingLabel.textContent = loadTimeData.getString(valueId); |
| 138 } | 151 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 'textpolicy', loadTimeData.getString(mediaSettings.bubbleText)); | 217 'textpolicy', loadTimeData.getString(mediaSettings.bubbleText)); |
| 205 $('media-indicator').location = cr.ui.ArrowLocation.TOP_START; | 218 $('media-indicator').location = cr.ui.ArrowLocation.TOP_START; |
| 206 } | 219 } |
| 207 | 220 |
| 208 $('media-indicator').handlePrefChange(event); | 221 $('media-indicator').handlePrefChange(event); |
| 209 }; | 222 }; |
| 210 | 223 |
| 211 /** | 224 /** |
| 212 * Initializes an exceptions list. | 225 * Initializes an exceptions list. |
| 213 * @param {string} type The content type that we are setting exceptions for. | 226 * @param {string} type The content type that we are setting exceptions for. |
| 214 * @param {Array} exceptions An array of pairs, where the first element of | 227 * @param {Array.<options.Exception>} exceptions An array of pairs, where the |
| 215 * each pair is the filter string, and the second is the setting | 228 * first element of each pair is the filter string, and the second is the |
| 216 * (allow/block). | 229 * setting (allow/block). |
| 217 */ | 230 */ |
| 218 ContentSettings.setExceptions = function(type, exceptions) { | 231 ContentSettings.setExceptions = function(type, exceptions) { |
| 219 this.getExceptionsList(type, 'normal').setExceptions(exceptions); | 232 this.getExceptionsList(type, 'normal').setExceptions(exceptions); |
| 220 }; | 233 }; |
| 221 | 234 |
| 222 ContentSettings.setHandlers = function(handlers) { | 235 ContentSettings.setHandlers = function(handlers) { |
| 223 $('handlers-list').setHandlers(handlers); | 236 $('handlers-list').setHandlers(handlers); |
| 224 }; | 237 }; |
| 225 | 238 |
| 226 ContentSettings.setIgnoredHandlers = function(ignoredHandlers) { | 239 ContentSettings.setIgnoredHandlers = function(ignoredHandlers) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 var deviceSelect = $('media-select-camera'); | 366 var deviceSelect = $('media-select-camera'); |
| 354 chrome.send('setDefaultCaptureDevice', ['camera', deviceSelect.value]); | 367 chrome.send('setDefaultCaptureDevice', ['camera', deviceSelect.value]); |
| 355 }; | 368 }; |
| 356 | 369 |
| 357 // Export | 370 // Export |
| 358 return { | 371 return { |
| 359 ContentSettings: ContentSettings | 372 ContentSettings: ContentSettings |
| 360 }; | 373 }; |
| 361 | 374 |
| 362 }); | 375 }); |
| OLD | NEW |