Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 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._emptyWidget) { | 47 if (!this._emptyWidget) { |
| 48 this._emptyWidget = this._createEmptyWidget(); | 48 this._emptyWidget = this._createEmptyWidget(); |
| 49 this._emptyWidget.show(this.element); | 49 this._emptyWidget.show(this.element); |
| 50 this.innerView = this._emptyWidget; | 50 this.innerView = this._emptyWidget; |
| 51 } | 51 } |
|
lushnikov
2016/08/03 18:42:15
let's do a fast return here to reduce code nesting
allada
2016/08/03 19:02:26
Done.
| |
| 52 } else { | 52 } else { |
| 53 if (this._emptyWidget) { | 53 if (this._emptyWidget) { |
| 54 this._emptyWidget.detach(); | 54 this._emptyWidget.detach(); |
|
lushnikov
2016/08/03 18:42:14
this.innerView = null;
allada
2016/08/03 19:02:26
Done.
| |
| 55 delete this._emptyWidget; | 55 delete this._emptyWidget; |
| 56 } | 56 } |
| 57 | 57 |
| 58 if (!this._previewView) { | 58 if (!this.innerView) |
|
lushnikov
2016/08/03 18:42:14
let's get rid of this.innerView!
allada
2016/08/03 19:02:26
Done.
| |
| 59 this._createPreviewView(handlePreviewView.bind(this)); | 59 this._createPreviewView(handlePreviewView.bind(this)); |
| 60 } else { | 60 else |
| 61 this.innerView = this._previewView; | 61 this.innerView.show(this.element); |
| 62 handlePreviewView.call(this, this.innerView); | |
| 63 } | |
| 64 } | 62 } |
| 65 | 63 |
| 66 /** | 64 /** |
| 67 * @param {!WebInspector.Widget} view | 65 * @param {!WebInspector.Widget} view |
| 68 * @this {WebInspector.RequestPreviewView} | 66 * @this {WebInspector.RequestPreviewView} |
| 69 */ | 67 */ |
| 70 function handlePreviewView(view) | 68 function handlePreviewView(view) |
| 71 { | 69 { |
| 72 this._previewView = view; | 70 this.innerView = view; |
| 73 this._previewView.show(this.element); | 71 this.innerView.show(this.element); |
| 74 if (this._previewView instanceof WebInspector.View) { | 72 if (this.innerView instanceof WebInspector.View) { |
| 75 var toolbar = new WebInspector.Toolbar("network-item-preview-too lbar", this.element); | 73 var toolbar = new WebInspector.Toolbar("network-item-preview-too lbar", this.element); |
| 76 for (var item of /** @type {!WebInspector.View} */ (this._previe wView).toolbarItems()) | 74 for (var item of /** @type {!WebInspector.View} */ (this.innerVi ew).toolbarItems()) |
| 77 toolbar.appendToolbarItem(item); | 75 toolbar.appendToolbarItem(item); |
| 78 } | 76 } |
| 79 this.innerView = this._previewView; | 77 this._previewViewHandledForTest(this.innerView); |
| 80 this._previewViewHandledForTest(this._previewView); | |
| 81 } | 78 } |
| 82 }, | 79 }, |
| 83 | 80 |
| 84 /** | 81 /** |
| 85 * @param {!WebInspector.Widget} view | 82 * @param {!WebInspector.Widget} view |
| 86 */ | 83 */ |
| 87 _previewViewHandledForTest: function(view) { }, | 84 _previewViewHandledForTest: function(view) { }, |
| 88 | 85 |
| 89 /** | 86 /** |
| 90 * @return {!WebInspector.EmptyWidget} | 87 * @return {!WebInspector.EmptyWidget} |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 | 187 |
| 191 if (this.request.resourceType() === WebInspector.resourceTypes.Other ) | 188 if (this.request.resourceType() === WebInspector.resourceTypes.Other ) |
| 192 return this._createEmptyWidget(); | 189 return this._createEmptyWidget(); |
| 193 | 190 |
| 194 return WebInspector.RequestView.nonSourceViewForRequest(this.request ); | 191 return WebInspector.RequestView.nonSourceViewForRequest(this.request ); |
| 195 } | 192 } |
| 196 }, | 193 }, |
| 197 | 194 |
| 198 __proto__: WebInspector.RequestContentView.prototype | 195 __proto__: WebInspector.RequestContentView.prototype |
| 199 } | 196 } |
| OLD | NEW |