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

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

Issue 447703002: DocumentationURLProvider class created (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@semen
Patch Set: Files sorted by theirs names 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
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/documentation/DocumentationView.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..9fc4f257e31340797789b39c1b52f76ce965833f
--- /dev/null
+++ b/Source/devtools/front_end/documentation/DocumentationURLProvider.js
@@ -0,0 +1,44 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @constructor
+ */
+WebInspector.DocumentationURLProvider = function() {}
+
+/**
+ * @const
+ * @type {!Array.<!Object, string>}
+ */
+WebInspector.DocumentationURLProvider._Sources = [
+ { source: window, url: "javascript/" },
+ { source: window.Node.prototype, url: "dom/Node/" },
+ { source: window.Object, url: "javascript/Object/" },
+ { source: window.Math, url: "javascript/Math/" },
+ { source: window.Array, url: "javascript/Array/" },
+ { source: window.String, url: "javascript/String/" },
+ { source: window.Date, url: "javascript/Date/" },
+ { source: window.JSON, url: "javascript/JSON/" }
+]
+
+/**
+ * @const
+ */
+WebInspector.DocumentationURLProvider._URLFormat = "http://docs.webplatform.org/w/api.php?action=query&titles=%s%s&prop=revisions&rvprop=timestamp|content&format=json"
+
+WebInspector.DocumentationURLProvider.prototype = {
+ /**
+ * @param {string} searchTerm
+ * @return {?string}
+ */
+ itemPath: function(searchTerm)
+ {
+ 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);
+ }
+ return null;
+ }
+}
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/documentation/DocumentationView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698