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

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: Merged with ToT 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;
131
132 var zoomLabel = cr.doc.createElement('span');
133 zoomLabel.textContent = this.dataItem.zoom;
134 zoomLabel.className = 'exception-setting';
135 zoomLabel.setAttribute('displaymode', 'static');
136 zoomLabel.setAttribute('aria-labelledby', 'exception-zoom-column');
137 this.contentElement.appendChild(zoomLabel);
138 this.zoomLabel = zoomLabel;
139 }
140
126 // Used to track whether the URL pattern in the input is valid. 141 // 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 142 // 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 143 // 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. 144 // 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 145 // It starts off as false for empty string (new exceptions) or true for
131 // already-existing exceptions (which we assume are valid). 146 // already-existing exceptions (which we assume are valid).
132 this.inputValidityKnown = this.pattern; 147 this.inputValidityKnown = this.pattern;
133 // This one tracks the actual validity of the pattern in the input. This 148 // 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 149 // starts off as true so as not to annoy the user when he adds a new and
135 // empty input. 150 // empty input.
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 }, 549 },
535 550
536 /** 551 /**
537 * Returns whether the rows are editable in this list. 552 * Returns whether the rows are editable in this list.
538 */ 553 */
539 isEditable: function() { 554 isEditable: function() {
540 // Exceptions of the following lists are not editable for now. 555 // Exceptions of the following lists are not editable for now.
541 return !(this.contentType == 'notifications' || 556 return !(this.contentType == 'notifications' ||
542 this.contentType == 'location' || 557 this.contentType == 'location' ||
543 this.contentType == 'fullscreen' || 558 this.contentType == 'fullscreen' ||
544 this.contentType == 'media-stream'); 559 this.contentType == 'media-stream' ||
560 this.contentType == 'zoomlevels');
545 }, 561 },
546 562
547 /** 563 /**
548 * Removes all exceptions from the js model. 564 * Removes all exceptions from the js model.
549 */ 565 */
550 reset: function() { 566 reset: function() {
551 if (this.isEditable()) { 567 if (this.isEditable()) {
552 // The null creates the Add New Exception row. 568 // The null creates the Add New Exception row.
553 this.dataModel = new ArrayDataModel([null]); 569 this.dataModel = new ArrayDataModel([null]);
554 } else { 570 } else {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 var divs = this.pageDiv.querySelectorAll('div[contentType]'); 636 var divs = this.pageDiv.querySelectorAll('div[contentType]');
621 for (var i = 0; i < divs.length; i++) { 637 for (var i = 0; i < divs.length; i++) {
622 if (divs[i].getAttribute('contentType') == type) 638 if (divs[i].getAttribute('contentType') == type)
623 divs[i].hidden = false; 639 divs[i].hidden = false;
624 else 640 else
625 divs[i].hidden = true; 641 divs[i].hidden = true;
626 } 642 }
627 643
628 var mediaHeader = this.pageDiv.querySelector('.media-header'); 644 var mediaHeader = this.pageDiv.querySelector('.media-header');
629 mediaHeader.hidden = type != 'media-stream'; 645 mediaHeader.hidden = type != 'media-stream';
646
647 $('exception-behavior-column').hidden = type == 'zoomlevels';
648 $('exception-zoom-column').hidden = type != 'zoomlevels';
630 }, 649 },
631 650
632 /** 651 /**
633 * Called after the page has been shown. Show the content type for the 652 * Called after the page has been shown. Show the content type for the
634 * location's hash. 653 * location's hash.
635 */ 654 */
636 didShowPage: function() { 655 didShowPage: function() {
637 var hash = location.hash; 656 var hash = location.hash;
638 if (hash) 657 if (hash)
639 this.showList(hash.slice(1)); 658 this.showList(hash.slice(1));
(...skipping 21 matching lines...) Expand all
661 } 680 }
662 }; 681 };
663 682
664 return { 683 return {
665 ExceptionsListItem: ExceptionsListItem, 684 ExceptionsListItem: ExceptionsListItem,
666 ExceptionsAddRowListItem: ExceptionsAddRowListItem, 685 ExceptionsAddRowListItem: ExceptionsAddRowListItem,
667 ExceptionsList: ExceptionsList, 686 ExceptionsList: ExceptionsList,
668 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, 687 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea,
669 }; 688 };
670 }); 689 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698