| OLD | NEW |
| 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 'settings-startup-urls-page' is the settings page | 6 * @fileoverview 'settings-startup-urls-page' is the settings page |
| 7 * containing the urls that will be opened when chrome is started. | 7 * containing the urls that will be opened when chrome is started. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 Polymer({ | 10 Polymer({ |
| 11 is: 'settings-startup-urls-page', | 11 is: 'settings-startup-urls-page', |
| 12 | 12 |
| 13 behaviors: [WebUIListenerBehavior], | 13 behaviors: [WebUIListenerBehavior], |
| 14 | 14 |
| 15 properties: { | 15 properties: { |
| 16 /** @type {settings.StartupUrlsPageBrowserProxy} */ | 16 /** @type {settings.StartupUrlsPageBrowserProxy} */ |
| 17 browserProxy_: Object, | 17 browserProxy_: Object, |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * Pages to load upon browser startup. | 20 * Pages to load upon browser startup. |
| 21 * @private {!Array<!StartupPageInfo>} | 21 * @private {!Array<!StartupPageInfo>} |
| 22 */ | 22 */ |
| 23 startupPages_: Array, | 23 startupPages_: Array, |
| 24 | 24 |
| 25 /** @private */ |
| 25 showStartupUrlDialog_: Boolean, | 26 showStartupUrlDialog_: Boolean, |
| 27 |
| 28 /** @private {?StartupPageInfo} */ |
| 29 startupUrlDialogModel_: Object, |
| 26 }, | 30 }, |
| 27 | 31 |
| 28 /** @override */ | 32 /** @override */ |
| 29 attached: function() { | 33 attached: function() { |
| 30 this.browserProxy_ = settings.StartupUrlsPageBrowserProxyImpl.getInstance(); | 34 this.browserProxy_ = settings.StartupUrlsPageBrowserProxyImpl.getInstance(); |
| 31 this.addWebUIListener('update-startup-pages', function(startupPages) { | 35 this.addWebUIListener('update-startup-pages', function(startupPages) { |
| 32 this.startupPages_ = startupPages; | 36 this.startupPages_ = startupPages; |
| 33 }.bind(this)); | 37 }.bind(this)); |
| 34 this.browserProxy_.loadStartupPages(); | 38 this.browserProxy_.loadStartupPages(); |
| 39 |
| 40 this.addEventListener(settings.EDIT_STARTUP_URL_EVENT, function(event) { |
| 41 this.startupUrlDialogModel_ = event.detail; |
| 42 this.openDialog_(); |
| 43 event.stopPropagation(); |
| 44 }.bind(this)); |
| 45 }, |
| 46 |
| 47 /** @private */ |
| 48 onAddPageTap_: function() { |
| 49 this.openDialog_(); |
| 35 }, | 50 }, |
| 36 | 51 |
| 37 /** | 52 /** |
| 38 * Opens the dialog and registers a listener for removing the dialog from the | 53 * Opens the dialog and registers a listener for removing the dialog from the |
| 39 * DOM once is closed. The listener is destroyed when the dialog is removed | 54 * DOM once is closed. The listener is destroyed when the dialog is removed |
| 40 * (because of 'restamp'). | 55 * (because of 'restamp'). |
| 41 * @private | 56 * @private |
| 42 */ | 57 */ |
| 43 onAddPageTap_: function() { | 58 openDialog_: function() { |
| 44 this.showStartupUrlDialog_ = true; | 59 this.showStartupUrlDialog_ = true; |
| 45 this.async(function() { | 60 this.async(function() { |
| 46 var dialog = this.$$('settings-startup-url-dialog'); | 61 var dialog = this.$$('settings-startup-url-dialog'); |
| 47 dialog.addEventListener('iron-overlay-closed', function() { | 62 dialog.addEventListener('iron-overlay-closed', function() { |
| 48 this.showStartupUrlDialog_ = false; | 63 this.showStartupUrlDialog_ = false; |
| 64 this.startupUrlDialogModel_ = null; |
| 49 }.bind(this)); | 65 }.bind(this)); |
| 50 }.bind(this)); | 66 }.bind(this)); |
| 51 }, | 67 }, |
| 52 | 68 |
| 53 /** @private */ | 69 /** @private */ |
| 54 onUseCurrentPagesTap_: function() { | 70 onUseCurrentPagesTap_: function() { |
| 55 this.browserProxy_.useCurrentPages(); | 71 this.browserProxy_.useCurrentPages(); |
| 56 }, | 72 }, |
| 57 }); | 73 }); |
| OLD | NEW |