OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 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-startup-url-dialog' is a component for adding |
| 7 * or editing a startup URL entry. |
| 8 */ |
| 9 Polymer({ |
| 10 is: 'settings-startup-url-dialog', |
| 11 |
| 12 properties: { |
| 13 /** @private {string} */ |
| 14 url_: String, |
| 15 }, |
| 16 |
| 17 /** @private {!settings.SearchEnginesBrowserProxy} */ |
| 18 browserProxy_: null, |
| 19 |
| 20 /** @override */ |
| 21 ready: function() { |
| 22 this.browserProxy_ = settings.StartupUrlsPageBrowserProxyImpl.getInstance(); |
| 23 }, |
| 24 |
| 25 /** @override */ |
| 26 attached: function() { |
| 27 this.$.dialog.open(); |
| 28 }, |
| 29 |
| 30 /** @private */ |
| 31 onCancelTap_: function() { |
| 32 this.$.dialog.close(); |
| 33 }, |
| 34 |
| 35 /** @private */ |
| 36 onAddTap_: function() { |
| 37 this.browserProxy_.addStartupPage(this.url_).then(function(success) { |
| 38 if (success) |
| 39 this.$.dialog.close(); |
| 40 // If the URL was invalid, there is nothing to do, just leave the dialog |
| 41 // open and let the user fix the URL or cancel. |
| 42 }.bind(this)); |
| 43 }, |
| 44 |
| 45 /** @private */ |
| 46 validate_: function() { |
| 47 this.browserProxy_.validateStartupPage(this.url_).then(function(isValid) { |
| 48 this.$.add.disabled = !isValid; |
| 49 }.bind(this)); |
| 50 }, |
| 51 }); |
OLD | NEW |