OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 26 matching lines...) Expand all Loading... |
37 class Document; | 37 class Document; |
38 class ExceptionState; | 38 class ExceptionState; |
39 class HTMLMediaElement; | 39 class HTMLMediaElement; |
40 class TextTrack; | 40 class TextTrack; |
41 class TextTrackCue; | 41 class TextTrackCue; |
42 class TextTrackCueList; | 42 class TextTrackCueList; |
43 class TextTrackList; | 43 class TextTrackList; |
44 class VTTRegion; | 44 class VTTRegion; |
45 class VTTRegionList; | 45 class VTTRegionList; |
46 | 46 |
47 class TextTrackClient { | |
48 public: | |
49 virtual ~TextTrackClient() { } | |
50 virtual void textTrackKindChanged(TextTrack*) = 0; | |
51 virtual void textTrackModeChanged(TextTrack*) = 0; | |
52 virtual void textTrackAddCues(TextTrack*, const TextTrackCueList*) = 0; | |
53 virtual void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) = 0; | |
54 virtual void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0; | |
55 virtual void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0; | |
56 }; | |
57 | |
58 class TextTrack : public TrackBase, public ScriptWrappable, public EventTargetWi
thInlineData { | 47 class TextTrack : public TrackBase, public ScriptWrappable, public EventTargetWi
thInlineData { |
59 REFCOUNTED_EVENT_TARGET(TrackBase); | 48 REFCOUNTED_EVENT_TARGET(TrackBase); |
60 public: | 49 public: |
61 static PassRefPtr<TextTrack> create(Document& document, TextTrackClient* cli
ent, const AtomicString& kind, const AtomicString& label, const AtomicString& la
nguage) | 50 static PassRefPtr<TextTrack> create(Document& document, const AtomicString&
kind, const AtomicString& label, const AtomicString& language) |
62 { | 51 { |
63 return adoptRef(new TextTrack(document, client, kind, label, language, e
mptyAtom, AddTrack)); | 52 return adoptRef(new TextTrack(document, kind, label, language, emptyAtom
, AddTrack)); |
64 } | 53 } |
65 virtual ~TextTrack(); | 54 virtual ~TextTrack(); |
66 | 55 |
67 virtual void setTrackList(TextTrackList*); | 56 virtual void setTrackList(TextTrackList*); |
68 TextTrackList* trackList() { return m_trackList; } | 57 TextTrackList* trackList() { return m_trackList; } |
69 | 58 |
70 virtual void setKind(const AtomicString&) OVERRIDE; | 59 virtual void setKind(const AtomicString&) OVERRIDE; |
71 | 60 |
72 static const AtomicString& subtitlesKeyword(); | 61 static const AtomicString& subtitlesKeyword(); |
73 static const AtomicString& captionsKeyword(); | 62 static const AtomicString& captionsKeyword(); |
74 static const AtomicString& descriptionsKeyword(); | 63 static const AtomicString& descriptionsKeyword(); |
75 static const AtomicString& chaptersKeyword(); | 64 static const AtomicString& chaptersKeyword(); |
76 static const AtomicString& metadataKeyword(); | 65 static const AtomicString& metadataKeyword(); |
77 static bool isValidKindKeyword(const AtomicString&); | 66 static bool isValidKindKeyword(const AtomicString&); |
78 | 67 |
79 static const AtomicString& disabledKeyword(); | 68 static const AtomicString& disabledKeyword(); |
80 static const AtomicString& hiddenKeyword(); | 69 static const AtomicString& hiddenKeyword(); |
81 static const AtomicString& showingKeyword(); | 70 static const AtomicString& showingKeyword(); |
82 | 71 |
83 AtomicString mode() const { return m_mode; } | 72 AtomicString mode() const { return m_mode; } |
84 void setMode(const AtomicString&); | 73 virtual void setMode(const AtomicString&); |
85 | 74 |
86 enum ReadinessState { NotLoaded = 0, Loading = 1, Loaded = 2, FailedToLoad =
3 }; | 75 enum ReadinessState { NotLoaded = 0, Loading = 1, Loaded = 2, FailedToLoad =
3 }; |
87 ReadinessState readinessState() const { return m_readinessState; } | 76 ReadinessState readinessState() const { return m_readinessState; } |
88 void setReadinessState(ReadinessState state) { m_readinessState = state; } | 77 void setReadinessState(ReadinessState state) { m_readinessState = state; } |
89 | 78 |
90 TextTrackCueList* cues(); | 79 TextTrackCueList* cues(); |
91 TextTrackCueList* activeCues() const; | 80 TextTrackCueList* activeCues() const; |
92 | 81 |
93 void clearClient() { m_client = 0; } | 82 HTMLMediaElement* mediaElement(); |
94 TextTrackClient* client() { return m_client; } | |
95 | 83 |
96 void addCue(PassRefPtr<TextTrackCue>); | 84 void addCue(PassRefPtr<TextTrackCue>); |
97 void removeCue(TextTrackCue*, ExceptionState&); | 85 void removeCue(TextTrackCue*, ExceptionState&); |
98 | 86 |
99 VTTRegionList* regions(); | 87 VTTRegionList* regions(); |
100 void addRegion(PassRefPtr<VTTRegion>); | 88 void addRegion(PassRefPtr<VTTRegion>); |
101 void removeRegion(VTTRegion*, ExceptionState&); | 89 void removeRegion(VTTRegion*, ExceptionState&); |
102 | 90 |
103 void cueWillChange(TextTrackCue*); | 91 void cueWillChange(TextTrackCue*); |
104 void cueDidChange(TextTrackCue*); | 92 void cueDidChange(TextTrackCue*); |
(...skipping 17 matching lines...) Expand all Loading... |
122 | 110 |
123 void removeAllCues(); | 111 void removeAllCues(); |
124 | 112 |
125 Document& document() const { return *m_document; } | 113 Document& document() const { return *m_document; } |
126 | 114 |
127 // EventTarget methods | 115 // EventTarget methods |
128 virtual const AtomicString& interfaceName() const OVERRIDE; | 116 virtual const AtomicString& interfaceName() const OVERRIDE; |
129 virtual ExecutionContext* executionContext() const OVERRIDE; | 117 virtual ExecutionContext* executionContext() const OVERRIDE; |
130 | 118 |
131 protected: | 119 protected: |
132 TextTrack(Document&, TextTrackClient*, const AtomicString& kind, const Atomi
cString& label, const AtomicString& language, const AtomicString& id, TextTrackT
ype); | 120 TextTrack(Document&, const AtomicString& kind, const AtomicString& label, co
nst AtomicString& language, const AtomicString& id, TextTrackType); |
133 | 121 |
134 virtual bool isValidKind(const AtomicString& kind) const OVERRIDE { return i
sValidKindKeyword(kind); } | 122 virtual bool isValidKind(const AtomicString& kind) const OVERRIDE { return i
sValidKindKeyword(kind); } |
135 virtual AtomicString defaultKind() const OVERRIDE { return subtitlesKeyword(
); } | 123 virtual AtomicString defaultKind() const OVERRIDE { return subtitlesKeyword(
); } |
136 | 124 |
137 RefPtr<TextTrackCueList> m_cues; | 125 RefPtr<TextTrackCueList> m_cues; |
138 | 126 |
139 private: | 127 private: |
140 VTTRegionList* ensureVTTRegionList(); | 128 VTTRegionList* ensureVTTRegionList(); |
141 RefPtr<VTTRegionList> m_regions; | 129 RefPtr<VTTRegionList> m_regions; |
142 | 130 |
143 TextTrackCueList* ensureTextTrackCueList(); | 131 TextTrackCueList* ensureTextTrackCueList(); |
144 | 132 |
145 // FIXME: Remove this pointer and get the Document from m_client | 133 // FIXME: Remove this pointer and get the Document from m_client |
146 Document* m_document; | 134 Document* m_document; |
147 | 135 |
148 TextTrackList* m_trackList; | 136 TextTrackList* m_trackList; |
149 AtomicString m_mode; | 137 AtomicString m_mode; |
150 TextTrackClient* m_client; | |
151 TextTrackType m_trackType; | 138 TextTrackType m_trackType; |
152 ReadinessState m_readinessState; | 139 ReadinessState m_readinessState; |
153 int m_trackIndex; | 140 int m_trackIndex; |
154 int m_renderedTrackIndex; | 141 int m_renderedTrackIndex; |
155 bool m_hasBeenConfigured; | 142 bool m_hasBeenConfigured; |
156 }; | 143 }; |
157 | 144 |
158 } // namespace WebCore | 145 } // namespace WebCore |
159 | 146 |
160 #endif | 147 #endif |
OLD | NEW |