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

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

Issue 2468363005: [MD settings] show blocked sites even when category is blocked (Closed)
Patch Set: unit test changes Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 * @fileoverview 6 * @fileoverview
7 * 'add-site-dialog' provides a dialog to add exceptions for a given Content 7 * 'add-site-dialog' provides a dialog to add exceptions for a given Content
8 * Settings category. 8 * Settings category.
9 */ 9 */
10 Polymer({ 10 Polymer({
11 is: 'add-site-dialog', 11 is: 'add-site-dialog',
12 12
13 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior], 13 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior],
14 14
15 properties: { 15 properties: {
16 /** 16 /**
17 * What kind of setting, e.g. Location, Camera, Cookies, and so on.
18 * @type {settings.ContentSettingsTypes}
19 */
20 category: String,
21
22 /**
23 * Whether this is about an Allow, Block, SessionOnly, or other.
24 * @type {settings.PermissionValues}
25 */
26 contentSetting: String,
27
28 /**
17 * The site to add an exception for. 29 * The site to add an exception for.
18 * @private 30 * @private
19 */ 31 */
20 site_: String, 32 site_: String,
33 },
21 34
22 /** 35 /** @override */
23 * Whether this is an allow exception this dialog is adding. 36 attached: function() {
24 */ 37 assert(this.category);
25 allowException: Boolean, 38 assert(this.contentSetting);
26 }, 39 },
27 40
28 /** 41 /**
29 * Opens the dialog. 42 * Opens the dialog.
30 * @param {string} type Whether this was launched from an Allow list or a 43 * @param {string} type Whether this was launched from an Allow list or a
31 * Block list. 44 * Block list.
32 */ 45 */
33 open: function(type) { 46 open: function(type) {
34 this.addWebUIListener('onIncognitoStatusChanged', 47 this.addWebUIListener('onIncognitoStatusChanged',
35 this.onIncognitoStatusChanged_.bind(this)); 48 this.onIncognitoStatusChanged_.bind(this));
36 this.allowException = type == settings.PermissionValues.ALLOW;
37 this.browserProxy.updateIncognitoStatus(); 49 this.browserProxy.updateIncognitoStatus();
38 this.$.dialog.showModal(); 50 this.$.dialog.showModal();
39 }, 51 },
40 52
41 /** 53 /**
42 * Validates that the pattern entered is valid. 54 * Validates that the pattern entered is valid.
43 * @private 55 * @private
44 */ 56 */
45 validate_: function() { 57 validate_: function() {
46 this.browserProxy.isPatternValid(this.site_).then(function(isValid) { 58 this.browserProxy.isPatternValid(this.site_).then(function(isValid) {
(...skipping 22 matching lines...) Expand all
69 /** 81 /**
70 * The tap handler for the Add [Site] button (adds the pattern and closes 82 * The tap handler for the Add [Site] button (adds the pattern and closes
71 * the dialog). 83 * the dialog).
72 * @private 84 * @private
73 */ 85 */
74 onSubmit_: function() { 86 onSubmit_: function() {
75 if (this.$.add.disabled) 87 if (this.$.add.disabled)
76 return; // Can happen when Enter is pressed. 88 return; // Can happen when Enter is pressed.
77 var pattern = this.addPatternWildcard(this.site_); 89 var pattern = this.addPatternWildcard(this.site_);
78 this.browserProxy.setCategoryPermissionForOrigin( 90 this.browserProxy.setCategoryPermissionForOrigin(
79 pattern, pattern, this.category, this.allowException ? 91 pattern, pattern, this.category, this.contentSetting,
80 settings.PermissionValues.ALLOW : settings.PermissionValues.BLOCK,
81 this.$.incognito.checked); 92 this.$.incognito.checked);
82 this.$.dialog.close(); 93 this.$.dialog.close();
83 }, 94 },
84 }); 95 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698