Diff
Modified: trunk/Source/WebCore/ChangeLog (101138 => 101139)
--- trunk/Source/WebCore/ChangeLog 2011-11-24 14:57:34 UTC (rev 101138)
+++ trunk/Source/WebCore/ChangeLog 2011-11-24 15:12:41 UTC (rev 101139)
@@ -1,3 +1,29 @@
+2011-11-24 Andrey Kosyakov <[email protected]>
+
+ Web Inspector: provide context menu items to open resources using extensions
+ https://bugs.webkit.org/show_bug.cgi?id=73076
+
+ Reviewed by Yury Semikhatsky.
+
+ * English.lproj/localizedStrings.js:
+ * inspector/front-end/ExtensionServer.js:
+ (WebInspector.ExtensionServer.prototype._onSetOpenResourceHandler):
+ (WebInspector.ExtensionServer.prototype._handleOpenURL):
+ * inspector/front-end/HandlerRegistry.js:
+ (get WebInspector.HandlerRegistry.prototype.set dispatch):
+ (get WebInspector.HandlerRegistry.prototype.dispatchToHandler):
+ * inspector/front-end/_javascript_SourceFrame.js:
+ (WebInspector._javascript_SourceFrame.prototype.populateTextAreaContextMenu):
+ * inspector/front-end/ResourcesPanel.js:
+ (WebInspector.FrameResourceTreeElement.prototype._handleContextMenuEvent):
+ * inspector/front-end/SourceFrame.js:
+ (WebInspector.SourceFrame.prototype.populateTextAreaContextMenu):
+ * inspector/front-end/externs.js:
+ (WebInspector.populateResourceContextMenu):
+ * inspector/front-end/inspector.js:
+ (WebInspector.populateResourceContextMenu):
+ (WebInspector._showAnchorLocation):
+
2011-10-27 Philippe Normand <[email protected]>
[GStreamer] WebAudio AudioDestination
Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js
(Binary files differ)
Modified: trunk/Source/WebCore/inspector/front-end/ExtensionServer.js (101138 => 101139)
--- trunk/Source/WebCore/inspector/front-end/ExtensionServer.js 2011-11-24 14:57:34 UTC (rev 101138)
+++ trunk/Source/WebCore/inspector/front-end/ExtensionServer.js 2011-11-24 15:12:41 UTC (rev 101139)
@@ -272,14 +272,14 @@
{
var name = this._registeredExtensions[port._extensionOrigin].name || ("Extension " + port._extensionOrigin);
if (message.handlerPresent)
- WebInspector.openAnchorLocationRegistry.registerHandler(name, this._handleAnchorClicked.bind(this, port));
+ WebInspector.openAnchorLocationRegistry.registerHandler(name, this._handleOpenURL.bind(this, port));
else
WebInspector.openAnchorLocationRegistry.unregisterHandler(name);
},
- _handleAnchorClicked: function(port, anchor)
+ _handleOpenURL: function(port, url)
{
- var resource = WebInspector.resourceForURL(anchor.href);
+ var resource = WebInspector.resourceForURL(url);
if (!resource)
return false;
port.postMessage({
Modified: trunk/Source/WebCore/inspector/front-end/HandlerRegistry.js (101138 => 101139)
--- trunk/Source/WebCore/inspector/front-end/HandlerRegistry.js 2011-11-24 14:57:34 UTC (rev 101138)
+++ trunk/Source/WebCore/inspector/front-end/HandlerRegistry.js 2011-11-24 15:12:41 UTC (rev 101139)
@@ -57,10 +57,22 @@
this._setting.set(value);
},
- dispatch: function()
+ /**
+ * @param {Object} data
+ */
+ dispatch: function(data)
{
- var handler = this._handlers[this._activeHandler];
- var result = handler && handler.apply(null, arguments);
+ this.dispatchToHandler(this._activeHandler, data);
+ },
+
+ /**
+ * @param {string} name
+ * @param {Object} data
+ */
+ dispatchToHandler: function(name, data)
+ {
+ var handler = this._handlers[name];
+ var result = handler && handler(data);
return !!result;
},
Modified: trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js (101138 => 101139)
--- trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js 2011-11-24 14:57:34 UTC (rev 101138)
+++ trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js 2011-11-24 15:12:41 UTC (rev 101139)
@@ -146,6 +146,7 @@
populateTextAreaContextMenu: function(contextMenu)
{
+ WebInspector.SourceFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu);
var selection = window.getSelection();
if (selection.type !== "Range" || selection.isCollapsed)
return;
Modified: trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js (101138 => 101139)
--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js 2011-11-24 14:57:34 UTC (rev 101138)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js 2011-11-24 15:12:41 UTC (rev 101139)
@@ -1242,6 +1242,7 @@
var contextMenu = new WebInspector.ContextMenu();
contextMenu.appendItem(WebInspector.openLinkExternallyLabel(), WebInspector.openResource.bind(WebInspector, this._resource.url, false));
this._appendOpenInNetworkPanelAction(contextMenu, event);
+ WebInspector.populateResourceContextMenu(contextMenu, this._resource.url);
this._appendSaveAsAction(contextMenu, event);
contextMenu.show(event);
},
Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (101138 => 101139)
--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2011-11-24 14:57:34 UTC (rev 101138)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js 2011-11-24 15:12:41 UTC (rev 101139)
@@ -491,6 +491,9 @@
populateTextAreaContextMenu: function(contextMenu)
{
+ if (!window.getSelection().isCollapsed)
+ return;
+ WebInspector.populateResourceContextMenu(contextMenu, this._url);
},
suggestedFileName: function()
Modified: trunk/Source/WebCore/inspector/front-end/externs.js (101138 => 101139)
--- trunk/Source/WebCore/inspector/front-end/externs.js 2011-11-24 14:57:34 UTC (rev 101138)
+++ trunk/Source/WebCore/inspector/front-end/externs.js 2011-11-24 15:12:41 UTC (rev 101139)
@@ -113,6 +113,8 @@
WebInspector.openRequestInNetworkPanel = function(request) {}
+WebInspector.populateResourceContextMenu = function(contextMenu, url) {}
+
WebInspector.evaluateInConsole = function(_expression_) {}
var InjectedFakeWorker = function() {}
Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (101138 => 101139)
--- trunk/Source/WebCore/inspector/front-end/inspector.js 2011-11-24 14:57:34 UTC (rev 101138)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js 2011-11-24 15:12:41 UTC (rev 101139)
@@ -782,9 +782,20 @@
this.panels.elements.revealAndSelectNode(nodeId);
}
+WebInspector.populateResourceContextMenu = function(contextMenu, url)
+{
+ var registry = WebInspector.openAnchorLocationRegistry;
+ // Skip 0th handler, as it's 'Use default panel' one.
+ for (var i = 1; i < registry.handlerNames.length; ++i) {
+ var handler = registry.handlerNames[i];
+ contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Open using %s" : "Open Using %s", handler),
+ registry.dispatchToHandler.bind(registry, handler, url));
+ }
+}
+
WebInspector._showAnchorLocation = function(anchor)
{
- if (WebInspector.openAnchorLocationRegistry.dispatch(anchor))
+ if (WebInspector.openAnchorLocationRegistry.dispatch(anchor.href))
return true;
var preferedPanel = this.panels[anchor.getAttribute("preferred_panel") || "resources"];
if (WebInspector._showAnchorLocationInPanel(anchor, preferedPanel))