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

Side by Side Diff: chrome/browser/resources/options/content_settings.js

Issue 566063002: Compile chrome://settings, part 8: the final battle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@H_options_errors_6
Patch Set: fixed comments Created 6 years, 3 months 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');
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 ////////////////////////////////////////////////////////////////////////////// 22 //////////////////////////////////////////////////////////////////////////////
10 // ContentSettings class: 23 // ContentSettings class:
11 24
12 /** 25 /**
13 * Encapsulated handling of content settings page. 26 * Encapsulated handling of content settings page.
14 * @constructor 27 * @constructor
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 }; 96 };
84 97
85 ContentSettings.updateHandlersEnabledRadios = function(enabled) { 98 ContentSettings.updateHandlersEnabledRadios = function(enabled) {
86 var selector = '#content-settings-page input[type=radio][value=' + 99 var selector = '#content-settings-page input[type=radio][value=' +
87 (enabled ? 'allow' : 'block') + '].handler-radio'; 100 (enabled ? 'allow' : 'block') + '].handler-radio';
88 document.querySelector(selector).checked = true; 101 document.querySelector(selector).checked = true;
89 }; 102 };
90 103
91 /** 104 /**
92 * Sets the values for all the content settings radios. 105 * Sets the values for all the content settings radios.
93 * @param {Object} dict A mapping from radio groups to the checked value for 106 * @param {Object.<string, {managedBy: string, value: string}>} dict A mapping
94 * that group. 107 * from radio groups to the checked value for that group.
95 */ 108 */
96 ContentSettings.setContentFilterSettingsValue = function(dict) { 109 ContentSettings.setContentFilterSettingsValue = function(dict) {
97 for (var group in dict) { 110 for (var group in dict) {
98 var managedBy = dict[group].managedBy; 111 var managedBy = dict[group].managedBy;
99 var controlledBy = managedBy == 'policy' || managedBy == 'extension' ? 112 var controlledBy = managedBy == 'policy' || managedBy == 'extension' ?
100 managedBy : null; 113 managedBy : null;
101 document.querySelector('input[type=radio][name=' + group + '][value=' + 114 document.querySelector('input[type=radio][name=' + group + '][value=' +
102 dict[group].value + ']').checked = true; 115 dict[group].value + ']').checked = true;
103 var radios = document.querySelectorAll('input[type=radio][name=' + 116 var radios = document.querySelectorAll('input[type=radio][name=' +
104 group + ']'); 117 group + ']');
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 'textpolicy', loadTimeData.getString(mediaSettings.bubbleText)); 175 'textpolicy', loadTimeData.getString(mediaSettings.bubbleText));
163 $('media-indicator').location = cr.ui.ArrowLocation.TOP_START; 176 $('media-indicator').location = cr.ui.ArrowLocation.TOP_START;
164 } 177 }
165 178
166 $('media-indicator').handlePrefChange(event); 179 $('media-indicator').handlePrefChange(event);
167 }; 180 };
168 181
169 /** 182 /**
170 * Initializes an exceptions list. 183 * Initializes an exceptions list.
171 * @param {string} type The content type that we are setting exceptions for. 184 * @param {string} type The content type that we are setting exceptions for.
172 * @param {Array} exceptions An array of pairs, where the first element of 185 * @param {Array.<options.Exception>} exceptions An array of pairs, where the
173 * each pair is the filter string, and the second is the setting 186 * first element of each pair is the filter string, and the second is the
174 * (allow/block). 187 * setting (allow/block).
175 */ 188 */
176 ContentSettings.setExceptions = function(type, exceptions) { 189 ContentSettings.setExceptions = function(type, exceptions) {
177 this.getExceptionsList(type, 'normal').setExceptions(exceptions); 190 this.getExceptionsList(type, 'normal').setExceptions(exceptions);
178 }; 191 };
179 192
180 ContentSettings.setHandlers = function(handlers) { 193 ContentSettings.setHandlers = function(handlers) {
181 $('handlers-list').setHandlers(handlers); 194 $('handlers-list').setHandlers(handlers);
182 }; 195 };
183 196
184 ContentSettings.setIgnoredHandlers = function(ignoredHandlers) { 197 ContentSettings.setIgnoredHandlers = function(ignoredHandlers) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 var deviceSelect = $('media-select-camera'); 324 var deviceSelect = $('media-select-camera');
312 chrome.send('setDefaultCaptureDevice', ['camera', deviceSelect.value]); 325 chrome.send('setDefaultCaptureDevice', ['camera', deviceSelect.value]);
313 }; 326 };
314 327
315 // Export 328 // Export
316 return { 329 return {
317 ContentSettings: ContentSettings 330 ContentSettings: ContentSettings
318 }; 331 };
319 332
320 }); 333 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698