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

Unified Diff: Source/core/html/HTMLImportsController.cpp

Issue 22573005: [HTML Imports] Implement "load" and "error" events. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: For landing Created 7 years, 4 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/core/html/HTMLImportsController.h ('k') | Source/core/html/HTMLLinkElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLImportsController.cpp
diff --git a/Source/core/html/HTMLImportsController.cpp b/Source/core/html/HTMLImportsController.cpp
index 0bdf7ce84eec686edcca0fc70260d75e120508c4..ffb2c91475020815addd03d2fde07a152bc05f7d 100644
--- a/Source/core/html/HTMLImportsController.cpp
+++ b/Source/core/html/HTMLImportsController.cpp
@@ -33,6 +33,8 @@
#include "core/dom/Document.h"
#include "core/html/HTMLImportLoader.h"
+#include "core/html/HTMLImportLoaderClient.h"
+#include "core/loader/cache/ResourceFetcher.h"
namespace WebCore {
@@ -64,10 +66,19 @@ void HTMLImportsController::clear()
m_master = 0;
}
-PassRefPtr<HTMLImportLoader> HTMLImportsController::createLoader(HTMLImport* parent, const KURL& url, const ResourcePtr<CachedRawResource>& resource)
+PassRefPtr<HTMLImportLoader> HTMLImportsController::createLoader(HTMLImport* parent, FetchRequest request)
{
- ASSERT(!url.isEmpty() && url.isValid());
- RefPtr<HTMLImportLoader> loader = adoptRef(new HTMLImportLoader(parent, url, resource));
+ ASSERT(!request.url().isEmpty() && request.url().isValid());
+
+ if (RefPtr<HTMLImportLoader> found = findLinkFor(request.url()))
+ return found.release();
+
+ request.setPotentiallyCrossOriginEnabled(securityOrigin(), DoNotAllowStoredCredentials);
+ ResourcePtr<CachedRawResource> resource = parent->document()->fetcher()->requestImport(request);
+ if (!resource)
+ return 0;
+
+ RefPtr<HTMLImportLoader> loader = adoptRef(new HTMLImportLoader(parent, request.url(), resource));
parent->appendChild(loader.get());
m_imports.append(loader);
return loader.release();
« no previous file with comments | « Source/core/html/HTMLImportsController.h ('k') | Source/core/html/HTMLLinkElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698