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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/RequestPreviewView.js

Issue 2205853005: [Devtools] Regression fix for double toolbar for images in network (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [Devtools] Regression fix for double toolbar for images in network Created 4 years, 4 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) 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 20 matching lines...) Expand all
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.Widget} 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 /** @type {?WebInspector.Widget} */
42 this._previewView = null;
41 } 43 }
42 44
43 WebInspector.RequestPreviewView.prototype = { 45 WebInspector.RequestPreviewView.prototype = {
44 contentLoaded: function() 46 contentLoaded: function()
45 { 47 {
46 if (!this.request.content && !this.request.contentError()) { 48 if (!this.request.content && !this.request.contentError()) {
47 if (!this._emptyWidget) { 49 if (!this._emptyWidget) {
48 this._emptyWidget = this._createEmptyWidget(); 50 this._emptyWidget = this._createEmptyWidget();
49 this._emptyWidget.show(this.element); 51 this._emptyWidget.show(this.element);
50 this.innerView = this._emptyWidget; 52 this._previewView = this._emptyWidget;
lushnikov 2016/08/03 20:09:05 remove
allada 2016/08/03 23:50:05 This is here because it tries to get the content a
51 } 53 }
52 } else { 54 return;
53 if (this._emptyWidget) { 55 }
54 this._emptyWidget.detach(); 56 if (this._emptyWidget) {
55 delete this._emptyWidget; 57 this._emptyWidget.detach();
56 } 58 delete this._emptyWidget;
59 this._previewView = null;
lushnikov 2016/08/03 20:09:05 remove
allada 2016/08/03 23:50:04 needed because of above.
60 }
57 61
58 if (!this._previewView) { 62 if (!this._previewView)
59 this._createPreviewView(handlePreviewView.bind(this)); 63 this._createPreviewView(handlePreviewView.bind(this));
60 } else { 64 else
61 this.innerView = this._previewView; 65 this._previewView.show(this.element);
62 handlePreviewView.call(this, this.innerView);
63 }
64 }
65 66
66 /** 67 /**
67 * @param {!WebInspector.Widget} view 68 * @param {!WebInspector.Widget} view
68 * @this {WebInspector.RequestPreviewView} 69 * @this {WebInspector.RequestPreviewView}
69 */ 70 */
70 function handlePreviewView(view) 71 function handlePreviewView(view)
71 { 72 {
72 this._previewView = view; 73 this._previewView = view;
73 this._previewView.show(this.element); 74 view.show(this.element);
74 if (this._previewView instanceof WebInspector.View) { 75 if (view instanceof WebInspector.View) {
75 var toolbar = new WebInspector.Toolbar("network-item-preview-too lbar", this.element); 76 var toolbar = new WebInspector.Toolbar("network-item-preview-too lbar", this.element);
76 for (var item of /** @type {!WebInspector.View} */ (this._previe wView).toolbarItems()) 77 for (var item of /** @type {!WebInspector.View} */ (view).toolba rItems())
77 toolbar.appendToolbarItem(item); 78 toolbar.appendToolbarItem(item);
78 } 79 }
79 this.innerView = this._previewView; 80 this._previewViewHandledForTest(view);
80 this._previewViewHandledForTest(this._previewView);
81 } 81 }
82 }, 82 },
83 83
84 /** 84 /**
85 * @param {!WebInspector.Widget} view 85 * @param {!WebInspector.Widget} view
86 */ 86 */
87 _previewViewHandledForTest: function(view) { }, 87 _previewViewHandledForTest: function(view) { },
88 88
89 /** 89 /**
90 * @return {!WebInspector.EmptyWidget} 90 * @return {!WebInspector.EmptyWidget}
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 var dataURL = this.request.asDataURL(); 144 var dataURL = this.request.asDataURL();
145 if (dataURL === null) 145 if (dataURL === null)
146 return null; 146 return null;
147 147
148 return new WebInspector.RequestHTMLView(this.request, dataURL); 148 return new WebInspector.RequestHTMLView(this.request, dataURL);
149 }, 149 },
150 150
151 /** 151 /**
152 * @param {function(!WebInspector.Widget)} callback 152 * @param {function(!WebInspector.Widget)} callback
153 */ 153 */
154 _createPreviewView: function(callback) 154 _createPreviewView: function(callback)
lushnikov 2016/08/03 20:09:05 let's rename this into _getPreviewView: it doesn't
allada 2016/08/03 23:50:04 It is a wrapper for other create functions. This f
155 { 155 {
156 if (this.request.contentError()) { 156 if (this.request.contentError()) {
157 callback(this._createMessageView(WebInspector.UIString("Failed to lo ad response data"))); 157 callback(this._createMessageView(WebInspector.UIString("Failed to lo ad response data")));
158 return; 158 return;
159 } 159 }
160 160
161 var xmlView = this._xmlView(); 161 var xmlView = this._xmlView();
162 if (xmlView) { 162 if (xmlView) {
163 callback(xmlView); 163 callback(xmlView);
164 return; 164 return;
(...skipping 25 matching lines...) Expand all
190 190
191 if (this.request.resourceType() === WebInspector.resourceTypes.Other ) 191 if (this.request.resourceType() === WebInspector.resourceTypes.Other )
192 return this._createEmptyWidget(); 192 return this._createEmptyWidget();
193 193
194 return WebInspector.RequestView.nonSourceViewForRequest(this.request ); 194 return WebInspector.RequestView.nonSourceViewForRequest(this.request );
195 } 195 }
196 }, 196 },
197 197
198 __proto__: WebInspector.RequestContentView.prototype 198 __proto__: WebInspector.RequestContentView.prototype
199 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698