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 this.$.add.disabled = true; | |
Dan Beam
2016/04/08 23:24:42
why not just use the HTML instead?
dpapad
2016/04/09 00:02:18
Done.
| |
24 }, | |
25 | |
26 /** @override */ | |
27 attached: function() { | |
28 this.$.dialog.open(); | |
29 }, | |
30 | |
31 /** @private */ | |
32 onCancelTap_: function() { | |
33 this.$.dialog.close(); | |
34 }, | |
35 | |
36 /** @private */ | |
37 onAddTap_: function() { | |
38 this.browserProxy_.addStartupPage(this.url_).then(function(success) { | |
39 if (success) | |
40 this.$.dialog.close(); | |
41 // If the URL was invalid, there is nothing to do, just leave the dialog | |
42 // open and let the user fix the URL or cancel. | |
43 }.bind(this)); | |
44 }, | |
45 | |
46 /** @private */ | |
47 validate_: function() { | |
48 this.browserProxy_.validateStartupPage(this.url_).then(function(isValid) { | |
49 this.$.add.disabled = !isValid; | |
50 }.bind(this)); | |
51 }, | |
52 }); | |
OLD | NEW |