| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 if (!m_cueLoadTimer.isActive()) | 112 if (!m_cueLoadTimer.isActive()) |
| 113 m_cueLoadTimer.startOneShot(0); | 113 m_cueLoadTimer.startOneShot(0); |
| 114 | 114 |
| 115 cancelLoad(); | 115 cancelLoad(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool TextTrackLoader::load(const KURL& url, const String& crossOriginMode) | 118 bool TextTrackLoader::load(const KURL& url, const String& crossOriginMode) |
| 119 { | 119 { |
| 120 cancelLoad(); | 120 cancelLoad(); |
| 121 | 121 |
| 122 if (!m_client.shouldLoadCues(this)) | |
| 123 return false; | |
| 124 | |
| 125 FetchRequest cueRequest(ResourceRequest(m_document.completeURL(url)), FetchI
nitiatorTypeNames::texttrack); | 122 FetchRequest cueRequest(ResourceRequest(m_document.completeURL(url)), FetchI
nitiatorTypeNames::texttrack); |
| 126 | 123 |
| 127 if (!crossOriginMode.isNull()) { | 124 if (!crossOriginMode.isNull()) { |
| 128 m_crossOriginMode = crossOriginMode; | 125 m_crossOriginMode = crossOriginMode; |
| 129 StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode,
"use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; | 126 StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode,
"use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials; |
| 130 updateRequestForAccessControl(cueRequest.mutableResourceRequest(), m_doc
ument.securityOrigin(), allowCredentials); | 127 updateRequestForAccessControl(cueRequest.mutableResourceRequest(), m_doc
ument.securityOrigin(), allowCredentials); |
| 131 } else { | 128 } else { |
| 132 // Cross-origin resources that are not suitably CORS-enabled may not loa
d. | 129 // Cross-origin resources that are not suitably CORS-enabled may not loa
d. |
| 133 if (!m_document.securityOrigin()->canRequest(url)) { | 130 if (!m_document.securityOrigin()->canRequest(url)) { |
| 134 corsPolicyPreventedLoad(); | 131 corsPolicyPreventedLoad(); |
| 135 return false; | 132 return false; |
| 136 } | 133 } |
| 137 } | 134 } |
| 138 | 135 |
| 139 ResourceFetcher* fetcher = m_document.fetcher(); | 136 ResourceFetcher* fetcher = m_document.fetcher(); |
| 140 m_resource = fetcher->fetchRawResource(cueRequest); | 137 m_resource = fetcher->fetchRawResource(cueRequest); |
| 141 if (!m_resource) | 138 if (!m_resource) |
| 142 return false; | 139 return false; |
| 143 m_resource->addClient(this); | 140 m_resource->addClient(this); |
| 144 m_client.cueLoadingStarted(this); | |
| 145 return true; | 141 return true; |
| 146 } | 142 } |
| 147 | 143 |
| 148 void TextTrackLoader::newCuesParsed() | 144 void TextTrackLoader::newCuesParsed() |
| 149 { | 145 { |
| 150 if (m_cueLoadTimer.isActive()) | 146 if (m_cueLoadTimer.isActive()) |
| 151 return; | 147 return; |
| 152 | 148 |
| 153 m_newCuesAvailable = true; | 149 m_newCuesAvailable = true; |
| 154 m_cueLoadTimer.startOneShot(0); | 150 m_cueLoadTimer.startOneShot(0); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 179 } | 175 } |
| 180 | 176 |
| 181 void TextTrackLoader::getNewRegions(Vector<RefPtr<TextTrackRegion> >& outputRegi
ons) | 177 void TextTrackLoader::getNewRegions(Vector<RefPtr<TextTrackRegion> >& outputRegi
ons) |
| 182 { | 178 { |
| 183 ASSERT(m_cueParser); | 179 ASSERT(m_cueParser); |
| 184 if (m_cueParser) | 180 if (m_cueParser) |
| 185 m_cueParser->getNewRegions(outputRegions); | 181 m_cueParser->getNewRegions(outputRegions); |
| 186 } | 182 } |
| 187 | 183 |
| 188 } | 184 } |
| OLD | NEW |