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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/ContentProviders.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 /** 30 /**
31 * @implements {WebInspector.ContentProvider} 31 * @implements {Common.ContentProvider}
32 * @unrestricted 32 * @unrestricted
33 */ 33 */
34 WebInspector.CompilerSourceMappingContentProvider = class { 34 SDK.CompilerSourceMappingContentProvider = class {
35 /** 35 /**
36 * @param {string} sourceURL 36 * @param {string} sourceURL
37 * @param {!WebInspector.ResourceType} contentType 37 * @param {!Common.ResourceType} contentType
38 */ 38 */
39 constructor(sourceURL, contentType) { 39 constructor(sourceURL, contentType) {
40 this._sourceURL = sourceURL; 40 this._sourceURL = sourceURL;
41 this._contentType = contentType; 41 this._contentType = contentType;
42 } 42 }
43 43
44 /** 44 /**
45 * @override 45 * @override
46 * @return {string} 46 * @return {string}
47 */ 47 */
48 contentURL() { 48 contentURL() {
49 return this._sourceURL; 49 return this._sourceURL;
50 } 50 }
51 51
52 /** 52 /**
53 * @override 53 * @override
54 * @return {!WebInspector.ResourceType} 54 * @return {!Common.ResourceType}
55 */ 55 */
56 contentType() { 56 contentType() {
57 return this._contentType; 57 return this._contentType;
58 } 58 }
59 59
60 /** 60 /**
61 * @override 61 * @override
62 * @return {!Promise<?string>} 62 * @return {!Promise<?string>}
63 */ 63 */
64 requestContent() { 64 requestContent() {
65 var callback; 65 var callback;
66 var promise = new Promise(fulfill => callback = fulfill); 66 var promise = new Promise(fulfill => callback = fulfill);
67 WebInspector.multitargetNetworkManager.loadResource(this._sourceURL, content Loaded.bind(this)); 67 SDK.multitargetNetworkManager.loadResource(this._sourceURL, contentLoaded.bi nd(this));
68 return promise; 68 return promise;
69 69
70 /** 70 /**
71 * @param {number} statusCode 71 * @param {number} statusCode
72 * @param {!Object.<string, string>} headers 72 * @param {!Object.<string, string>} headers
73 * @param {string} content 73 * @param {string} content
74 * @this {WebInspector.CompilerSourceMappingContentProvider} 74 * @this {SDK.CompilerSourceMappingContentProvider}
75 */ 75 */
76 function contentLoaded(statusCode, headers, content) { 76 function contentLoaded(statusCode, headers, content) {
77 if (statusCode >= 400) { 77 if (statusCode >= 400) {
78 console.error( 78 console.error(
79 'Could not load content for ' + this._sourceURL + ' : ' + 79 'Could not load content for ' + this._sourceURL + ' : ' +
80 'HTTP status code: ' + statusCode); 80 'HTTP status code: ' + statusCode);
81 callback(null); 81 callback(null);
82 return; 82 return;
83 } 83 }
84 84
85 callback(content); 85 callback(content);
86 } 86 }
87 } 87 }
88 88
89 /** 89 /**
90 * @override 90 * @override
91 * @param {string} query 91 * @param {string} query
92 * @param {boolean} caseSensitive 92 * @param {boolean} caseSensitive
93 * @param {boolean} isRegex 93 * @param {boolean} isRegex
94 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} callb ack 94 * @param {function(!Array.<!Common.ContentProvider.SearchMatch>)} callback
95 */ 95 */
96 searchInContent(query, caseSensitive, isRegex, callback) { 96 searchInContent(query, caseSensitive, isRegex, callback) {
97 this.requestContent().then(contentLoaded); 97 this.requestContent().then(contentLoaded);
98 98
99 /** 99 /**
100 * @param {?string} content 100 * @param {?string} content
101 */ 101 */
102 function contentLoaded(content) { 102 function contentLoaded(content) {
103 if (typeof content !== 'string') { 103 if (typeof content !== 'string') {
104 callback([]); 104 callback([]);
105 return; 105 return;
106 } 106 }
107 107
108 callback(WebInspector.ContentProvider.performSearchInContent(content, quer y, caseSensitive, isRegex)); 108 callback(Common.ContentProvider.performSearchInContent(content, query, cas eSensitive, isRegex));
109 } 109 }
110 } 110 }
111 }; 111 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698