Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / inspector / NetworkResourcesData.cpp
index 529a936..cd759f7 100644 (file)
@@ -31,7 +31,6 @@
 
 #include "core/dom/DOMImplementation.h"
 #include "core/fetch/Resource.h"
-#include "platform/MIMETypeRegistry.h"
 #include "platform/SharedBuffer.h"
 #include "platform/network/ResourceResponse.h"
 
@@ -156,24 +155,6 @@ void NetworkResourcesData::resourceCreated(const String& requestId, const String
     m_requestIdToResourceDataMap.set(requestId, new ResourceData(requestId, loaderId));
 }
 
-static PassOwnPtr<TextResourceDecoder> createOtherResourceTextDecoder(const String& mimeType, const String& textEncodingName)
-{
-    OwnPtr<TextResourceDecoder> decoder;
-    if (!textEncodingName.isEmpty()) {
-        decoder = TextResourceDecoder::create("text/plain", textEncodingName);
-    } else if (DOMImplementation::isXMLMIMEType(mimeType)) {
-        decoder = TextResourceDecoder::create("application/xml");
-        decoder->useLenientXMLDecoding();
-    } else if (equalIgnoringCase(mimeType, "text/html")) {
-        decoder = TextResourceDecoder::create("text/html", "UTF-8");
-    } else if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) || DOMImplementation::isJSONMIMEType(mimeType)) {
-        decoder = TextResourceDecoder::create("text/plain", "UTF-8");
-    } else if (DOMImplementation::isTextMIMEType(mimeType)) {
-        decoder = TextResourceDecoder::create("text/plain", "ISO-8859-1");
-    }
-    return decoder.release();
-}
-
 void NetworkResourcesData::responseReceived(const String& requestId, const String& frameId, const ResourceResponse& response)
 {
     ResourceData* resourceData = resourceDataForRequestId(requestId);
@@ -181,7 +162,7 @@ void NetworkResourcesData::responseReceived(const String& requestId, const Strin
         return;
     resourceData->setFrameId(frameId);
     resourceData->setUrl(response.url());
-    resourceData->setDecoder(createOtherResourceTextDecoder(response.mimeType(), response.textEncodingName()));
+    resourceData->setDecoder(InspectorPageAgent::createResourceTextDecoder(response.mimeType(), response.textEncodingName()));
     resourceData->setHTTPStatusCode(response.httpStatusCode());
 }