OLD | NEW |
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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "config.h" | 26 #include "config.h" |
27 | 27 |
28 #include "core/loader/TextTrackLoader.h" | 28 #include "core/loader/TextTrackLoader.h" |
29 | 29 |
30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
31 #include "core/html/track/WebVTTParser.h" | 31 #include "core/html/track/WebVTTParser.h" |
32 #include "core/inspector/ScriptCallStack.h" | 32 #include "core/inspector/ScriptCallStack.h" |
33 #include "core/loader/CrossOriginAccessControl.h" | 33 #include "core/loader/CrossOriginAccessControl.h" |
34 #include "core/loader/cache/CachedResourceLoader.h" | 34 #include "core/loader/cache/CachedResourceLoader.h" |
35 #include "core/loader/cache/CachedResourceRequest.h" | 35 #include "core/loader/cache/CachedResourceRequest.h" |
| 36 #include "core/loader/cache/CachedResourceRequestInitiators.h" |
36 #include "core/loader/cache/CachedTextTrack.h" | 37 #include "core/loader/cache/CachedTextTrack.h" |
37 #include "core/platform/Logging.h" | 38 #include "core/platform/Logging.h" |
38 #include "core/platform/SharedBuffer.h" | 39 #include "core/platform/SharedBuffer.h" |
39 #include "core/platform/network/ResourceHandle.h" | 40 #include "core/platform/network/ResourceHandle.h" |
40 #include "weborigin/SecurityOrigin.h" | 41 #include "weborigin/SecurityOrigin.h" |
41 | 42 |
42 namespace WebCore { | 43 namespace WebCore { |
43 | 44 |
44 TextTrackLoader::TextTrackLoader(TextTrackLoaderClient* client, ScriptExecutionC
ontext* context) | 45 TextTrackLoader::TextTrackLoader(TextTrackLoaderClient* client, ScriptExecutionC
ontext* context) |
45 : m_client(client) | 46 : m_client(client) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 147 |
147 bool TextTrackLoader::load(const KURL& url, const String& crossOriginMode) | 148 bool TextTrackLoader::load(const KURL& url, const String& crossOriginMode) |
148 { | 149 { |
149 cancelLoad(); | 150 cancelLoad(); |
150 | 151 |
151 if (!m_client->shouldLoadCues(this)) | 152 if (!m_client->shouldLoadCues(this)) |
152 return false; | 153 return false; |
153 | 154 |
154 ASSERT(m_scriptExecutionContext->isDocument()); | 155 ASSERT(m_scriptExecutionContext->isDocument()); |
155 Document* document = toDocument(m_scriptExecutionContext); | 156 Document* document = toDocument(m_scriptExecutionContext); |
156 CachedResourceRequest cueRequest(ResourceRequest(document->completeURL(url))
); | 157 CachedResourceRequest cueRequest(ResourceRequest(document->completeURL(url))
, cachedResourceRequestInitiators().texttrack); |
157 | 158 |
158 if (!crossOriginMode.isNull()) { | 159 if (!crossOriginMode.isNull()) { |
159 m_crossOriginMode = crossOriginMode; | 160 m_crossOriginMode = crossOriginMode; |
160 StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode,
"use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; | 161 StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode,
"use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; |
161 updateRequestForAccessControl(cueRequest.mutableResourceRequest(), docum
ent->securityOrigin(), allowCredentials); | 162 updateRequestForAccessControl(cueRequest.mutableResourceRequest(), docum
ent->securityOrigin(), allowCredentials); |
162 } else { | 163 } else { |
163 // Cross-origin resources that are not suitably CORS-enabled may not loa
d. | 164 // Cross-origin resources that are not suitably CORS-enabled may not loa
d. |
164 if (!document->securityOrigin()->canRequest(url)) { | 165 if (!document->securityOrigin()->canRequest(url)) { |
165 corsPolicyPreventedLoad(); | 166 corsPolicyPreventedLoad(); |
166 return false; | 167 return false; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 #if ENABLE(WEBVTT_REGIONS) | 216 #if ENABLE(WEBVTT_REGIONS) |
216 void TextTrackLoader::getNewRegions(Vector<RefPtr<TextTrackRegion> >& outputRegi
ons) | 217 void TextTrackLoader::getNewRegions(Vector<RefPtr<TextTrackRegion> >& outputRegi
ons) |
217 { | 218 { |
218 ASSERT(m_cueParser); | 219 ASSERT(m_cueParser); |
219 if (m_cueParser) | 220 if (m_cueParser) |
220 m_cueParser->getNewRegions(outputRegions); | 221 m_cueParser->getNewRegions(outputRegions); |
221 } | 222 } |
222 #endif | 223 #endif |
223 } | 224 } |
224 | 225 |
OLD | NEW |