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

Side by Side Diff: Source/devtools/front_end/documentation/DocumentationURLProvider.js

Issue 471583003: DevTools: [Documentation] Add property token autodetection (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sources-patch
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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 */ 7 */
8 WebInspector.DocumentationURLProvider = function() 8 WebInspector.DocumentationURLProvider = function()
9 { 9 {
10 } 10 }
(...skipping 23 matching lines...) Expand all
34 ]; 34 ];
35 35
36 /** 36 /**
37 * @const 37 * @const
38 */ 38 */
39 WebInspector.DocumentationURLProvider._urlFormat = "http://docs.webplatform.org/ w/api.php?action=query&titles=%s%s&prop=revisions&rvprop=timestamp|content&forma t=json" 39 WebInspector.DocumentationURLProvider._urlFormat = "http://docs.webplatform.org/ w/api.php?action=query&titles=%s%s&prop=revisions&rvprop=timestamp|content&forma t=json"
40 40
41 WebInspector.DocumentationURLProvider.prototype = { 41 WebInspector.DocumentationURLProvider.prototype = {
42 /** 42 /**
43 * @param {string} searchTerm 43 * @param {string} searchTerm
44 * @return {!Array.<{url: string, name: string}>} 44 * @return {!Array.<{url: string, name: string, searchItem: string}>}
45 */ 45 */
46 itemDescriptors: function(searchTerm) 46 itemDescriptors: function(searchTerm)
47 { 47 {
48 var descriptors = []; 48 var descriptors = [];
49 for (var i = 0; i < WebInspector.DocumentationURLProvider._sources.lengt h; ++i) { 49 for (var i = 0; i < WebInspector.DocumentationURLProvider._sources.lengt h; ++i) {
50 var sourceRef = WebInspector.DocumentationURLProvider._sources[i]; 50 var sourceRef = WebInspector.DocumentationURLProvider._sources[i];
51 if (!sourceRef.source.hasOwnProperty(searchTerm)) 51 if (!sourceRef.source.hasOwnProperty(searchTerm))
52 continue; 52 continue;
53 descriptors.push(createDescriptor(searchTerm.toUpperCase() === searc hTerm ? "constants" : searchTerm)); 53 descriptors.push(createDescriptor(searchTerm.toUpperCase() === searc hTerm ? "constants" : searchTerm));
54 } 54 }
55 return descriptors; 55 return descriptors;
56 56
57 /** 57 /**
58 * @param {string} searchTerm 58 * @param {string} searchTerm
59 * @return {{url: string, name: string}} 59 * @return {{url: string, name: string}}
60 */ 60 */
61 function createDescriptor(searchTerm) 61 function createDescriptor(searchTerm)
62 { 62 {
63 return { 63 return {
64 url: String.sprintf(WebInspector.DocumentationURLProvider._urlFo rmat, sourceRef.url, searchTerm), 64 url: String.sprintf(WebInspector.DocumentationURLProvider._urlFo rmat, sourceRef.url, searchTerm),
65 name: sourceRef.name 65 name: sourceRef.name,
66 searchItem: searchTerm
66 }; 67 };
67 } 68 }
68 } 69 }
69 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698