Chromium Code Reviews| Index: chrome/browser/resources/settings/appearance_page/home_url_input.js |
| diff --git a/chrome/browser/resources/settings/controls/settings_input.js b/chrome/browser/resources/settings/appearance_page/home_url_input.js |
| similarity index 79% |
| rename from chrome/browser/resources/settings/controls/settings_input.js |
| rename to chrome/browser/resources/settings/appearance_page/home_url_input.js |
| index 0031a07e242dfa2b87d8bc63595c1096e5a00f19..5ae8aa456da4c344b576686aca9485b6a9ba807c 100644 |
| --- a/chrome/browser/resources/settings/controls/settings_input.js |
| +++ b/chrome/browser/resources/settings/appearance_page/home_url_input.js |
| @@ -4,11 +4,11 @@ |
| /** |
| * @fileoverview |
| - * `settings-input` is a single-line text field for user input associated |
| - * with a pref value. |
| + * `home-url-input` is a single-line text field intending to be used with |
| + * prefs.homepage |
| */ |
| Polymer({ |
| - is: 'settings-input', |
| + is: 'home-url-input', |
| behaviors: [CrPolicyPrefBehavior, PrefControlBehavior], |
| @@ -20,28 +20,27 @@ Polymer({ |
| */ |
| pref: {observer: 'prefChanged_'}, |
| - /* The current value of the input, reflected to/from |pref|. */ |
| - value: { |
| - type: String, |
| - value: '', |
| - notify: true, |
| - }, |
| - |
| /* Set to true to disable editing the input. */ |
| disabled: {type: Boolean, value: false, reflectToAttribute: true}, |
| canTab: Boolean, |
| - invalid: { |
| - type: Boolean, |
| - value: false, |
| + invalid: {type: Boolean, value: false}, |
| + |
| + /* The current value of the input, reflected to/from |pref|. */ |
| + value: { |
| + type: String, |
| + value: '', |
| notify: true, |
| }, |
| + }, |
| - /* Properties for paper-input. This is not strictly necessary. |
| - * Though it does define the types for the closure compiler. */ |
| - errorMessage: {type: String}, |
| - label: {type: String}, |
| + /** @private {?settings.AppearanceBrowserProxy} */ |
| + browserProxy_: null, |
| + |
| + created: function() { |
|
dpapad
2017/03/31 20:38:52
Nit: @override
scottchen
2017/03/31 21:02:46
Done.
|
| + this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance(); |
| + this.noExtensionIndicator = true; // Prevent double indicator. |
| }, |
| /** |
| @@ -126,4 +125,16 @@ Polymer({ |
| isDisabled_: function(disabled) { |
| return disabled || this.isPrefEnforced(); |
| }, |
| + |
| + /** @private */ |
| + validate_: function() { |
| + if (this.value == '') { |
| + this.invalid = false; |
| + return; |
| + } |
| + |
| + this.browserProxy_.validateStartupPage(this.value).then(function(isValid) { |
| + this.invalid = !isValid; |
| + }.bind(this)); |
| + }, |
| }); |