| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @fileoverview 'settings-edit-exception-dialog' is a component for editing a |
| 7 * site exception entry. |
| 8 */ |
| 9 Polymer({ |
| 10 is: 'settings-edit-exception-dialog', |
| 11 |
| 12 properties: { |
| 13 /** |
| 14 * @type {!SiteException} |
| 15 */ |
| 16 model: Object, |
| 17 |
| 18 /** @private */ |
| 19 origin_: String, |
| 20 }, |
| 21 |
| 22 /** @private {!settings.SiteSettingsPrefsBrowserProxy} */ |
| 23 browserProxy_: null, |
| 24 |
| 25 /** @override */ |
| 26 attached: function() { |
| 27 this.browserProxy_ = |
| 28 settings.SiteSettingsPrefsBrowserProxyImpl.getInstance(); |
| 29 this.origin_ = this.model.origin; |
| 30 |
| 31 this.$.dialog.showModal(); |
| 32 }, |
| 33 |
| 34 /** @private */ |
| 35 onCancelTap_: function() { |
| 36 this.$.dialog.close(); |
| 37 }, |
| 38 |
| 39 /** @private */ |
| 40 onActionButtonTap_: function() { |
| 41 if (this.model.origin != this.origin_) { |
| 42 // Only COOKIES category can be edited currently. |
| 43 var category = settings.ContentSettingsTypes.COOKIES; |
| 44 |
| 45 this.browserProxy_.resetCategoryPermissionForOrigin( |
| 46 this.model.origin, |
| 47 this.model.embeddingOrigin, |
| 48 category, |
| 49 this.model.incognito); |
| 50 |
| 51 this.browserProxy_.setCategoryPermissionForOrigin( |
| 52 this.origin_, |
| 53 this.origin_, |
| 54 category, |
| 55 this.model.setting, |
| 56 this.model.incognito); |
| 57 } |
| 58 |
| 59 this.$.dialog.close(); |
| 60 }, |
| 61 |
| 62 /** |
| 63 * @param {!KeyboardEvent} e |
| 64 * @private |
| 65 */ |
| 66 onKeypress_: function(e) { |
| 67 if (e.key == 'Enter' && !this.$.actionButton.disabled) |
| 68 this.onActionButtonTap_(); |
| 69 }, |
| 70 }); |
| OLD | NEW |