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

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

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month 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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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 * @unrestricted 32 * @unrestricted
33 */ 33 */
34 WebInspector.RequestResponseView = class extends WebInspector.RequestContentView { 34 Network.RequestResponseView = class extends Network.RequestContentView {
35 /** 35 /**
36 * @param {!WebInspector.NetworkRequest} request 36 * @param {!SDK.NetworkRequest} request
37 */ 37 */
38 constructor(request) { 38 constructor(request) {
39 super(request); 39 super(request);
40 } 40 }
41 41
42 get sourceView() { 42 get sourceView() {
43 if (this._sourceView || !WebInspector.RequestView.hasTextContent(this.reques t)) 43 if (this._sourceView || !Network.RequestView.hasTextContent(this.request))
44 return this._sourceView; 44 return this._sourceView;
45 45
46 var contentProvider = new WebInspector.RequestResponseView.ContentProvider(t his.request); 46 var contentProvider = new Network.RequestResponseView.ContentProvider(this.r equest);
47 var highlighterType = this.request.resourceType().canonicalMimeType() || thi s.request.mimeType; 47 var highlighterType = this.request.resourceType().canonicalMimeType() || thi s.request.mimeType;
48 this._sourceView = WebInspector.ResourceSourceFrame.createSearchableView(con tentProvider, highlighterType); 48 this._sourceView = SourceFrame.ResourceSourceFrame.createSearchableView(cont entProvider, highlighterType);
49 return this._sourceView; 49 return this._sourceView;
50 } 50 }
51 51
52 /** 52 /**
53 * @param {string} message 53 * @param {string} message
54 * @return {!WebInspector.EmptyWidget} 54 * @return {!UI.EmptyWidget}
55 */ 55 */
56 _createMessageView(message) { 56 _createMessageView(message) {
57 return new WebInspector.EmptyWidget(message); 57 return new UI.EmptyWidget(message);
58 } 58 }
59 59
60 /** 60 /**
61 * @override 61 * @override
62 */ 62 */
63 contentLoaded() { 63 contentLoaded() {
64 if ((!this.request.content || !this.sourceView) && !this.request.contentErro r()) { 64 if ((!this.request.content || !this.sourceView) && !this.request.contentErro r()) {
65 if (!this._emptyWidget) { 65 if (!this._emptyWidget) {
66 this._emptyWidget = 66 this._emptyWidget =
67 this._createMessageView(WebInspector.UIString('This request has no r esponse data available.')); 67 this._createMessageView(Common.UIString('This request has no respons e data available.'));
68 this._emptyWidget.show(this.element); 68 this._emptyWidget.show(this.element);
69 } 69 }
70 } else { 70 } else {
71 if (this._emptyWidget) { 71 if (this._emptyWidget) {
72 this._emptyWidget.detach(); 72 this._emptyWidget.detach();
73 delete this._emptyWidget; 73 delete this._emptyWidget;
74 } 74 }
75 75
76 if (this.request.content && this.sourceView) { 76 if (this.request.content && this.sourceView) {
77 this.sourceView.show(this.element); 77 this.sourceView.show(this.element);
78 } else { 78 } else {
79 if (!this._errorView) 79 if (!this._errorView)
80 this._errorView = this._createMessageView(WebInspector.UIString('Faile d to load response data')); 80 this._errorView = this._createMessageView(Common.UIString('Failed to l oad response data'));
81 this._errorView.show(this.element); 81 this._errorView.show(this.element);
82 } 82 }
83 } 83 }
84 } 84 }
85 }; 85 };
86 86
87 /** 87 /**
88 * @implements {WebInspector.ContentProvider} 88 * @implements {Common.ContentProvider}
89 * @unrestricted 89 * @unrestricted
90 */ 90 */
91 WebInspector.RequestResponseView.ContentProvider = class { 91 Network.RequestResponseView.ContentProvider = class {
92 /** 92 /**
93 * @param {!WebInspector.NetworkRequest} request 93 * @param {!SDK.NetworkRequest} request
94 */ 94 */
95 constructor(request) { 95 constructor(request) {
96 this._request = request; 96 this._request = request;
97 } 97 }
98 98
99 /** 99 /**
100 * @override 100 * @override
101 * @return {string} 101 * @return {string}
102 */ 102 */
103 contentURL() { 103 contentURL() {
104 return this._request.contentURL(); 104 return this._request.contentURL();
105 } 105 }
106 106
107 /** 107 /**
108 * @override 108 * @override
109 * @return {!WebInspector.ResourceType} 109 * @return {!Common.ResourceType}
110 */ 110 */
111 contentType() { 111 contentType() {
112 return this._request.resourceType(); 112 return this._request.resourceType();
113 } 113 }
114 114
115 /** 115 /**
116 * @override 116 * @override
117 * @return {!Promise<?string>} 117 * @return {!Promise<?string>}
118 */ 118 */
119 requestContent() { 119 requestContent() {
120 /** 120 /**
121 * @param {?string} content 121 * @param {?string} content
122 * @this {WebInspector.RequestResponseView.ContentProvider} 122 * @this {Network.RequestResponseView.ContentProvider}
123 */ 123 */
124 function decodeContent(content) { 124 function decodeContent(content) {
125 return this._request.contentEncoded ? window.atob(content || '') : content ; 125 return this._request.contentEncoded ? window.atob(content || '') : content ;
126 } 126 }
127 127
128 return this._request.requestContent().then(decodeContent.bind(this)); 128 return this._request.requestContent().then(decodeContent.bind(this));
129 } 129 }
130 130
131 /** 131 /**
132 * @override 132 * @override
133 * @param {string} query 133 * @param {string} query
134 * @param {boolean} caseSensitive 134 * @param {boolean} caseSensitive
135 * @param {boolean} isRegex 135 * @param {boolean} isRegex
136 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} callb ack 136 * @param {function(!Array.<!Common.ContentProvider.SearchMatch>)} callback
137 */ 137 */
138 searchInContent(query, caseSensitive, isRegex, callback) { 138 searchInContent(query, caseSensitive, isRegex, callback) {
139 this._request.searchInContent(query, caseSensitive, isRegex, callback); 139 this._request.searchInContent(query, caseSensitive, isRegex, callback);
140 } 140 }
141 }; 141 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698