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

Side by Side Diff: Source/core/loader/TextTrackLoader.h

Issue 25798003: Enable WebVTT regions for runtime testing, updated tests and minor fixes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/track/WebVTTParser.cpp ('k') | Source/core/loader/TextTrackLoader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple 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 29 matching lines...) Expand all
40 class ExecutionContext; 40 class ExecutionContext;
41 41
42 class TextTrackLoaderClient { 42 class TextTrackLoaderClient {
43 public: 43 public:
44 virtual ~TextTrackLoaderClient() { } 44 virtual ~TextTrackLoaderClient() { }
45 45
46 virtual bool shouldLoadCues(TextTrackLoader*) = 0; 46 virtual bool shouldLoadCues(TextTrackLoader*) = 0;
47 virtual void newCuesAvailable(TextTrackLoader*) = 0; 47 virtual void newCuesAvailable(TextTrackLoader*) = 0;
48 virtual void cueLoadingStarted(TextTrackLoader*) = 0; 48 virtual void cueLoadingStarted(TextTrackLoader*) = 0;
49 virtual void cueLoadingCompleted(TextTrackLoader*, bool loadingFailed) = 0; 49 virtual void cueLoadingCompleted(TextTrackLoader*, bool loadingFailed) = 0;
50 #if ENABLE(WEBVTT_REGIONS)
51 virtual void newRegionsAvailable(TextTrackLoader*) = 0; 50 virtual void newRegionsAvailable(TextTrackLoader*) = 0;
52 #endif
53 }; 51 };
54 52
55 class TextTrackLoader : public ResourceClient, private WebVTTParserClient { 53 class TextTrackLoader : public ResourceClient, private WebVTTParserClient {
56 WTF_MAKE_NONCOPYABLE(TextTrackLoader); 54 WTF_MAKE_NONCOPYABLE(TextTrackLoader);
57 WTF_MAKE_FAST_ALLOCATED; 55 WTF_MAKE_FAST_ALLOCATED;
58 public: 56 public:
59 static PassOwnPtr<TextTrackLoader> create(TextTrackLoaderClient* client, Exe cutionContext* context) 57 static PassOwnPtr<TextTrackLoader> create(TextTrackLoaderClient* client, Exe cutionContext* context)
60 { 58 {
61 return adoptPtr(new TextTrackLoader(client, context)); 59 return adoptPtr(new TextTrackLoader(client, context));
62 } 60 }
63 virtual ~TextTrackLoader(); 61 virtual ~TextTrackLoader();
64 62
65 bool load(const KURL&, const String& crossOriginMode); 63 bool load(const KURL&, const String& crossOriginMode);
66 void cancelLoad(); 64 void cancelLoad();
67 65
68 enum State { Idle, Loading, Finished, Failed }; 66 enum State { Idle, Loading, Finished, Failed };
69 State loadState() { return m_state; } 67 State loadState() { return m_state; }
70 68
71 void getNewCues(Vector<RefPtr<TextTrackCue> >& outputCues); 69 void getNewCues(Vector<RefPtr<TextTrackCue> >& outputCues);
72 #if ENABLE(WEBVTT_REGIONS)
73 void getNewRegions(Vector<RefPtr<TextTrackRegion> >& outputRegions); 70 void getNewRegions(Vector<RefPtr<TextTrackRegion> >& outputRegions);
74 #endif
75 private: 71 private:
76 72
77 // ResourceClient 73 // ResourceClient
78 virtual void notifyFinished(Resource*); 74 virtual void notifyFinished(Resource*);
79 virtual void deprecatedDidReceiveResource(Resource*); 75 virtual void deprecatedDidReceiveResource(Resource*);
80 76
81 // WebVTTParserClient 77 // WebVTTParserClient
82 virtual void newCuesParsed(); 78 virtual void newCuesParsed();
83 #if ENABLE(WEBVTT_REGIONS)
84 virtual void newRegionsParsed(); 79 virtual void newRegionsParsed();
85 #endif
86 virtual void fileFailedToParse(); 80 virtual void fileFailedToParse();
87 81
88 TextTrackLoader(TextTrackLoaderClient*, ExecutionContext*); 82 TextTrackLoader(TextTrackLoaderClient*, ExecutionContext*);
89 83
90 void processNewCueData(Resource*); 84 void processNewCueData(Resource*);
91 void cueLoadTimerFired(Timer<TextTrackLoader>*); 85 void cueLoadTimerFired(Timer<TextTrackLoader>*);
92 void corsPolicyPreventedLoad(); 86 void corsPolicyPreventedLoad();
93 87
94 TextTrackLoaderClient* m_client; 88 TextTrackLoaderClient* m_client;
95 OwnPtr<WebVTTParser> m_cueParser; 89 OwnPtr<WebVTTParser> m_cueParser;
96 ResourcePtr<TextTrackResource> m_cachedCueData; 90 ResourcePtr<TextTrackResource> m_cachedCueData;
97 ExecutionContext* m_executionContext; 91 ExecutionContext* m_executionContext;
98 Timer<TextTrackLoader> m_cueLoadTimer; 92 Timer<TextTrackLoader> m_cueLoadTimer;
99 String m_crossOriginMode; 93 String m_crossOriginMode;
100 State m_state; 94 State m_state;
101 unsigned m_parseOffset; 95 unsigned m_parseOffset;
102 bool m_newCuesAvailable; 96 bool m_newCuesAvailable;
103 }; 97 };
104 98
105 } // namespace WebCore 99 } // namespace WebCore
106 100
107 #endif 101 #endif
OLDNEW
« no previous file with comments | « Source/core/html/track/WebVTTParser.cpp ('k') | Source/core/loader/TextTrackLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698