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

Side by Side Diff: Source/core/inspector/InspectorResourceAgent.cpp

Issue 300913002: DevTools: show HTTP headers of cached resources in network panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed test Created 6 years, 6 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 double status; 238 double status;
239 String statusText; 239 String statusText;
240 if (response.resourceLoadInfo() && response.resourceLoadInfo()->httpStatusCo de) { 240 if (response.resourceLoadInfo() && response.resourceLoadInfo()->httpStatusCo de) {
241 status = response.resourceLoadInfo()->httpStatusCode; 241 status = response.resourceLoadInfo()->httpStatusCode;
242 statusText = response.resourceLoadInfo()->httpStatusText; 242 statusText = response.resourceLoadInfo()->httpStatusText;
243 } else { 243 } else {
244 status = response.httpStatusCode(); 244 status = response.httpStatusCode();
245 statusText = response.httpStatusText(); 245 statusText = response.httpStatusText();
246 } 246 }
247 RefPtr<JSONObject> headers; 247 RefPtr<JSONObject> headers;
248 if (response.resourceLoadInfo()) 248 if (response.resourceLoadInfo() && response.resourceLoadInfo()->responseHead ers.size())
249 headers = buildObjectForHeaders(response.resourceLoadInfo()->responseHea ders); 249 headers = buildObjectForHeaders(response.resourceLoadInfo()->responseHea ders);
250 else 250 else
251 headers = buildObjectForHeaders(response.httpHeaderFields()); 251 headers = buildObjectForHeaders(response.httpHeaderFields());
252 252
253 int64_t encodedDataLength = response.resourceLoadInfo() ? response.resourceL oadInfo()->encodedDataLength : -1; 253 int64_t encodedDataLength = response.resourceLoadInfo() ? response.resourceL oadInfo()->encodedDataLength : -1;
254 254
255 RefPtr<TypeBuilder::Network::Response> responseObject = TypeBuilder::Network ::Response::create() 255 RefPtr<TypeBuilder::Network::Response> responseObject = TypeBuilder::Network ::Response::create()
256 .setUrl(urlWithoutFragment(response.url()).string()) 256 .setUrl(urlWithoutFragment(response.url()).string())
257 .setStatus(status) 257 .setStatus(status)
258 .setStatusText(statusText) 258 .setStatusText(statusText)
259 .setHeaders(headers) 259 .setHeaders(headers)
260 .setMimeType(response.mimeType()) 260 .setMimeType(response.mimeType())
261 .setConnectionReused(response.connectionReused()) 261 .setConnectionReused(response.connectionReused())
262 .setConnectionId(response.connectionID()) 262 .setConnectionId(response.connectionID())
263 .setEncodedDataLength(encodedDataLength); 263 .setEncodedDataLength(encodedDataLength);
264 264
265 responseObject->setFromDiskCache(response.wasCached()); 265 responseObject->setFromDiskCache(response.wasCached());
266 if (response.resourceLoadTiming()) 266 if (response.resourceLoadTiming())
267 responseObject->setTiming(buildObjectForTiming(*response.resourceLoadTim ing(), loader)); 267 responseObject->setTiming(buildObjectForTiming(*response.resourceLoadTim ing(), loader));
268 268
269 if (response.resourceLoadInfo()) { 269 if (response.resourceLoadInfo()) {
270 if (!response.resourceLoadInfo()->responseHeadersText.isEmpty()) 270 if (!response.resourceLoadInfo()->responseHeadersText.isEmpty())
271 responseObject->setHeadersText(response.resourceLoadInfo()->response HeadersText); 271 responseObject->setHeadersText(response.resourceLoadInfo()->response HeadersText);
272 272 if (response.resourceLoadInfo()->requestHeaders.size())
273 responseObject->setRequestHeaders(buildObjectForHeaders(response.resourc eLoadInfo()->requestHeaders)); 273 responseObject->setRequestHeaders(buildObjectForHeaders(response.res ourceLoadInfo()->requestHeaders));
274 if (!response.resourceLoadInfo()->requestHeadersText.isEmpty()) 274 if (!response.resourceLoadInfo()->requestHeadersText.isEmpty())
275 responseObject->setRequestHeadersText(response.resourceLoadInfo()->r equestHeadersText); 275 responseObject->setRequestHeadersText(response.resourceLoadInfo()->r equestHeadersText);
276 } 276 }
277 277
278 AtomicString remoteIPAddress = response.remoteIPAddress(); 278 AtomicString remoteIPAddress = response.remoteIPAddress();
279 if (!remoteIPAddress.isEmpty()) { 279 if (!remoteIPAddress.isEmpty()) {
280 responseObject->setRemoteIPAddress(remoteIPAddress); 280 responseObject->setRemoteIPAddress(remoteIPAddress);
281 responseObject->setRemotePort(response.remotePort()); 281 responseObject->setRemotePort(response.remotePort());
282 } 282 }
283 283
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 InspectorResourceAgent::InspectorResourceAgent(InspectorPageAgent* pageAgent) 821 InspectorResourceAgent::InspectorResourceAgent(InspectorPageAgent* pageAgent)
822 : InspectorBaseAgent<InspectorResourceAgent>("Network") 822 : InspectorBaseAgent<InspectorResourceAgent>("Network")
823 , m_pageAgent(pageAgent) 823 , m_pageAgent(pageAgent)
824 , m_frontend(0) 824 , m_frontend(0)
825 , m_resourcesData(adoptPtr(new NetworkResourcesData())) 825 , m_resourcesData(adoptPtr(new NetworkResourcesData()))
826 , m_isRecalculatingStyle(false) 826 , m_isRecalculatingStyle(false)
827 { 827 {
828 } 828 }
829 829
830 } // namespace WebCore 830 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698