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

Side by Side Diff: Source/devtools/front_end/sdk/Resource.js

Issue 667743002: DevTools: remove "type" getters in Resource and NetworkRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 * @return {string} 157 * @return {string}
158 */ 158 */
159 get displayName() 159 get displayName()
160 { 160 {
161 return this._parsedURL.displayName; 161 return this._parsedURL.displayName;
162 }, 162 },
163 163
164 /** 164 /**
165 * @return {!WebInspector.ResourceType} 165 * @return {!WebInspector.ResourceType}
166 */ 166 */
167 get type() 167 resourceType: function()
168 { 168 {
169 return this._request ? this._request.type : this._type; 169 return this._request ? this._request.resourceType() : this._type;
170 }, 170 },
171 171
172 /** 172 /**
173 * @return {string} 173 * @return {string}
174 */ 174 */
175 get mimeType() 175 get mimeType()
176 { 176 {
177 return this._request ? this._request.mimeType : this._mimeType; 177 return this._request ? this._request.mimeType : this._mimeType;
178 }, 178 },
179 179
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 contentURL: function() 255 contentURL: function()
256 { 256 {
257 return this._url; 257 return this._url;
258 }, 258 },
259 259
260 /** 260 /**
261 * @return {!WebInspector.ResourceType} 261 * @return {!WebInspector.ResourceType}
262 */ 262 */
263 contentType: function() 263 contentType: function()
264 { 264 {
265 return this.type; 265 return this.resourceType();
266 }, 266 },
267 267
268 /** 268 /**
269 * @param {function(?string)} callback 269 * @param {function(?string)} callback
270 */ 270 */
271 requestContent: function(callback) 271 requestContent: function(callback)
272 { 272 {
273 if (typeof this._content !== "undefined") { 273 if (typeof this._content !== "undefined") {
274 callback(this._content); 274 callback(this._content);
275 return; 275 return;
276 } 276 }
277 277
278 this._pendingContentCallbacks.push(callback); 278 this._pendingContentCallbacks.push(callback);
279 if (!this._request || this._request.finished) 279 if (!this._request || this._request.finished)
280 this._innerRequestContent(); 280 this._innerRequestContent();
281 }, 281 },
282 282
283 /** 283 /**
284 * @return {string} 284 * @return {string}
285 */ 285 */
286 canonicalMimeType: function() 286 canonicalMimeType: function()
287 { 287 {
288 return this.type.canonicalMimeType() || this.mimeType; 288 return this.resourceType().canonicalMimeType() || this.mimeType;
289 }, 289 },
290 290
291 /** 291 /**
292 * @param {string} query 292 * @param {string} query
293 * @param {boolean} caseSensitive 293 * @param {boolean} caseSensitive
294 * @param {boolean} isRegex 294 * @param {boolean} isRegex
295 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback 295 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback
296 */ 296 */
297 searchInContent: function(query, caseSensitive, isRegex, callback) 297 searchInContent: function(query, caseSensitive, isRegex, callback)
298 { 298 {
299 /** 299 /**
300 * @param {?Protocol.Error} error 300 * @param {?Protocol.Error} error
301 * @param {!Array.<!PageAgent.SearchMatch>} searchMatches 301 * @param {!Array.<!PageAgent.SearchMatch>} searchMatches
302 */ 302 */
303 function callbackWrapper(error, searchMatches) 303 function callbackWrapper(error, searchMatches)
304 { 304 {
305 callback(searchMatches || []); 305 callback(searchMatches || []);
306 } 306 }
307 307
308 if (this.type === WebInspector.resourceTypes.Document) { 308 if (this.resourceType() === WebInspector.resourceTypes.Document) {
309 callback([]); 309 callback([]);
310 return; 310 return;
311 } 311 }
312 312
313 if (this.frameId) 313 if (this.frameId)
314 this.target().pageAgent().searchInResource(this.frameId, this.url, q uery, caseSensitive, isRegex, callbackWrapper); 314 this.target().pageAgent().searchInResource(this.frameId, this.url, q uery, caseSensitive, isRegex, callbackWrapper);
315 else 315 else
316 callback([]); 316 callback([]);
317 }, 317 },
318 318
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 if (this._type.isTextType()) 414 if (this._type.isTextType())
415 return true; 415 return true;
416 if (this._type === WebInspector.resourceTypes.Other) 416 if (this._type === WebInspector.resourceTypes.Other)
417 return !!this._content && !this._contentEncoded; 417 return !!this._content && !this._contentEncoded;
418 return false; 418 return false;
419 }, 419 },
420 420
421 __proto__: WebInspector.SDKObject.prototype 421 __proto__: WebInspector.SDKObject.prototype
422 } 422 }
423 423
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/NetworkRequest.js ('k') | Source/devtools/front_end/sdk/ResourceTreeModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698