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 17 matching lines...) Expand all Loading... |
28 #define TextTrack_h | 28 #define TextTrack_h |
29 | 29 |
30 #include "bindings/v8/ScriptWrappable.h" | 30 #include "bindings/v8/ScriptWrappable.h" |
31 #include "core/html/track/TrackBase.h" | 31 #include "core/html/track/TrackBase.h" |
32 #include "wtf/text/WTFString.h" | 32 #include "wtf/text/WTFString.h" |
33 | 33 |
34 namespace WebCore { | 34 namespace WebCore { |
35 | 35 |
36 class Document; | 36 class Document; |
37 class ExceptionState; | 37 class ExceptionState; |
38 class HTMLMediaElement; | |
39 class TextTrack; | 38 class TextTrack; |
40 class TextTrackCue; | 39 class TextTrackCue; |
41 class TextTrackCueList; | 40 class TextTrackCueList; |
42 class VTTRegion; | 41 class VTTRegion; |
43 class VTTRegionList; | 42 class VTTRegionList; |
44 | 43 |
45 class TextTrackClient { | 44 class TextTrackClient { |
46 public: | 45 public: |
47 virtual ~TextTrackClient() { } | 46 virtual ~TextTrackClient() { } |
48 virtual void textTrackKindChanged(TextTrack*) = 0; | 47 virtual void textTrackKindChanged(TextTrack*) = 0; |
49 virtual void textTrackModeChanged(TextTrack*) = 0; | 48 virtual void textTrackModeChanged(TextTrack*) = 0; |
50 virtual void textTrackAddCues(TextTrack*, const TextTrackCueList*) = 0; | 49 virtual void textTrackAddCues(TextTrack*, const TextTrackCueList*) = 0; |
51 virtual void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) = 0; | 50 virtual void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) = 0; |
52 virtual void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0; | 51 virtual void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0; |
53 virtual void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0; | 52 virtual void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0; |
54 }; | 53 }; |
55 | 54 |
56 class TextTrack : public TrackBase, public ScriptWrappable { | 55 class TextTrack : public TrackBase, public ScriptWrappable, public EventTargetWi
thInlineData { |
| 56 REFCOUNTED_EVENT_TARGET(TrackBase); |
57 public: | 57 public: |
58 static PassRefPtr<TextTrack> create(Document& document, TextTrackClient* cli
ent, const AtomicString& kind, const AtomicString& label, const AtomicString& la
nguage) | 58 static PassRefPtr<TextTrack> create(Document& document, TextTrackClient* cli
ent, const AtomicString& kind, const AtomicString& label, const AtomicString& la
nguage) |
59 { | 59 { |
60 return adoptRef(new TextTrack(document, client, kind, label, language, e
mptyAtom, AddTrack)); | 60 return adoptRef(new TextTrack(document, client, kind, label, language, e
mptyAtom, AddTrack)); |
61 } | 61 } |
62 virtual ~TextTrack(); | 62 virtual ~TextTrack(); |
63 | 63 |
64 void setMediaElement(HTMLMediaElement* element) { m_mediaElement = element;
} | 64 virtual void setKind(const AtomicString&) OVERRIDE; |
65 HTMLMediaElement* mediaElement() { return m_mediaElement; } | |
66 | |
67 AtomicString kind() const { return m_kind; } | |
68 void setKind(const AtomicString&); | |
69 | 65 |
70 static const AtomicString& subtitlesKeyword(); | 66 static const AtomicString& subtitlesKeyword(); |
71 static const AtomicString& captionsKeyword(); | 67 static const AtomicString& captionsKeyword(); |
72 static const AtomicString& descriptionsKeyword(); | 68 static const AtomicString& descriptionsKeyword(); |
73 static const AtomicString& chaptersKeyword(); | 69 static const AtomicString& chaptersKeyword(); |
74 static const AtomicString& metadataKeyword(); | 70 static const AtomicString& metadataKeyword(); |
75 static bool isValidKindKeyword(const AtomicString&); | 71 static bool isValidKindKeyword(const AtomicString&); |
76 | 72 |
77 AtomicString label() const { return m_label; } | |
78 void setLabel(const AtomicString& label) { m_label = label; } | |
79 | |
80 AtomicString language() const { return m_language; } | |
81 void setLanguage(const AtomicString& language) { m_language = language; } | |
82 | |
83 AtomicString id() const { return m_id; } | |
84 void setId(const AtomicString& id) { m_id = id; } | |
85 | |
86 static const AtomicString& disabledKeyword(); | 73 static const AtomicString& disabledKeyword(); |
87 static const AtomicString& hiddenKeyword(); | 74 static const AtomicString& hiddenKeyword(); |
88 static const AtomicString& showingKeyword(); | 75 static const AtomicString& showingKeyword(); |
89 | 76 |
90 AtomicString mode() const { return m_mode; } | 77 AtomicString mode() const { return m_mode; } |
91 void setMode(const AtomicString&); | 78 void setMode(const AtomicString&); |
92 | 79 |
93 enum ReadinessState { NotLoaded = 0, Loading = 1, Loaded = 2, FailedToLoad =
3 }; | 80 enum ReadinessState { NotLoaded = 0, Loading = 1, Loaded = 2, FailedToLoad =
3 }; |
94 ReadinessState readinessState() const { return m_readinessState; } | 81 ReadinessState readinessState() const { return m_readinessState; } |
95 void setReadinessState(ReadinessState state) { m_readinessState = state; } | 82 void setReadinessState(ReadinessState state) { m_readinessState = state; } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 118 |
132 Document& document() const { return *m_document; } | 119 Document& document() const { return *m_document; } |
133 | 120 |
134 // EventTarget methods | 121 // EventTarget methods |
135 virtual const AtomicString& interfaceName() const OVERRIDE; | 122 virtual const AtomicString& interfaceName() const OVERRIDE; |
136 virtual ExecutionContext* executionContext() const OVERRIDE; | 123 virtual ExecutionContext* executionContext() const OVERRIDE; |
137 | 124 |
138 protected: | 125 protected: |
139 TextTrack(Document&, TextTrackClient*, const AtomicString& kind, const Atomi
cString& label, const AtomicString& language, const AtomicString& id, TextTrackT
ype); | 126 TextTrack(Document&, TextTrackClient*, const AtomicString& kind, const Atomi
cString& label, const AtomicString& language, const AtomicString& id, TextTrackT
ype); |
140 | 127 |
| 128 virtual bool isValidKind(const AtomicString& kind) const OVERRIDE { return i
sValidKindKeyword(kind); } |
| 129 virtual AtomicString defaultKind() const OVERRIDE { return subtitlesKeyword(
); } |
| 130 |
141 RefPtr<TextTrackCueList> m_cues; | 131 RefPtr<TextTrackCueList> m_cues; |
142 | 132 |
143 private: | 133 private: |
144 VTTRegionList* ensureVTTRegionList(); | 134 VTTRegionList* ensureVTTRegionList(); |
145 RefPtr<VTTRegionList> m_regions; | 135 RefPtr<VTTRegionList> m_regions; |
146 | 136 |
147 TextTrackCueList* ensureTextTrackCueList(); | 137 TextTrackCueList* ensureTextTrackCueList(); |
148 | 138 |
149 // FIXME: Remove this pointer and get the Document from m_client | 139 // FIXME: Remove this pointer and get the Document from m_client |
150 Document* m_document; | 140 Document* m_document; |
151 | 141 |
152 HTMLMediaElement* m_mediaElement; | |
153 AtomicString m_kind; | |
154 AtomicString m_label; | |
155 AtomicString m_language; | |
156 AtomicString m_id; | |
157 AtomicString m_mode; | 142 AtomicString m_mode; |
158 TextTrackClient* m_client; | 143 TextTrackClient* m_client; |
159 TextTrackType m_trackType; | 144 TextTrackType m_trackType; |
160 ReadinessState m_readinessState; | 145 ReadinessState m_readinessState; |
161 int m_trackIndex; | 146 int m_trackIndex; |
162 int m_renderedTrackIndex; | 147 int m_renderedTrackIndex; |
163 bool m_hasBeenConfigured; | 148 bool m_hasBeenConfigured; |
164 }; | 149 }; |
165 | 150 |
166 } // namespace WebCore | 151 } // namespace WebCore |
167 | 152 |
168 #endif | 153 #endif |
OLD | NEW |