| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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-url-entry represents a UI component that | 6 * @fileoverview settings-startup-url-entry represents a UI component that |
| 7 * displayes a URL that is loaded during startup. It includes a menu that allows | 7 * displayes a URL that is loaded during startup. It includes a menu that allows |
| 8 * the user to edit/remove the entry. | 8 * the user to edit/remove the entry. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 cr.exportPath('settings'); | 11 cr.exportPath('settings'); |
| 12 | 12 |
| 13 /** | 13 /** |
| 14 * The name of the event fired from this element when the "Edit" option is | 14 * The name of the event fired from this element when the "Edit" option is |
| 15 * tapped. | 15 * tapped. |
| 16 * @const {string} | 16 * @const {string} |
| 17 */ | 17 */ |
| 18 settings.EDIT_STARTUP_URL_EVENT = 'edit-startup-url'; | 18 settings.EDIT_STARTUP_URL_EVENT = 'edit-startup-url'; |
| 19 | 19 |
| 20 Polymer({ | 20 Polymer({ |
| 21 is: 'settings-startup-url-entry', | 21 is: 'settings-startup-url-entry', |
| 22 | 22 |
| 23 properties: { | 23 properties: { |
| 24 editable: { |
| 25 type: Boolean, |
| 26 reflectToAttribute: true, |
| 27 }, |
| 28 |
| 24 /** @type {!StartupPageInfo} */ | 29 /** @type {!StartupPageInfo} */ |
| 25 model: Object, | 30 model: Object, |
| 26 }, | 31 }, |
| 27 | 32 |
| 28 /** | 33 /** |
| 29 * @param {string} url Location of an image to get a set of icons for. | 34 * @param {string} url Location of an image to get a set of icons for. |
| 30 * @return {string} A set of icon URLs. | 35 * @return {string} A set of icon URLs. |
| 31 * @private | 36 * @private |
| 32 */ | 37 */ |
| 33 getIconSet_: function(url) { | 38 getIconSet_: function(url) { |
| 34 return cr.icon.getFavicon(url); | 39 return cr.icon.getFavicon(url); |
| 35 }, | 40 }, |
| 36 | 41 |
| 37 /** @private */ | 42 /** @private */ |
| 38 onRemoveTap_: function() { | 43 onRemoveTap_: function() { |
| 39 this.$$('dialog[is=cr-action-menu]').close(); | 44 this.$$('dialog[is=cr-action-menu]').close(); |
| 40 settings.StartupUrlsPageBrowserProxyImpl.getInstance().removeStartupPage( | 45 settings.StartupUrlsPageBrowserProxyImpl.getInstance().removeStartupPage( |
| 41 this.model.modelIndex); | 46 this.model.modelIndex); |
| 42 }, | 47 }, |
| 43 | 48 |
| 44 /** @private */ | 49 /** @private */ |
| 45 onEditTap_: function() { | 50 onEditTap_: function() { |
| 46 this.$$('dialog[is=cr-action-menu]').close(); | 51 this.$$('dialog[is=cr-action-menu]').close(); |
| 47 this.fire(settings.EDIT_STARTUP_URL_EVENT, this.model); | 52 this.fire(settings.EDIT_STARTUP_URL_EVENT, this.model); |
| 48 }, | 53 }, |
| 49 | 54 |
| 50 /** @private */ | 55 /** @private */ |
| 51 onDotsTap_: function() { | 56 onDotsTap_: function() { |
| 52 var actionMenu = /** @type {!CrActionMenuElement} */( | 57 var actionMenu = /** @type {!CrActionMenuElement} */( |
| 53 this.$.menu.get()); | 58 this.$$('#menu').get()); |
| 54 actionMenu.showAt(assert(this.$.dots)); | 59 actionMenu.showAt(assert(this.$$('#dots'))); |
| 55 }, | 60 }, |
| 56 }); | 61 }); |
| OLD | NEW |