Chromium Code Reviews| Index: chrome/browser/resources/settings/site_settings/protocol_handlers.js |
| diff --git a/chrome/browser/resources/settings/site_settings/protocol_handlers.js b/chrome/browser/resources/settings/site_settings/protocol_handlers.js |
| index 404d3df1dae065d45fdc772379c1a1835e0784fb..6fbf427a862e44a86366fc261cc17bf586560d2c 100644 |
| --- a/chrome/browser/resources/settings/site_settings/protocol_handlers.js |
| +++ b/chrome/browser/resources/settings/site_settings/protocol_handlers.js |
| @@ -51,14 +51,10 @@ Polymer({ |
| protocols: Array, |
| /** |
| - * The possible menu actions. |
| - * @type {MenuActions} |
| + * The targetted object for menu operations. |
| + * @private {?Object} |
| */ |
| - menuActions_: { |
| - type: Object, |
| - value: MenuActions, |
| - readOnly: true, |
| - }, |
| + actionMenuModel_: Object |
| }, |
| ready: function() { |
| @@ -133,18 +129,44 @@ Polymer({ |
| }, |
| /** |
| - * A handler when an action is selected in the action menu. |
| - * @param {!{model: !{item: ProtocolHandlerEntry}, |
| - * detail: !{selected: string}}} event |
| + * The handler for when "Set Default" is selected in the action menu. |
| * @private |
| */ |
| - onActionMenuIronActivate_: function(event) { |
| - var protocol = event.model.item.protocol; |
| - var url = event.model.item.spec; |
| - if (event.detail.selected == MenuActions.SET_DEFAULT) { |
| - this.browserProxy.setProtocolDefault(protocol, url); |
| - } else if (event.detail.selected == MenuActions.REMOVE) { |
| - this.browserProxy.removeProtocolHandler(protocol, url); |
| - } |
| + onDefaultTap_: function() { |
| + var item = this.actionMenuModel_.item; |
| + var protocol = item.protocol; |
| + var url = item.spec; |
| + |
| + this.$$('dialog[is=cr-action-menu]').close(); |
| + this.actionMenuModel_ = null; |
| + this.browserProxy.setProtocolDefault(protocol, url); |
| }, |
| + |
| + /** |
| + * The handler for when "Remove" is selected in the action menu. |
| + * @private |
| + */ |
| + onRemoveTap_: function() { |
| + var item = this.actionMenuModel_.item; |
| + var protocol = item.protocol; |
| + var url = item.spec; |
| + |
| + this.$$('dialog[is=cr-action-menu]').close(); |
| + this.actionMenuModel_ = null; |
| + this.browserProxy.removeProtocolHandler(protocol, url); |
|
dpapad
2016/11/14 18:26:20
Nit: local vars protocol and url, don't seem to ad
scottchen
2016/11/14 21:38:36
Done.
|
| + }, |
| + |
| + /** |
| + * A handler to show the action menu next to the clicked menu button. |
| + * @param {!{model: !{protocol: HandlerEntry, item: ProtocolEntry, |
| + * index: number}}} event |
| + * @private |
| + */ |
| + showMenu_: function(event) { |
| + this.actionMenuModel_ = event.model; |
| + /** @type {!CrActionMenuElement} */ ( |
| + this.$$('dialog[is=cr-action-menu]')).showAt( |
| + /** @type {!Element} */ ( |
| + Polymer.dom(/** @type {!Event} */ (event)).localTarget)); |
| + } |
| }); |