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

Unified Diff: Source/WebCore/loader/DocumentLoader.cpp

Issue 14188008: Move Data uri handling into WebCore Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/loader/DocumentLoader.h ('k') | Source/WebCore/loader/ResourceLoader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/loader/DocumentLoader.cpp
diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp
index 44e265c0529d9a3ea241c9bccb2e0ae22f91f5d7..b11064d9272bd67fbd042c4d9207eebdc327390b 100644
--- a/Source/WebCore/loader/DocumentLoader.cpp
+++ b/Source/WebCore/loader/DocumentLoader.cpp
@@ -35,6 +35,7 @@
#include "CachedPage.h"
#include "CachedResourceLoader.h"
#include "DOMWindow.h"
+#include "DataUriResource.h"
#include "Document.h"
#include "DocumentParser.h"
#include "DocumentWriter.h"
@@ -60,6 +61,7 @@
#include "SubresourceLoader.h"
#include "TextResourceDecoder.h"
#include "WebCoreMemoryInstrumentation.h"
+#include <public/Platform.h>
#include <wtf/Assertions.h>
#include <wtf/MemoryInstrumentationHashMap.h>
#include <wtf/MemoryInstrumentationHashSet.h>
@@ -979,6 +981,21 @@ bool DocumentLoader::scheduleArchiveLoad(ResourceLoader* loader, const ResourceR
return m_archive;
}
+bool DocumentLoader::scheduleDataUriLoad(ResourceLoader* loader, const ResourceRequest& request)
+{
+ if (request.url().protocolIsData()) {
+ String mimetype, charset;
+ Vector<char> data;
+ if (ResourceHandle::parseDataUrl(request.url(), mimetype, charset, data) && !data.isEmpty()) {
+ RefPtr<DataUriResource> resource = DataUriResource::create(SharedBuffer::adoptVector(data), request.url(), mimetype, charset, ResourceResponse(request.url(), mimetype, data.size(), charset, String()));
+ m_pendingSubstituteResources.set(loader, resource);
+ deliverSubstituteResourcesAfterDelay();
+ return true;
+ }
+ }
+ return false;
+}
+
void DocumentLoader::setTitle(const StringWithDirection& title)
{
if (m_pageTitle == title)
« no previous file with comments | « Source/WebCore/loader/DocumentLoader.h ('k') | Source/WebCore/loader/ResourceLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698