Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6044)

Unified Diff: chrome/browser/resources/settings/site_settings/protocol_handlers.js

Issue 2500513003: Make setting's protocol handler use cr-action-menu instead of paper-item. (Closed)
Patch Set: add tests to protocol handlers Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
+ }
});

Powered by Google App Engine
This is Rietveld 408576698