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

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

Issue 2699013002: MD Settings: Allow editing a cookie site exception. (Closed)
Patch Set: Address comments Created 3 years, 10 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
dschuyler 2017/02/23 22:24:50 nit: copyright year.
dpapad 2017/02/24 00:17:19 Done.
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 // TODO(dpapad): Only COOKIES category can be edited currently,
43 // crbug.com/695578.
44 var category = settings.ContentSettingsTypes.COOKIES;
45
dschuyler 2017/02/23 22:24:50 nit: Maybe a comment about why the reset* before t
dpapad 2017/02/24 00:17:19 Done.
46 this.browserProxy_.resetCategoryPermissionForOrigin(
47 this.model.origin,
48 this.model.embeddingOrigin,
49 category,
50 this.model.incognito);
51
52 this.browserProxy_.setCategoryPermissionForOrigin(
53 this.origin_,
54 this.origin_,
55 category,
56 this.model.setting,
57 this.model.incognito);
58 }
59
60 this.$.dialog.close();
61 },
62
63 /**
64 * @param {!KeyboardEvent} e
65 * @private
66 */
67 onKeypress_: function(e) {
68 if (e.key == 'Enter' && !this.$.actionButton.disabled)
69 this.onActionButtonTap_();
70 },
71
72 /** @private */
73 validate_: function() {
74 this.browserProxy_.isPatternValid(this.origin_).then(function(isValid) {
75 this.$.actionButton.disabled = !isValid;
76 }.bind(this));
77 },
78 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698