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

Unified Diff: Source/devtools/front_end/documentation/DocumentationURLProvider.js

Issue 466743002: DevTools: Show doc context menu items for matching methods on all objects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Comments addressed Created 6 years, 4 months 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: Source/devtools/front_end/documentation/DocumentationURLProvider.js
diff --git a/Source/devtools/front_end/documentation/DocumentationURLProvider.js b/Source/devtools/front_end/documentation/DocumentationURLProvider.js
index 250616331bfb79b29ad2a161e232a267627daf24..1527136a7af67384e28df4e1b9ce2dfdaedacf58 100644
--- a/Source/devtools/front_end/documentation/DocumentationURLProvider.js
+++ b/Source/devtools/front_end/documentation/DocumentationURLProvider.js
@@ -11,22 +11,22 @@ WebInspector.DocumentationURLProvider = function()
/**
* @const
- * @type {!Array.<!Object, string>}
+ * @type {!Array.<{source: !Object, url: string, name: string}>}
*/
WebInspector.DocumentationURLProvider._sources = [
- { source: window, url: "javascript/" },
- { source: window.Node.prototype, url: "dom/Node/" },
- { source: window.Node, url: "dom/Node/" },
- { source: window.Object.prototype, url: "javascript/Object/" },
- { source: window.Object, url: "javascript/Object/" },
- { source: window.Math, url: "javascript/Math/" },
- { source: window.Array.prototype, url: "javascript/Array/" },
- { source: window.Array, url: "javascript/Array/" },
- { source: window.String.prototype, url: "javascript/String/" },
- { source: window.String, url: "javascript/String/" },
- { source: window.Date.prototype, url: "javascript/Date/" },
- { source: window.Date, url: "javascript/Date/" },
- { source: window.JSON, url: "javascript/JSON/" }
+ { source: window, url: "javascript/", name: "Global" },
+ { source: window.Node.prototype, url: "dom/Node/", name: "Node.prototype" },
+ { source: window.Node, url: "dom/Node/", name: "Node" },
+ { source: window.Object.prototype, url: "javascript/Object/", name: "Object.prototype" },
+ { source: window.Object, url: "javascript/Object/", name: "Object" },
+ { source: window.Math, url: "javascript/Math/", name: "Math" },
+ { source: window.Array.prototype, url: "javascript/Array/", name: "Array.prototype" },
+ { source: window.Array, url: "javascript/Array/", name: "Array" },
+ { source: window.String.prototype, url: "javascript/String/", name: "String.prototype" },
+ { source: window.String, url: "javascript/String/", name: "String" },
+ { source: window.Date.prototype, url: "javascript/Date/", name: "Date.prototype" },
+ { source: window.Date, url: "javascript/Date/", name: "Date" },
+ { source: window.JSON, url: "javascript/JSON/", name: "JSON" }
];
/**
@@ -37,15 +37,21 @@ WebInspector.DocumentationURLProvider._urlFormat = "http://docs.webplatform.org/
WebInspector.DocumentationURLProvider.prototype = {
/**
* @param {string} searchTerm
- * @return {?string}
+ * @return {!Array.<{url: string, name: string}>}
*/
- itemPath: function(searchTerm)
+ itemDescriptors: function(searchTerm)
{
+ var possibleProperties = [];
for (var i = 0; i < WebInspector.DocumentationURLProvider._sources.length; ++i) {
var sourceRef = WebInspector.DocumentationURLProvider._sources[i];
- if (sourceRef.source[searchTerm] instanceof Function)
- return String.sprintf(WebInspector.DocumentationURLProvider._urlFormat, sourceRef.url, searchTerm);
+ if (sourceRef.source[searchTerm] instanceof Function) {
+ var property = {
+ url: String.sprintf(WebInspector.DocumentationURLProvider._urlFormat, sourceRef.url, searchTerm),
+ name: sourceRef.name
+ };
+ possibleProperties.push(property);
+ }
}
- return null;
+ return possibleProperties;
}
}

Powered by Google App Engine
This is Rietveld 408576698