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

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

Issue 1899893003: [Devtools] JSONView implements Searchable interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 */ 67 */
68 function handlePreviewView(view) { 68 function handlePreviewView(view) {
69 this._previewView = view; 69 this._previewView = view;
70 this._previewView.show(this.element); 70 this._previewView.show(this.element);
71 if (this._previewView instanceof WebInspector.VBoxWithToolbarItems) { 71 if (this._previewView instanceof WebInspector.VBoxWithToolbarItems) {
72 var toolbar = new WebInspector.Toolbar("network-item-preview-too lbar", this.element); 72 var toolbar = new WebInspector.Toolbar("network-item-preview-too lbar", this.element);
73 for (var item of /** @type {!WebInspector.VBoxWithToolbarItems} */ (this._previewView).toolbarItems()) 73 for (var item of /** @type {!WebInspector.VBoxWithToolbarItems} */ (this._previewView).toolbarItems())
74 toolbar.appendToolbarItem(item); 74 toolbar.appendToolbarItem(item);
75 } 75 }
76 this.innerView = this._previewView; 76 this.innerView = this._previewView;
77 this._previewViewHandledForTest(this._previewView);
77 } 78 }
78 }, 79 },
79 80
81 /**
82 * @param {!WebInspector.Widget} view
83 */
84 _previewViewHandledForTest: function(view) { },
85
86 /**
87 * @return {!WebInspector.EmptyWidget}
88 */
80 _createEmptyWidget: function() 89 _createEmptyWidget: function()
81 { 90 {
82 return this._createMessageView(WebInspector.UIString("This request has n o preview available.")); 91 return this._createMessageView(WebInspector.UIString("This request has n o preview available."));
83 }, 92 },
84 93
85 /** 94 /**
86 * @param {string} message 95 * @param {string} message
87 * @return {!WebInspector.EmptyWidget} 96 * @return {!WebInspector.EmptyWidget}
88 */ 97 */
89 _createMessageView: function(message) 98 _createMessageView: function(message)
90 { 99 {
91 return new WebInspector.EmptyWidget(message); 100 return new WebInspector.EmptyWidget(message);
92 }, 101 },
93 102
94 /** 103 /**
95 * @return {string} 104 * @return {string}
96 */ 105 */
97 _requestContent: function() 106 _requestContent: function()
98 { 107 {
99 var content = this.request.content; 108 var content = this.request.content;
100 return this.request.contentEncoded ? window.atob(content || "") : (conte nt || ""); 109 return this.request.contentEncoded ? window.atob(content || "") : (conte nt || "");
101 }, 110 },
102 111
103 /** 112 /**
104 * @param {?WebInspector.ParsedJSON} parsedJSON 113 * @param {?WebInspector.ParsedJSON} parsedJSON
105 * @return {?WebInspector.JSONView} 114 * @return {?WebInspector.SearchableView}
106 */ 115 */
107 _jsonView: function(parsedJSON) 116 _jsonView: function(parsedJSON)
108 { 117 {
109 if (!parsedJSON || typeof parsedJSON.data !== "object") 118 if (!parsedJSON || typeof parsedJSON.data !== "object")
110 return null; 119 return null;
111 return new WebInspector.JSONView(/** @type {!WebInspector.ParsedJSON} */ (parsedJSON)); 120 return WebInspector.JSONView.createSearchableView(/** @type {!WebInspect or.ParsedJSON} */ (parsedJSON));
112 }, 121 },
113 122
114 /** 123 /**
115 * @return {?WebInspector.XMLView} 124 * @return {?WebInspector.XMLView}
116 */ 125 */
117 _xmlView: function() 126 _xmlView: function()
118 { 127 {
119 var content = this._requestContent(); 128 var content = this._requestContent();
120 var parsedXML = WebInspector.XMLView.parseXML(content, this.request.mime Type); 129 var parsedXML = WebInspector.XMLView.parseXML(content, this.request.mime Type);
121 return parsedXML ? new WebInspector.XMLView(parsedXML) : null; 130 return parsedXML ? new WebInspector.XMLView(parsedXML) : null;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 188
180 if (this.request.resourceType() === WebInspector.resourceTypes.Other ) 189 if (this.request.resourceType() === WebInspector.resourceTypes.Other )
181 return this._createEmptyWidget(); 190 return this._createEmptyWidget();
182 191
183 return WebInspector.RequestView.nonSourceViewForRequest(this.request ); 192 return WebInspector.RequestView.nonSourceViewForRequest(this.request );
184 } 193 }
185 }, 194 },
186 195
187 __proto__: WebInspector.RequestContentView.prototype 196 __proto__: WebInspector.RequestContentView.prototype
188 } 197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698