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

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

Issue 2749023008: [MD settings] edit content settings exceptions (Closed)
Patch Set: unit tests 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 'settings-edit-exception-dialog' is a component for editing a 6 * @fileoverview 'settings-edit-exception-dialog' is a component for editing a
7 * site exception entry. 7 * site exception entry.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-edit-exception-dialog', 10 is: 'settings-edit-exception-dialog',
(...skipping 21 matching lines...) Expand all
32 }, 32 },
33 33
34 /** @private */ 34 /** @private */
35 onCancelTap_: function() { 35 onCancelTap_: function() {
36 this.$.dialog.close(); 36 this.$.dialog.close();
37 }, 37 },
38 38
39 /** @private */ 39 /** @private */
40 onActionButtonTap_: function() { 40 onActionButtonTap_: function() {
41 if (this.model.origin != this.origin_) { 41 if (this.model.origin != this.origin_) {
42 // TODO(dpapad): Only COOKIES category can be edited currently,
43 // crbug.com/695578.
44 var category = settings.ContentSettingsTypes.COOKIES;
45
46 // The way to "edit" an exception is to remove it and and a new one. 42 // The way to "edit" an exception is to remove it and and a new one.
47 this.browserProxy_.resetCategoryPermissionForOrigin( 43 this.browserProxy_.resetCategoryPermissionForOrigin(
48 this.model.origin, 44 this.model.origin,
49 this.model.embeddingOrigin, 45 this.model.embeddingOrigin,
50 category, 46 this.model.category,
51 this.model.incognito); 47 this.model.incognito);
52 48
53 this.browserProxy_.setCategoryPermissionForOrigin( 49 this.browserProxy_.setCategoryPermissionForOrigin(
54 this.origin_, 50 this.origin_,
55 this.origin_, 51 this.origin_,
56 category, 52 this.model.category,
57 this.model.setting, 53 this.model.setting,
58 this.model.incognito); 54 this.model.incognito);
59 } 55 }
60 56
61 this.$.dialog.close(); 57 this.$.dialog.close();
62 }, 58 },
63 59
64 /** 60 /**
65 * @param {!KeyboardEvent} e 61 * @param {!KeyboardEvent} e
66 * @private 62 * @private
67 */ 63 */
68 onKeypress_: function(e) { 64 onKeypress_: function(e) {
69 if (e.key == 'Enter' && !this.$.actionButton.disabled) 65 if (e.key == 'Enter' && !this.$.actionButton.disabled)
70 this.onActionButtonTap_(); 66 this.onActionButtonTap_();
71 }, 67 },
72 68
73 /** @private */ 69 /** @private */
74 validate_: function() { 70 validate_: function() {
75 this.browserProxy_.isPatternValid(this.origin_).then(function(isValid) { 71 this.browserProxy_.isPatternValid(this.origin_).then(function(isValid) {
76 this.$.actionButton.disabled = !isValid; 72 this.$.actionButton.disabled = !isValid;
77 }.bind(this)); 73 }.bind(this));
78 }, 74 },
79 }); 75 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698