| OLD | NEW |
| 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 14 matching lines...) Expand all Loading... |
| 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 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.RequestContentView} | 33 * @extends {WebInspector.RequestContentView} |
| 34 * @param {!WebInspector.NetworkRequest} request | 34 * @param {!WebInspector.NetworkRequest} request |
| 35 * @param {!WebInspector.View} responseView | 35 * @param {!WebInspector.Widget} responseView |
| 36 */ | 36 */ |
| 37 WebInspector.RequestPreviewView = function(request, responseView) | 37 WebInspector.RequestPreviewView = function(request, responseView) |
| 38 { | 38 { |
| 39 WebInspector.RequestContentView.call(this, request); | 39 WebInspector.RequestContentView.call(this, request); |
| 40 this._responseView = responseView; | 40 this._responseView = responseView; |
| 41 } | 41 } |
| 42 | 42 |
| 43 WebInspector.RequestPreviewView.prototype = { | 43 WebInspector.RequestPreviewView.prototype = { |
| 44 contentLoaded: function() | 44 contentLoaded: function() |
| 45 { | 45 { |
| 46 if (!this.request.content && !this.request.contentError()) { | 46 if (!this.request.content && !this.request.contentError()) { |
| 47 if (!this._emptyView) { | 47 if (!this._emptyWidget) { |
| 48 this._emptyView = this._createEmptyView(); | 48 this._emptyWidget = this._createEmptyWidget(); |
| 49 this._emptyView.show(this.element); | 49 this._emptyWidget.show(this.element); |
| 50 this.innerView = this._emptyView; | 50 this.innerView = this._emptyWidget; |
| 51 } | 51 } |
| 52 } else { | 52 } else { |
| 53 if (this._emptyView) { | 53 if (this._emptyWidget) { |
| 54 this._emptyView.detach(); | 54 this._emptyWidget.detach(); |
| 55 delete this._emptyView; | 55 delete this._emptyWidget; |
| 56 } | 56 } |
| 57 | 57 |
| 58 if (!this._previewView) | 58 if (!this._previewView) |
| 59 this._previewView = this._createPreviewView(); | 59 this._previewView = this._createPreviewView(); |
| 60 this._previewView.show(this.element); | 60 this._previewView.show(this.element); |
| 61 this.innerView = this._previewView; | 61 this.innerView = this._previewView; |
| 62 } | 62 } |
| 63 }, | 63 }, |
| 64 | 64 |
| 65 _createEmptyView: function() | 65 _createEmptyWidget: function() |
| 66 { | 66 { |
| 67 return this._createMessageView(WebInspector.UIString("This request has n
o preview available.")); | 67 return this._createMessageView(WebInspector.UIString("This request has n
o preview available.")); |
| 68 }, | 68 }, |
| 69 | 69 |
| 70 /** | 70 /** |
| 71 * @param {string} message | 71 * @param {string} message |
| 72 * @return {!WebInspector.EmptyView} | 72 * @return {!WebInspector.EmptyWidget} |
| 73 */ | 73 */ |
| 74 _createMessageView: function(message) | 74 _createMessageView: function(message) |
| 75 { | 75 { |
| 76 return new WebInspector.EmptyView(message); | 76 return new WebInspector.EmptyWidget(message); |
| 77 }, | 77 }, |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * @return {string} | 80 * @return {string} |
| 81 */ | 81 */ |
| 82 _requestContent: function() | 82 _requestContent: function() |
| 83 { | 83 { |
| 84 var content = this.request.content; | 84 var content = this.request.content; |
| 85 return this.request.contentEncoded ? window.atob(content || "") : (conte
nt || ""); | 85 return this.request.contentEncoded ? window.atob(content || "") : (conte
nt || ""); |
| 86 }, | 86 }, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 var htmlErrorPreview = this._htmlErrorPreview(); | 157 var htmlErrorPreview = this._htmlErrorPreview(); |
| 158 if (htmlErrorPreview) | 158 if (htmlErrorPreview) |
| 159 return htmlErrorPreview; | 159 return htmlErrorPreview; |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 if (this._responseView.sourceView) | 163 if (this._responseView.sourceView) |
| 164 return this._responseView.sourceView; | 164 return this._responseView.sourceView; |
| 165 | 165 |
| 166 if (this.request.resourceType() === WebInspector.resourceTypes.Other) | 166 if (this.request.resourceType() === WebInspector.resourceTypes.Other) |
| 167 return this._createEmptyView(); | 167 return this._createEmptyWidget(); |
| 168 | 168 |
| 169 return WebInspector.RequestView.nonSourceViewForRequest(this.request); | 169 return WebInspector.RequestView.nonSourceViewForRequest(this.request); |
| 170 }, | 170 }, |
| 171 | 171 |
| 172 __proto__: WebInspector.RequestContentView.prototype | 172 __proto__: WebInspector.RequestContentView.prototype |
| 173 } | 173 } |
| OLD | NEW |