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

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

Issue 197523002: Show Zoom Levels as content settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Markus' comments Created 6 years, 9 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 | Annotate | Revision Log
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 this.editable = false; 97 this.editable = false;
98 } 98 }
99 99
100 if (this.setting == 'default') { 100 if (this.setting == 'default') {
101 // Items that don't have their own settings (parents of 'embedded on' 101 // Items that don't have their own settings (parents of 'embedded on'
102 // items) aren't deletable. 102 // items) aren't deletable.
103 this.deletable = false; 103 this.deletable = false;
104 this.editable = false; 104 this.editable = false;
105 } 105 }
106 106
107 this.addEditField(select, this.settingLabel); 107 if (this.contentType != 'zoomlevels') {
108 this.contentElement.appendChild(select); 108 this.addEditField(select, this.settingLabel);
109 this.contentElement.appendChild(select);
110 }
109 select.className = 'exception-setting'; 111 select.className = 'exception-setting';
110 select.setAttribute('aria-labelledby', 'exception-behavior-column'); 112 select.setAttribute('aria-labelledby', 'exception-behavior-column');
111 113
112 if (this.pattern) 114 if (this.pattern)
113 select.setAttribute('displaymode', 'edit'); 115 select.setAttribute('displaymode', 'edit');
114 116
115 if (this.contentType == 'media-stream') { 117 if (this.contentType == 'media-stream') {
116 this.settingLabel.classList.add('media-audio-setting'); 118 this.settingLabel.classList.add('media-audio-setting');
117 119
118 var videoSettingLabel = cr.doc.createElement('span'); 120 var videoSettingLabel = cr.doc.createElement('span');
119 videoSettingLabel.textContent = this.videoSettingForDisplay(); 121 videoSettingLabel.textContent = this.videoSettingForDisplay();
120 videoSettingLabel.className = 'exception-setting'; 122 videoSettingLabel.className = 'exception-setting';
121 videoSettingLabel.classList.add('media-video-setting'); 123 videoSettingLabel.classList.add('media-video-setting');
122 videoSettingLabel.setAttribute('displaymode', 'static'); 124 videoSettingLabel.setAttribute('displaymode', 'static');
123 this.contentElement.appendChild(videoSettingLabel); 125 this.contentElement.appendChild(videoSettingLabel);
124 } 126 }
125 127
128 if (this.contentType == 'zoomlevels') {
129 this.deletable = true;
130 this.editable = false;
Dan Beam 2014/03/15 15:28:51 nit: \n
battre 2014/03/17 23:00:19 Done.
131 var zoomLabel = cr.doc.createElement('span');
132 zoomLabel.textContent = this.dataItem.zoom;
133 zoomLabel.className = 'exception-setting';
134 zoomLabel.setAttribute('displaymode', 'static');
135 zoomLabel.setAttribute('aria-labelledby', 'exception-zoom-column');
136 this.contentElement.appendChild(zoomLabel);
137 this.zoomLabel = zoomLabel;
138 }
139
126 // Used to track whether the URL pattern in the input is valid. 140 // Used to track whether the URL pattern in the input is valid.
127 // This will be true if the browser process has informed us that the 141 // This will be true if the browser process has informed us that the
128 // current text in the input is valid. Changing the text resets this to 142 // current text in the input is valid. Changing the text resets this to
129 // false, and getting a response from the browser sets it back to true. 143 // false, and getting a response from the browser sets it back to true.
130 // It starts off as false for empty string (new exceptions) or true for 144 // It starts off as false for empty string (new exceptions) or true for
131 // already-existing exceptions (which we assume are valid). 145 // already-existing exceptions (which we assume are valid).
132 this.inputValidityKnown = this.pattern; 146 this.inputValidityKnown = this.pattern;
133 // This one tracks the actual validity of the pattern in the input. This 147 // This one tracks the actual validity of the pattern in the input. This
134 // starts off as true so as not to annoy the user when he adds a new and 148 // starts off as true so as not to annoy the user when he adds a new and
135 // empty input. 149 // empty input.
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 }, 548 },
535 549
536 /** 550 /**
537 * Returns whether the rows are editable in this list. 551 * Returns whether the rows are editable in this list.
538 */ 552 */
539 isEditable: function() { 553 isEditable: function() {
540 // Exceptions of the following lists are not editable for now. 554 // Exceptions of the following lists are not editable for now.
541 return !(this.contentType == 'notifications' || 555 return !(this.contentType == 'notifications' ||
542 this.contentType == 'location' || 556 this.contentType == 'location' ||
543 this.contentType == 'fullscreen' || 557 this.contentType == 'fullscreen' ||
544 this.contentType == 'media-stream'); 558 this.contentType == 'media-stream' ||
559 this.contentType == 'zoomlevels');
545 }, 560 },
546 561
547 /** 562 /**
548 * Removes all exceptions from the js model. 563 * Removes all exceptions from the js model.
549 */ 564 */
550 reset: function() { 565 reset: function() {
551 if (this.isEditable()) { 566 if (this.isEditable()) {
552 // The null creates the Add New Exception row. 567 // The null creates the Add New Exception row.
553 this.dataModel = new ArrayDataModel([null]); 568 this.dataModel = new ArrayDataModel([null]);
554 } else { 569 } else {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 var divs = this.pageDiv.querySelectorAll('div[contentType]'); 635 var divs = this.pageDiv.querySelectorAll('div[contentType]');
621 for (var i = 0; i < divs.length; i++) { 636 for (var i = 0; i < divs.length; i++) {
622 if (divs[i].getAttribute('contentType') == type) 637 if (divs[i].getAttribute('contentType') == type)
623 divs[i].hidden = false; 638 divs[i].hidden = false;
624 else 639 else
625 divs[i].hidden = true; 640 divs[i].hidden = true;
626 } 641 }
627 642
628 var mediaHeader = this.pageDiv.querySelector('.media-header'); 643 var mediaHeader = this.pageDiv.querySelector('.media-header');
629 mediaHeader.hidden = type != 'media-stream'; 644 mediaHeader.hidden = type != 'media-stream';
645
646 $('exception-behavior-column').hidden = type == 'zoomlevels';
647 $('exception-zoom-column').hidden = type != 'zoomlevels';
630 }, 648 },
631 649
632 /** 650 /**
633 * Called after the page has been shown. Show the content type for the 651 * Called after the page has been shown. Show the content type for the
634 * location's hash. 652 * location's hash.
635 */ 653 */
636 didShowPage: function() { 654 didShowPage: function() {
637 var hash = location.hash; 655 var hash = location.hash;
638 if (hash) 656 if (hash)
639 this.showList(hash.slice(1)); 657 this.showList(hash.slice(1));
(...skipping 21 matching lines...) Expand all
661 } 679 }
662 }; 680 };
663 681
664 return { 682 return {
665 ExceptionsListItem: ExceptionsListItem, 683 ExceptionsListItem: ExceptionsListItem,
666 ExceptionsAddRowListItem: ExceptionsAddRowListItem, 684 ExceptionsAddRowListItem: ExceptionsAddRowListItem,
667 ExceptionsList: ExceptionsList, 685 ExceptionsList: ExceptionsList,
668 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, 686 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea,
669 }; 687 };
670 }); 688 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698