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 14 matching lines...) Expand all Loading... |
25 | 25 |
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/FetchInitiatorTypeNames.h" | 30 #include "core/FetchInitiatorTypeNames.h" |
31 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
32 #include "core/fetch/CrossOriginAccessControl.h" | 32 #include "core/fetch/CrossOriginAccessControl.h" |
33 #include "core/fetch/FetchRequest.h" | 33 #include "core/fetch/FetchRequest.h" |
34 #include "core/fetch/ResourceFetcher.h" | 34 #include "core/fetch/ResourceFetcher.h" |
| 35 #include "core/inspector/ConsoleMessage.h" |
35 #include "platform/Logging.h" | 36 #include "platform/Logging.h" |
36 #include "platform/SharedBuffer.h" | 37 #include "platform/SharedBuffer.h" |
37 #include "platform/weborigin/SecurityOrigin.h" | 38 #include "platform/weborigin/SecurityOrigin.h" |
38 | 39 |
39 namespace blink { | 40 namespace blink { |
40 | 41 |
41 TextTrackLoader::TextTrackLoader(TextTrackLoaderClient& client, Document& docume
nt) | 42 TextTrackLoader::TextTrackLoader(TextTrackLoaderClient& client, Document& docume
nt) |
42 : m_client(client) | 43 : m_client(client) |
43 , m_document(document) | 44 , m_document(document) |
44 , m_cueLoadTimer(this, &TextTrackLoader::cueLoadTimerFired) | 45 , m_cueLoadTimer(this, &TextTrackLoader::cueLoadTimerFired) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 79 |
79 if (!m_cueParser) | 80 if (!m_cueParser) |
80 m_cueParser = VTTParser::create(this, document()); | 81 m_cueParser = VTTParser::create(this, document()); |
81 | 82 |
82 m_cueParser->parseBytes(data, length); | 83 m_cueParser->parseBytes(data, length); |
83 } | 84 } |
84 | 85 |
85 void TextTrackLoader::corsPolicyPreventedLoad(SecurityOrigin* securityOrigin, co
nst KURL& url) | 86 void TextTrackLoader::corsPolicyPreventedLoad(SecurityOrigin* securityOrigin, co
nst KURL& url) |
86 { | 87 { |
87 String consoleMessage("Text track from origin '" + SecurityOrigin::create(ur
l)->toString() + "' has been blocked from loading: Not at same origin as the doc
ument, and parent of track element does not have a 'crossorigin' attribute. Orig
in '" + securityOrigin->toString() + "' is therefore not allowed access."); | 88 String consoleMessage("Text track from origin '" + SecurityOrigin::create(ur
l)->toString() + "' has been blocked from loading: Not at same origin as the doc
ument, and parent of track element does not have a 'crossorigin' attribute. Orig
in '" + securityOrigin->toString() + "' is therefore not allowed access."); |
88 document().addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, conso
leMessage); | 89 document().addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, E
rrorMessageLevel, consoleMessage)); |
89 m_state = Failed; | 90 m_state = Failed; |
90 } | 91 } |
91 | 92 |
92 void TextTrackLoader::notifyFinished(Resource* resource) | 93 void TextTrackLoader::notifyFinished(Resource* resource) |
93 { | 94 { |
94 ASSERT(this->resource() == resource); | 95 ASSERT(this->resource() == resource); |
95 if (m_state != Failed) | 96 if (m_state != Failed) |
96 m_state = resource->errorOccurred() ? Failed : Finished; | 97 m_state = resource->errorOccurred() ? Failed : Finished; |
97 | 98 |
98 if (m_state == Finished && m_cueParser) | 99 if (m_state == Finished && m_cueParser) |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 m_cueParser->getNewRegions(outputRegions); | 164 m_cueParser->getNewRegions(outputRegions); |
164 } | 165 } |
165 | 166 |
166 void TextTrackLoader::trace(Visitor* visitor) | 167 void TextTrackLoader::trace(Visitor* visitor) |
167 { | 168 { |
168 visitor->trace(m_cueParser); | 169 visitor->trace(m_cueParser); |
169 visitor->trace(m_document); | 170 visitor->trace(m_document); |
170 } | 171 } |
171 | 172 |
172 } | 173 } |
OLD | NEW |