OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * @implements {WebInspector.ContentProvider} | 7 * @implements {WebInspector.ContentProvider} |
8 * @param {!WebInspector.CSSModel} cssModel | 8 * @param {!WebInspector.CSSModel} cssModel |
9 * @param {!CSSAgent.CSSStyleSheetHeader} payload | 9 * @param {!CSSAgent.CSSStyleSheetHeader} payload |
10 */ | 10 */ |
11 WebInspector.CSSStyleSheetHeader = function(cssModel, payload) | 11 WebInspector.CSSStyleSheetHeader = function(cssModel, payload) |
12 { | 12 { |
13 this._cssModel = cssModel; | 13 this._cssModel = cssModel; |
14 this.id = payload.styleSheetId; | 14 this.id = payload.styleSheetId; |
15 this.frameId = payload.frameId; | 15 this.frameId = payload.frameId; |
16 this.sourceURL = payload.sourceURL; | 16 this.sourceURL = payload.sourceURL; |
17 this.hasSourceURL = !!payload.hasSourceURL; | 17 this.hasSourceURL = !!payload.hasSourceURL; |
18 this.origin = payload.origin; | 18 this.origin = payload.origin; |
19 this.title = payload.title; | 19 this.title = payload.title; |
20 this.disabled = payload.disabled; | 20 this.disabled = payload.disabled; |
21 this.isInline = payload.isInline; | 21 this.isInline = payload.isInline; |
22 this.startLine = payload.startLine; | 22 this.startLine = payload.startLine; |
23 this.startColumn = payload.startColumn; | 23 this.startColumn = payload.startColumn; |
24 if (payload.ownerNode) | 24 if (payload.ownerNode) |
25 this.ownerNode = new WebInspector.DeferredDOMNode(cssModel.target(), pay
load.ownerNode); | 25 this.ownerNode = new WebInspector.DeferredDOMNode(cssModel.target(), pay
load.ownerNode); |
26 this.setSourceMapURL(payload.sourceMapURL); | 26 this.setSourceMapURL(payload.sourceMapURL); |
27 } | 27 }; |
28 | 28 |
29 WebInspector.CSSStyleSheetHeader.prototype = { | 29 WebInspector.CSSStyleSheetHeader.prototype = { |
30 /** | 30 /** |
31 * @return {!WebInspector.ContentProvider} | 31 * @return {!WebInspector.ContentProvider} |
32 */ | 32 */ |
33 originalContentProvider: function() | 33 originalContentProvider: function() |
34 { | 34 { |
35 if (!this._originalContentProvider) { | 35 if (!this._originalContentProvider) { |
36 var lazyContent = this._cssModel.originalStyleSheetText.bind(this._c
ssModel, this); | 36 var lazyContent = this._cssModel.originalStyleSheetText.bind(this._c
ssModel, this); |
37 this._originalContentProvider = new WebInspector.StaticContentProvid
er(this.contentURL(), this.contentType(), lazyContent); | 37 this._originalContentProvider = new WebInspector.StaticContentProvid
er(this.contentURL(), this.contentType(), lazyContent); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 this.requestContent().then(performSearch); | 152 this.requestContent().then(performSearch); |
153 }, | 153 }, |
154 | 154 |
155 /** | 155 /** |
156 * @return {boolean} | 156 * @return {boolean} |
157 */ | 157 */ |
158 isViaInspector: function() | 158 isViaInspector: function() |
159 { | 159 { |
160 return this.origin === "inspector"; | 160 return this.origin === "inspector"; |
161 } | 161 } |
162 } | 162 }; |
163 | 163 |
164 /** | 164 /** |
165 * @constructor | 165 * @constructor |
166 * @implements {WebInspector.ContentProvider} | 166 * @implements {WebInspector.ContentProvider} |
167 * @param {!WebInspector.CSSStyleSheetHeader} header | 167 * @param {!WebInspector.CSSStyleSheetHeader} header |
168 */ | 168 */ |
169 WebInspector.CSSStyleSheetHeader.OriginalContentProvider = function(header) | 169 WebInspector.CSSStyleSheetHeader.OriginalContentProvider = function(header) |
170 { | 170 { |
171 this._header = header; | 171 this._header = header; |
172 } | 172 }; |
173 | 173 |
174 WebInspector.CSSStyleSheetHeader.OriginalContentProvider.prototype = { | 174 WebInspector.CSSStyleSheetHeader.OriginalContentProvider.prototype = { |
175 /** | 175 /** |
176 * @override | 176 * @override |
177 * @return {string} | 177 * @return {string} |
178 */ | 178 */ |
179 contentURL: function() | 179 contentURL: function() |
180 { | 180 { |
181 return this._header.contentURL(); | 181 return this._header.contentURL(); |
182 }, | 182 }, |
(...skipping 29 matching lines...) Expand all Loading... |
212 * @param {?string} content | 212 * @param {?string} content |
213 */ | 213 */ |
214 function performSearch(content) | 214 function performSearch(content) |
215 { | 215 { |
216 var searchResults = content ? WebInspector.ContentProvider.performSe
archInContent(content, query, caseSensitive, isRegex) : []; | 216 var searchResults = content ? WebInspector.ContentProvider.performSe
archInContent(content, query, caseSensitive, isRegex) : []; |
217 callback(searchResults); | 217 callback(searchResults); |
218 } | 218 } |
219 | 219 |
220 this.requestContent().then(performSearch); | 220 this.requestContent().then(performSearch); |
221 } | 221 } |
222 } | 222 }; |
OLD | NEW |