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

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

Issue 2783513002: MD Settings: Display error messages in "add" and "edit" exception dialogs. (Closed)
Patch Set: Remove left overs (again) Created 3 years, 8 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',
11 11
12 properties: { 12 properties: {
13 /** 13 /**
14 * @type {!SiteException} 14 * @type {!SiteException}
15 */ 15 */
16 model: Object, 16 model: Object,
17 17
18 /** @private */ 18 /** @private */
19 origin_: String, 19 origin_: String,
20
21 /**
22 * Whether the current input is invalid.
23 * @private
24 */
25 invalid_: {
26 type: Boolean,
27 value: false,
28 },
20 }, 29 },
21 30
22 /** @private {!settings.SiteSettingsPrefsBrowserProxy} */ 31 /** @private {!settings.SiteSettingsPrefsBrowserProxy} */
23 browserProxy_: null, 32 browserProxy_: null,
24 33
25 /** @override */ 34 /** @override */
26 attached: function() { 35 attached: function() {
27 this.browserProxy_ = 36 this.browserProxy_ =
28 settings.SiteSettingsPrefsBrowserProxyImpl.getInstance(); 37 settings.SiteSettingsPrefsBrowserProxyImpl.getInstance();
29 this.origin_ = this.model.origin; 38 this.origin_ = this.model.origin;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 * @param {!KeyboardEvent} e 70 * @param {!KeyboardEvent} e
62 * @private 71 * @private
63 */ 72 */
64 onKeypress_: function(e) { 73 onKeypress_: function(e) {
65 if (e.key == 'Enter' && !this.$.actionButton.disabled) 74 if (e.key == 'Enter' && !this.$.actionButton.disabled)
66 this.onActionButtonTap_(); 75 this.onActionButtonTap_();
67 }, 76 },
68 77
69 /** @private */ 78 /** @private */
70 validate_: function() { 79 validate_: function() {
80 if (this.$$('paper-input').value.trim() == '') {
81 this.invalid_ = true;
82 return;
83 }
84
71 this.browserProxy_.isPatternValid(this.origin_).then(function(isValid) { 85 this.browserProxy_.isPatternValid(this.origin_).then(function(isValid) {
72 this.$.actionButton.disabled = !isValid; 86 this.invalid_ = !isValid;
73 }.bind(this)); 87 }.bind(this));
74 }, 88 },
75 }); 89 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698