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

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

Issue 543493002: Compile chrome://settings, part 2: reduce from 950 to 400 errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@F_settings
Patch Set: rebase? 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.contentSettings', function() { 5 cr.define('options.contentSettings', function() {
6 /** @const */ var ControlledSettingIndicator = 6 /** @const */ var ControlledSettingIndicator =
7 options.ControlledSettingIndicator; 7 options.ControlledSettingIndicator;
8 /** @const */ var InlineEditableItemList = options.InlineEditableItemList; 8 /** @const */ var InlineEditableItemList = options.InlineEditableItemList;
9 /** @const */ var InlineEditableItem = options.InlineEditableItem; 9 /** @const */ var InlineEditableItem = options.InlineEditableItem;
10 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; 10 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 this.dataItem.source : null; 171 this.dataItem.source : null;
172 172
173 if (controlledBy) { 173 if (controlledBy) {
174 this.setAttribute('controlled-by', controlledBy); 174 this.setAttribute('controlled-by', controlledBy);
175 this.deletable = false; 175 this.deletable = false;
176 this.editable = false; 176 this.editable = false;
177 } 177 }
178 178
179 if (controlledBy == 'policy' || controlledBy == 'extension') { 179 if (controlledBy == 'policy' || controlledBy == 'extension') {
180 this.querySelector('.row-delete-button').hidden = true; 180 this.querySelector('.row-delete-button').hidden = true;
181 var indicator = ControlledSettingIndicator(); 181 var indicator = new ControlledSettingIndicator();
182 indicator.setAttribute('content-exception', this.contentType); 182 indicator.setAttribute('content-exception', this.contentType);
183 // Create a synthetic pref change event decorated as 183 // Create a synthetic pref change event decorated as
184 // CoreOptionsHandler::CreateValueForPref() does. 184 // CoreOptionsHandler::CreateValueForPref() does.
185 var event = new Event(this.contentType); 185 var event = new Event(this.contentType);
186 event.value = { controlledBy: controlledBy }; 186 event.value = { controlledBy: controlledBy };
187 indicator.handlePrefChange(event); 187 indicator.handlePrefChange(event);
188 this.appendChild(indicator); 188 this.appendChild(indicator);
189 } 189 }
190 190
191 // If the exception comes from a hosted app, display the name and the 191 // If the exception comes from a hosted app, display the name and the
(...skipping 26 matching lines...) Expand all
218 return this.dataItem.embeddingOrigin && 218 return this.dataItem.embeddingOrigin &&
219 this.dataItem.embeddingOrigin !== this.dataItem.origin; 219 this.dataItem.embeddingOrigin !== this.dataItem.origin;
220 }, 220 },
221 221
222 /** 222 /**
223 * The pattern (e.g., a URL) for the exception. 223 * The pattern (e.g., a URL) for the exception.
224 * 224 *
225 * @type {string} 225 * @type {string}
226 */ 226 */
227 get pattern() { 227 get pattern() {
228 if (!this.isEmbeddingRule()) { 228 if (!this.isEmbeddingRule())
229 return this.dataItem.origin; 229 return this.dataItem.origin;
230 } else {
231 return loadTimeData.getStringF('embeddedOnHost',
232 this.dataItem.embeddingOrigin);
233 }
234 230
235 return this.dataItem.displayPattern; 231 return loadTimeData.getStringF('embeddedOnHost',
232 this.dataItem.embeddingOrigin);
236 }, 233 },
237 set pattern(pattern) { 234 set pattern(pattern) {
238 if (!this.editable) 235 if (!this.editable)
239 console.error('Tried to change uneditable pattern'); 236 console.error('Tried to change uneditable pattern');
240 237
241 this.dataItem.displayPattern = pattern; 238 this.dataItem.displayPattern = pattern;
242 }, 239 },
243 240
244 /** 241 /**
245 * The setting (allow/block) for the exception. 242 * The setting (allow/block) for the exception.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 /** 390 /**
394 * Creates a new list item for the Add New Item row, which doesn't represent 391 * Creates a new list item for the Add New Item row, which doesn't represent
395 * an actual entry in the exceptions list but allows the user to add new 392 * an actual entry in the exceptions list but allows the user to add new
396 * exceptions. 393 * exceptions.
397 * 394 *
398 * @param {string} contentType The type of the list. 395 * @param {string} contentType The type of the list.
399 * @param {string} mode The browser mode, 'otr' or 'normal'. 396 * @param {string} mode The browser mode, 'otr' or 'normal'.
400 * @param {boolean} enableAskOption Whether to show an 'ask every time' option 397 * @param {boolean} enableAskOption Whether to show an 'ask every time' option
401 * in the select. 398 * in the select.
402 * @constructor 399 * @constructor
403 * @extends {cr.ui.ExceptionsListItem} 400 * @extends {options.contentSettings.ExceptionsListItem}
404 */ 401 */
405 function ExceptionsAddRowListItem(contentType, mode, enableAskOption) { 402 function ExceptionsAddRowListItem(contentType, mode, enableAskOption) {
406 var el = cr.doc.createElement('div'); 403 var el = cr.doc.createElement('div');
407 el.mode = mode; 404 el.mode = mode;
408 el.contentType = contentType; 405 el.contentType = contentType;
409 el.enableAskOption = enableAskOption; 406 el.enableAskOption = enableAskOption;
410 el.dataItem = []; 407 el.dataItem = [];
411 el.__proto__ = ExceptionsAddRowListItem.prototype; 408 el.__proto__ = ExceptionsAddRowListItem.prototype;
412 el.decorate(); 409 el.decorate();
413 410
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 var args = [0, deleteCount]; 523 var args = [0, deleteCount];
527 args.push.apply(args, entries); 524 args.push.apply(args, entries);
528 this.dataModel.splice.apply(this.dataModel, args); 525 this.dataModel.splice.apply(this.dataModel, args);
529 }, 526 },
530 527
531 /** 528 /**
532 * The browser has finished checking a pattern for validity. Update the list 529 * The browser has finished checking a pattern for validity. Update the list
533 * item to reflect this. 530 * item to reflect this.
534 * 531 *
535 * @param {string} pattern The pattern. 532 * @param {string} pattern The pattern.
536 * @param {bool} valid Whether said pattern is valid in the context of a 533 * @param {boolean} valid Whether said pattern is valid in the context of a
537 * content exception setting. 534 * content exception setting.
538 */ 535 */
539 patternValidityCheckComplete: function(pattern, valid) { 536 patternValidityCheckComplete: function(pattern, valid) {
540 var listItems = this.items; 537 var listItems = this.items;
541 for (var i = 0; i < listItems.length; i++) { 538 for (var i = 0; i < listItems.length; i++) {
542 var listItem = listItems[i]; 539 var listItem = listItems[i];
543 // Don't do anything for messages for the item if it is not the intended 540 // Don't do anything for messages for the item if it is not the intended
544 // recipient, or if the response is stale (i.e. the input value has 541 // recipient, or if the response is stale (i.e. the input value has
545 // changed since we sent the request to analyze it). 542 // changed since we sent the request to analyze it).
546 if (pattern == listItem.input.value) 543 if (pattern == listItem.input.value)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 }, 583 },
587 }; 584 };
588 585
589 var Page = cr.ui.pageManager.Page; 586 var Page = cr.ui.pageManager.Page;
590 var PageManager = cr.ui.pageManager.PageManager; 587 var PageManager = cr.ui.pageManager.PageManager;
591 588
592 /** 589 /**
593 * Encapsulated handling of content settings list subpage. 590 * Encapsulated handling of content settings list subpage.
594 * 591 *
595 * @constructor 592 * @constructor
593 * @extends {cr.ui.pageManager.Page}
596 */ 594 */
597 function ContentSettingsExceptionsArea() { 595 function ContentSettingsExceptionsArea() {
598 Page.call(this, 'contentExceptions', 596 Page.call(this, 'contentExceptions',
599 loadTimeData.getString('contentSettingsPageTabTitle'), 597 loadTimeData.getString('contentSettingsPageTabTitle'),
600 'content-settings-exceptions-area'); 598 'content-settings-exceptions-area');
601 } 599 }
602 600
603 cr.addSingletonGetter(ContentSettingsExceptionsArea); 601 cr.addSingletonGetter(ContentSettingsExceptionsArea);
604 602
605 ContentSettingsExceptionsArea.prototype = { 603 ContentSettingsExceptionsArea.prototype = {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 } 680 }
683 }; 681 };
684 682
685 return { 683 return {
686 ExceptionsListItem: ExceptionsListItem, 684 ExceptionsListItem: ExceptionsListItem,
687 ExceptionsAddRowListItem: ExceptionsAddRowListItem, 685 ExceptionsAddRowListItem: ExceptionsAddRowListItem,
688 ExceptionsList: ExceptionsList, 686 ExceptionsList: ExceptionsList,
689 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, 687 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea,
690 }; 688 };
691 }); 689 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/content_settings.js ('k') | chrome/browser/resources/options/content_settings_ui.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698