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

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

Issue 94893003: Support for json media types as (non-image) mime types. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 void NetworkResourcesData::resourceCreated(const String& requestId, const String & loaderId) 151 void NetworkResourcesData::resourceCreated(const String& requestId, const String & loaderId)
152 { 152 {
153 ensureNoDataForRequestId(requestId); 153 ensureNoDataForRequestId(requestId);
154 m_requestIdToResourceDataMap.set(requestId, new ResourceData(requestId, load erId)); 154 m_requestIdToResourceDataMap.set(requestId, new ResourceData(requestId, load erId));
155 } 155 }
156 156
157 static PassOwnPtr<TextResourceDecoder> createOtherResourceTextDecoder(const Stri ng& mimeType, const String& textEncodingName) 157 static PassOwnPtr<TextResourceDecoder> createOtherResourceTextDecoder(const Stri ng& mimeType, const String& textEncodingName)
158 { 158 {
159 OwnPtr<TextResourceDecoder> decoder; 159 OwnPtr<TextResourceDecoder> decoder;
160 if (!textEncodingName.isEmpty()) 160 if (!textEncodingName.isEmpty()) {
161 decoder = TextResourceDecoder::create("text/plain", textEncodingName); 161 decoder = TextResourceDecoder::create("text/plain", textEncodingName);
162 else if (DOMImplementation::isXMLMIMEType(mimeType.lower())) { 162 } else {
163 decoder = TextResourceDecoder::create("application/xml"); 163 String mimeTypeLower = mimeType.lower();
164 decoder->useLenientXMLDecoding(); 164 if (DOMImplementation::isXMLMIMEType(mimeTypeLower)) {
165 } else if (equalIgnoringCase(mimeType, "text/html")) 165 decoder = TextResourceDecoder::create("application/xml");
166 decoder = TextResourceDecoder::create("text/html", "UTF-8"); 166 decoder->useLenientXMLDecoding();
167 else if (mimeType == "text/plain") 167 } else if (equalIgnoringCase(mimeType, "text/html")) {
168 decoder = TextResourceDecoder::create("text/plain", "ISO-8859-1"); 168 decoder = TextResourceDecoder::create("text/html", "UTF-8");
169 } else if (DOMImplementation::isTextMIMEType(mimeTypeLower)) {
170 decoder = TextResourceDecoder::create("text/plain", DOMImplementatio n::getTextDefaultEncodingName(mimeTypeLower));
171 }
172 }
169 return decoder.release(); 173 return decoder.release();
170 } 174 }
171 175
172 void NetworkResourcesData::responseReceived(const String& requestId, const Strin g& frameId, const ResourceResponse& response) 176 void NetworkResourcesData::responseReceived(const String& requestId, const Strin g& frameId, const ResourceResponse& response)
173 { 177 {
174 ResourceData* resourceData = resourceDataForRequestId(requestId); 178 ResourceData* resourceData = resourceDataForRequestId(requestId);
175 if (!resourceData) 179 if (!resourceData)
176 return; 180 return;
177 resourceData->setFrameId(frameId); 181 resourceData->setFrameId(frameId);
178 resourceData->setUrl(response.url()); 182 resourceData->setUrl(response.url());
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 String requestId = m_requestIdsDeque.takeFirst(); 392 String requestId = m_requestIdsDeque.takeFirst();
389 ResourceData* resourceData = resourceDataForRequestId(requestId); 393 ResourceData* resourceData = resourceDataForRequestId(requestId);
390 if (resourceData) 394 if (resourceData)
391 m_contentSize -= resourceData->evictContent(); 395 m_contentSize -= resourceData->evictContent();
392 } 396 }
393 return true; 397 return true;
394 } 398 }
395 399
396 } // namespace WebCore 400 } // namespace WebCore
397 401
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698