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

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

Issue 559423003: Compile chrome://settings, part 7. 33 errors left (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@H_options_errors_5
Patch Set: rebase 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.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 // Lookup table to generate the i18n strings. 9 // Lookup table to generate the i18n strings.
10 /** @const */ var permissionsLookup = { 10 /** @const */ var permissionsLookup = {
11 'location': 'location', 11 'location': 'location',
12 'notifications': 'notifications', 12 'notifications': 'notifications',
13 'media-stream': 'mediaStream', 13 'media-stream': 'mediaStream',
14 'cookies': 'cookies', 14 'cookies': 'cookies',
15 'multiple-automatic-downloads': 'multipleAutomaticDownloads', 15 'multiple-automatic-downloads': 'multipleAutomaticDownloads',
16 'images': 'images', 16 'images': 'images',
17 'plugins': 'plugins', 17 'plugins': 'plugins',
18 'popups': 'popups', 18 'popups': 'popups',
19 'javascript': 'javascript' 19 'javascript': 'javascript'
20 }; 20 };
21 21
22 ////////////////////////////////////////////////////////////////////////////// 22 //////////////////////////////////////////////////////////////////////////////
23 // ContentSettings class: 23 // ContentSettings class:
24 24
25 /** 25 /**
26 * Encapsulated handling of content settings page. 26 * Encapsulated handling of content settings page.
27 * @constructor 27 * @constructor
28 * @extends {cr.ui.pageManager.Page}
28 */ 29 */
29 function ContentSettings() { 30 function ContentSettings() {
30 this.activeNavTab = null; 31 this.activeNavTab = null;
31 Page.call(this, 'content', 32 Page.call(this, 'content',
32 loadTimeData.getString('contentSettingsPageTabTitle'), 33 loadTimeData.getString('contentSettingsPageTabTitle'),
33 'content-settings-page'); 34 'content-settings-page');
34 } 35 }
35 36
36 cr.addSingletonGetter(ContentSettings); 37 cr.addSingletonGetter(ContentSettings);
37 38
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 for (var i = 0; i < indicators.length; i++) { 156 for (var i = 0; i < indicators.length; i++) {
156 indicators[i].handlePrefChange(event); 157 indicators[i].handlePrefChange(event);
157 } 158 }
158 } 159 }
159 }; 160 };
160 161
161 /** 162 /**
162 * Updates the labels and indicators for the Media settings. Those require 163 * Updates the labels and indicators for the Media settings. Those require
163 * special handling because they are backed by multiple prefs and can change 164 * special handling because they are backed by multiple prefs and can change
164 * their scope based on the managed state of the backing prefs. 165 * their scope based on the managed state of the backing prefs.
165 * @param {Object} mediaSettings A dictionary containing the following fields: 166 * @param {{askText: string, blockText: string, cameraDisabled: boolean,
166 * {String} askText The label for the ask radio button. 167 * micDisabled: boolean, showBubble: boolean, bubbleText: string}}
167 * {String} blockText The label for the block radio button. 168 * mediaSettings A dictionary containing the following fields:
168 * {Boolean} cameraDisabled Whether to disable the camera dropdown. 169 * askText The label for the ask radio button.
169 * {Boolean} micDisabled Whether to disable the microphone dropdown. 170 * blockText The label for the block radio button.
170 * {Boolean} showBubble Wether to show the managed icon and bubble for the 171 * cameraDisabled Whether to disable the camera dropdown.
171 * media label. 172 * micDisabled Whether to disable the microphone dropdown.
172 * {String} bubbleText The text to use inside the bubble if it is shown. 173 * showBubble Wether to show the managed icon and bubble for the media
174 * label.
175 * bubbleText The text to use inside the bubble if it is shown.
173 */ 176 */
174 ContentSettings.updateMediaUI = function(mediaSettings) { 177 ContentSettings.updateMediaUI = function(mediaSettings) {
175 $('media-stream-ask-label').innerHTML = 178 $('media-stream-ask-label').innerHTML =
176 loadTimeData.getString(mediaSettings.askText); 179 loadTimeData.getString(mediaSettings.askText);
177 $('media-stream-block-label').innerHTML = 180 $('media-stream-block-label').innerHTML =
178 loadTimeData.getString(mediaSettings.blockText); 181 loadTimeData.getString(mediaSettings.blockText);
179 182
180 if (mediaSettings.micDisabled) 183 if (mediaSettings.micDisabled)
181 $('media-select-mic').disabled = true; 184 $('media-select-mic').disabled = true;
182 if (mediaSettings.cameraDisabled) 185 if (mediaSettings.cameraDisabled)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 230 }
228 }; 231 };
229 232
230 /** 233 /**
231 * @param {string} type The type of exceptions (e.g. "location") to get. 234 * @param {string} type The type of exceptions (e.g. "location") to get.
232 * @param {string} mode The mode of the desired exceptions list (e.g. otr). 235 * @param {string} mode The mode of the desired exceptions list (e.g. otr).
233 * @return {?options.contentSettings.ExceptionsList} The corresponding 236 * @return {?options.contentSettings.ExceptionsList} The corresponding
234 * exceptions list or null. 237 * exceptions list or null.
235 */ 238 */
236 ContentSettings.getExceptionsList = function(type, mode) { 239 ContentSettings.getExceptionsList = function(type, mode) {
237 return document.querySelector( 240 var exceptionsList = document.querySelector(
238 'div[contentType=' + type + '] list[mode=' + mode + ']'); 241 'div[contentType=' + type + '] list[mode=' + mode + ']');
242 return !exceptionsList ? null :
243 assertInstanceof(exceptionsList,
244 options.contentSettings.ExceptionsList);
239 }; 245 };
240 246
241 /** 247 /**
242 * The browser's response to a request to check the validity of a given URL 248 * The browser's response to a request to check the validity of a given URL
243 * pattern. 249 * pattern.
244 * @param {string} type The content type. 250 * @param {string} type The content type.
245 * @param {string} mode The browser mode. 251 * @param {string} mode The browser mode.
246 * @param {string} pattern The pattern. 252 * @param {string} pattern The pattern.
247 * @param {boolean} valid Whether said pattern is valid in the context of 253 * @param {boolean} valid Whether said pattern is valid in the context of
248 * a content exception setting. 254 * a content exception setting.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 var deviceSelect = $('media-select-camera'); 347 var deviceSelect = $('media-select-camera');
342 chrome.send('setDefaultCaptureDevice', ['camera', deviceSelect.value]); 348 chrome.send('setDefaultCaptureDevice', ['camera', deviceSelect.value]);
343 }; 349 };
344 350
345 // Export 351 // Export
346 return { 352 return {
347 ContentSettings: ContentSettings 353 ContentSettings: ContentSettings
348 }; 354 };
349 355
350 }); 356 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698