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

Side by Side Diff: chrome/browser/resources/settings/site_settings/site_list.js

Issue 2744583004: MD Settings: For some content types, make per-site exceptions read-only. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_list.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** 5 /**
6 * Enumeration mapping all possible controlled-by values for exceptions to 6 * Enumeration mapping all possible controlled-by values for exceptions to
7 * icons. 7 * icons.
8 * @enum {string} 8 * @enum {string}
9 */ 9 */
10 var iconControlledBy = { 10 var iconControlledBy = {
(...skipping 17 matching lines...) Expand all
28 properties: { 28 properties: {
29 /** @private */ 29 /** @private */
30 enableSiteSettings_: { 30 enableSiteSettings_: {
31 type: Boolean, 31 type: Boolean,
32 value: function() { 32 value: function() {
33 return loadTimeData.getBoolean('enableSiteSettings'); 33 return loadTimeData.getBoolean('enableSiteSettings');
34 }, 34 },
35 }, 35 },
36 36
37 /** 37 /**
38 * Some content types (like Location) do not allow the user to manually
39 * edit the exception list from within Settings.
40 * @private
41 */
42 readOnlyList: {
43 type: Boolean,
44 value: false,
45 },
46
47 /**
38 * The site serving as the model for the currently open action menu. 48 * The site serving as the model for the currently open action menu.
39 * @private {?SiteException} 49 * @private {?SiteException}
40 */ 50 */
41 actionMenuSite_: Object, 51 actionMenuSite_: Object,
42 52
43 /** 53 /**
44 * Whether the "edit exception" dialog should be shown. 54 * Whether the "edit exception" dialog should be shown.
45 * @private 55 * @private
46 */ 56 */
47 showEditExceptionDialog_: Boolean, 57 showEditExceptionDialog_: Boolean,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 * Whether there are any site exceptions added for this content setting. 209 * Whether there are any site exceptions added for this content setting.
200 * @return {boolean} 210 * @return {boolean}
201 * @private 211 * @private
202 */ 212 */
203 hasSites_: function() { 213 hasSites_: function() {
204 return !!this.sites.length; 214 return !!this.sites.length;
205 }, 215 },
206 216
207 /** 217 /**
208 * @param {string} source Where the setting came from. 218 * @param {string} source Where the setting came from.
219 * @param {boolean} readOnlyList Whether the site exception list is read-only.
209 * @return {boolean} 220 * @return {boolean}
210 * @private 221 * @private
211 */ 222 */
212 isActionMenuHidden_: function(source) { 223 isActionMenuHidden_: function(source, readOnlyList) {
213 return this.isExceptionControlled_(source) || this.allSites; 224 return this.isExceptionControlled_(source) || this.allSites || readOnlyList;
214 }, 225 },
215 226
216 /** 227 /**
217 * A handler for the Add Site button. 228 * A handler for the Add Site button.
218 * @param {!Event} e 229 * @param {!Event} e
219 * @private 230 * @private
220 */ 231 */
221 onAddSiteTap_: function(e) { 232 onAddSiteTap_: function(e) {
233 assert(!this.readOnlyList);
222 e.preventDefault(); 234 e.preventDefault();
223 var dialog = document.createElement('add-site-dialog'); 235 var dialog = document.createElement('add-site-dialog');
224 dialog.category = this.category; 236 dialog.category = this.category;
225 dialog.contentSetting = this.categorySubtype; 237 dialog.contentSetting = this.categorySubtype;
226 this.shadowRoot.appendChild(dialog); 238 this.shadowRoot.appendChild(dialog);
227 239
228 dialog.open(this.categorySubtype); 240 dialog.open(this.categorySubtype);
229 241
230 dialog.addEventListener('close', function() { 242 dialog.addEventListener('close', function() {
231 dialog.remove(); 243 dialog.remove();
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 512
501 /** @private */ 513 /** @private */
502 closeActionMenu_: function() { 514 closeActionMenu_: function() {
503 this.actionMenuSite_ = null; 515 this.actionMenuSite_ = null;
504 var actionMenu = /** @type {!CrActionMenuElement} */ ( 516 var actionMenu = /** @type {!CrActionMenuElement} */ (
505 this.$$('dialog[is=cr-action-menu]')); 517 this.$$('dialog[is=cr-action-menu]'));
506 if (actionMenu.open) 518 if (actionMenu.open)
507 actionMenu.close(); 519 actionMenu.close();
508 }, 520 },
509 }); 521 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/site_settings/site_list.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698