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

Side by Side Diff: chrome/browser/resources/settings/appearance_page/home_url_input.js

Issue 2773233002: MD Settings: change settings-input to home-url-input due to reduced usage. (Closed)
Patch Set: reduce code 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 * `settings-input` is a single-line text field for user input associated 7 * `home-url-input` is a single-line text field intending to be used with
8 * with a pref value. 8 * prefs.homepage
9 */ 9 */
10 Polymer({ 10 Polymer({
11 is: 'settings-input', 11 is: 'home-url-input',
12 12
13 behaviors: [CrPolicyPrefBehavior, PrefControlBehavior], 13 behaviors: [CrPolicyPrefBehavior, PrefControlBehavior],
14 14
15 properties: { 15 properties: {
16 /** 16 /**
17 * The preference object to control. 17 * The preference object to control.
18 * @type {!chrome.settingsPrivate.PrefObject|undefined} 18 * @type {!chrome.settingsPrivate.PrefObject|undefined}
19 * @override 19 * @override
20 */ 20 */
21 pref: {observer: 'prefChanged_'}, 21 pref: {observer: 'prefChanged_'},
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 this.$.input.blur(); 108 this.$.input.blur();
109 }, 109 },
110 110
111 /** 111 /**
112 * Keydown handler to specify enter-key and escape-key interactions. 112 * Keydown handler to specify enter-key and escape-key interactions.
113 * @param {!Event} event 113 * @param {!Event} event
114 * @private 114 * @private
115 */ 115 */
116 onKeydown_: function(event) { 116 onKeydown_: function(event) {
117 // If pressed enter when input is invalid, do not trigger on-change. 117 // If pressed enter when input is invalid, do not trigger on-change.
118 if (event.key == 'Enter' && this.invalid) { 118 if (event.key == 'Enter' && this.invalid)
119 event.preventDefault(); 119 event.preventDefault();
120 return; 120 else if (event.key == 'Escape')
121 } 121 this.resetValue_();
122
123 if (event.key != 'Escape')
124 return;
125
126 this.resetValue_();
127 }, 122 },
128 123
129 /** 124 /**
130 * @param {boolean} disabled 125 * @param {boolean} disabled
131 * @return {boolean} Whether the element should be disabled. 126 * @return {boolean} Whether the element should be disabled.
132 * @private 127 * @private
133 */ 128 */
134 isDisabled_: function(disabled) { 129 isDisabled_: function(disabled) {
135 return disabled || this.isPrefEnforced(); 130 return disabled || this.isPrefEnforced();
136 }, 131 },
137 }); 132 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698