Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 * @constructor | 31 * @constructor |
| 32 * @extends {WebInspector.ThrottledWidget} | 32 * @extends {WebInspector.ThrottledWidget} |
| 33 */ | 33 */ |
| 34 WebInspector.EventListenersWidget = function() | 34 WebInspector.EventListenersWidget = function() |
| 35 { | 35 { |
| 36 WebInspector.ThrottledWidget.call(this); | 36 WebInspector.ThrottledWidget.call(this); |
| 37 this.element.classList.add("events-pane"); | 37 this.element.classList.add("events-pane"); |
| 38 | 38 |
| 39 this._showForAncestorsSetting = WebInspector.settings.createSetting("showEve ntListenersForAncestors", true); | 39 this._showForAncestorsSetting = WebInspector.settings.createSetting("showEve ntListenersForAncestors", true); |
| 40 this._showForAncestorsSetting.addChangeListener(this.update.bind(this)); | 40 this._showForAncestorsSetting.addChangeListener(this.update.bind(this)); |
| 41 | |
| 42 this._resolveFrameworkHandlersSetting = WebInspector.settings.createSetting( "resolveFrameworkHandlers", true); | |
| 43 this._resolveFrameworkHandlersSetting.addChangeListener(this.update.bind(thi s)); | |
| 44 | |
| 41 this._eventListenersView = new WebInspector.EventListenersView(this.element) ; | 45 this._eventListenersView = new WebInspector.EventListenersView(this.element) ; |
| 42 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this.upda te, this); | 46 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this.upda te, this); |
| 43 } | 47 } |
| 44 | 48 |
| 45 /** | 49 /** |
| 46 * @return {!WebInspector.ElementsSidebarViewWrapperPane} | 50 * @return {!WebInspector.ElementsSidebarViewWrapperPane} |
| 47 */ | 51 */ |
| 48 WebInspector.EventListenersWidget.createSidebarWrapper = function() | 52 WebInspector.EventListenersWidget.createSidebarWrapper = function() |
| 49 { | 53 { |
| 50 var widget = new WebInspector.EventListenersWidget(); | 54 var widget = new WebInspector.EventListenersWidget(); |
| 51 var result = new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UI String("Event Listeners"), widget); | 55 var result = new WebInspector.ElementsSidebarViewWrapperPane(WebInspector.UI String("Event Listeners"), widget); |
| 52 var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Re fresh"), "refresh-toolbar-item"); | 56 var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Re fresh"), "refresh-toolbar-item"); |
| 53 refreshButton.addEventListener("click", widget.update.bind(widget)); | 57 refreshButton.addEventListener("click", widget.update.bind(widget)); |
| 54 result.toolbar().appendToolbarItem(refreshButton); | 58 result.toolbar().appendToolbarItem(refreshButton); |
| 55 result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspe ctor.UIString("Ancestors"), WebInspector.UIString("Show listeners on the ancesto rs"), widget._showForAncestorsSetting)); | 59 result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspe ctor.UIString("Ancestors"), WebInspector.UIString("Show listeners on the ancesto rs"), widget._showForAncestorsSetting)); |
| 60 result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspe ctor.UIString("Resolve handlers"), WebInspector.UIString("Resolve framework's ev ent handlers"), widget._resolveFrameworkHandlersSetting)); | |
|
yurys
2015/08/12 21:56:03
Framework handlers
| |
| 56 return result; | 61 return result; |
| 57 } | 62 } |
| 58 | 63 |
| 59 WebInspector.EventListenersWidget._objectGroupName = "event-listeners-panel"; | 64 WebInspector.EventListenersWidget._objectGroupName = "event-listeners-panel"; |
| 60 | 65 |
| 61 WebInspector.EventListenersWidget.prototype = { | 66 WebInspector.EventListenersWidget.prototype = { |
| 62 /** | 67 /** |
| 63 * @override | 68 * @override |
| 64 * @param {!WebInspector.Throttler.FinishCallback} finishCallback | 69 * @param {!WebInspector.Throttler.FinishCallback} finishCallback |
| 65 * @protected | 70 * @protected |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 83 var listenersView = this._eventListenersView; | 88 var listenersView = this._eventListenersView; |
| 84 promises.push(node.resolveToObjectPromise(WebInspector.EventListenersWid get._objectGroupName)); | 89 promises.push(node.resolveToObjectPromise(WebInspector.EventListenersWid get._objectGroupName)); |
| 85 if (!selectedNodeOnly) { | 90 if (!selectedNodeOnly) { |
| 86 var currentNode = node.parentNode; | 91 var currentNode = node.parentNode; |
| 87 while (currentNode) { | 92 while (currentNode) { |
| 88 promises.push(currentNode.resolveToObjectPromise(WebInspector.Ev entListenersWidget._objectGroupName)); | 93 promises.push(currentNode.resolveToObjectPromise(WebInspector.Ev entListenersWidget._objectGroupName)); |
| 89 currentNode = currentNode.parentNode; | 94 currentNode = currentNode.parentNode; |
| 90 } | 95 } |
| 91 promises.push(this._windowObjectInNodeContext(node)); | 96 promises.push(this._windowObjectInNodeContext(node)); |
| 92 } | 97 } |
| 93 Promise.all(promises).then(this._eventListenersView.addObjects.bind(this ._eventListenersView)).then(finishCallback.bind(this, undefined)); | 98 Promise.all(promises).then(this._eventListenersView.addObjects.bind(this ._eventListenersView, this._resolveFrameworkHandlersSetting.get())).then(finishC allback.bind(this, undefined)); |
| 94 }, | 99 }, |
| 95 | 100 |
| 96 /** | 101 /** |
| 97 * @param {!WebInspector.DOMNode} node | 102 * @param {!WebInspector.DOMNode} node |
| 98 * @return {!Promise<!WebInspector.RemoteObject>} | 103 * @return {!Promise<!WebInspector.RemoteObject>} |
| 99 */ | 104 */ |
| 100 _windowObjectInNodeContext: function(node) | 105 _windowObjectInNodeContext: function(node) |
| 101 { | 106 { |
| 102 return new Promise(windowObjectInNodeContext); | 107 return new Promise(windowObjectInNodeContext); |
| 103 | 108 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 121 context.evaluate("self", WebInspector.EventListenersWidget._objectGr oupName, false, true, false, false, fulfill); | 126 context.evaluate("self", WebInspector.EventListenersWidget._objectGr oupName, false, true, false, false, fulfill); |
| 122 } | 127 } |
| 123 }, | 128 }, |
| 124 | 129 |
| 125 _eventListenersArrivedForTest: function() | 130 _eventListenersArrivedForTest: function() |
| 126 { | 131 { |
| 127 }, | 132 }, |
| 128 | 133 |
| 129 __proto__: WebInspector.ThrottledWidget.prototype | 134 __proto__: WebInspector.ThrottledWidget.prototype |
| 130 } | 135 } |
| OLD | NEW |