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

Side by Side Diff: Source/core/html/track/TextTrack.h

Issue 92783002: Move code that applies to audio and video tracks into TrackBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@tmp
Patch Set: Fix copyright, explicit constructor, and AtomicString oldKind, and replace mediaElement() with trac… Created 7 years 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
OLDNEW
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
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;
41 class TextTrackList;
42 class VTTRegion; 42 class VTTRegion;
43 class VTTRegionList; 43 class VTTRegionList;
44 44
45 class TextTrackClient { 45 class TextTrackClient {
46 public: 46 public:
47 virtual ~TextTrackClient() { } 47 virtual ~TextTrackClient() { }
48 virtual void textTrackKindChanged(TextTrack*) = 0; 48 virtual void textTrackKindChanged(TextTrack*) = 0;
49 virtual void textTrackModeChanged(TextTrack*) = 0; 49 virtual void textTrackModeChanged(TextTrack*) = 0;
50 virtual void textTrackAddCues(TextTrack*, const TextTrackCueList*) = 0; 50 virtual void textTrackAddCues(TextTrack*, const TextTrackCueList*) = 0;
51 virtual void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) = 0; 51 virtual void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) = 0;
52 virtual void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0; 52 virtual void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0;
53 virtual void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0; 53 virtual void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0;
54 }; 54 };
55 55
56 class TextTrack : public TrackBase, public ScriptWrappable { 56 class TextTrack : public TrackBase, public ScriptWrappable, public EventTargetWi thInlineData {
57 REFCOUNTED_EVENT_TARGET(TrackBase);
57 public: 58 public:
58 static PassRefPtr<TextTrack> create(Document& document, TextTrackClient* cli ent, const AtomicString& kind, const AtomicString& label, const AtomicString& la nguage) 59 static PassRefPtr<TextTrack> create(Document& document, TextTrackClient* cli ent, const AtomicString& kind, const AtomicString& label, const AtomicString& la nguage)
59 { 60 {
60 return adoptRef(new TextTrack(document, client, kind, label, language, e mptyAtom, AddTrack)); 61 return adoptRef(new TextTrack(document, client, kind, label, language, e mptyAtom, AddTrack));
61 } 62 }
62 virtual ~TextTrack(); 63 virtual ~TextTrack();
63 64
64 void setMediaElement(HTMLMediaElement* element) { m_mediaElement = element; } 65 void setTrackList(TextTrackList* trackList) { m_trackList = trackList; }
65 HTMLMediaElement* mediaElement() { return m_mediaElement; } 66 TextTrackList* trackList() { return m_trackList; }
66 67
67 AtomicString kind() const { return m_kind; } 68 virtual void setKind(const AtomicString&) OVERRIDE;
68 void setKind(const AtomicString&);
69 69
70 static const AtomicString& subtitlesKeyword(); 70 static const AtomicString& subtitlesKeyword();
71 static const AtomicString& captionsKeyword(); 71 static const AtomicString& captionsKeyword();
72 static const AtomicString& descriptionsKeyword(); 72 static const AtomicString& descriptionsKeyword();
73 static const AtomicString& chaptersKeyword(); 73 static const AtomicString& chaptersKeyword();
74 static const AtomicString& metadataKeyword(); 74 static const AtomicString& metadataKeyword();
75 static bool isValidKindKeyword(const AtomicString&); 75 static bool isValidKindKeyword(const AtomicString&);
76 76
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(); 77 static const AtomicString& disabledKeyword();
87 static const AtomicString& hiddenKeyword(); 78 static const AtomicString& hiddenKeyword();
88 static const AtomicString& showingKeyword(); 79 static const AtomicString& showingKeyword();
89 80
90 AtomicString mode() const { return m_mode; } 81 AtomicString mode() const { return m_mode; }
91 void setMode(const AtomicString&); 82 void setMode(const AtomicString&);
92 83
93 enum ReadinessState { NotLoaded = 0, Loading = 1, Loaded = 2, FailedToLoad = 3 }; 84 enum ReadinessState { NotLoaded = 0, Loading = 1, Loaded = 2, FailedToLoad = 3 };
94 ReadinessState readinessState() const { return m_readinessState; } 85 ReadinessState readinessState() const { return m_readinessState; }
95 void setReadinessState(ReadinessState state) { m_readinessState = state; } 86 void setReadinessState(ReadinessState state) { m_readinessState = state; }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 122
132 Document& document() const { return *m_document; } 123 Document& document() const { return *m_document; }
133 124
134 // EventTarget methods 125 // EventTarget methods
135 virtual const AtomicString& interfaceName() const OVERRIDE; 126 virtual const AtomicString& interfaceName() const OVERRIDE;
136 virtual ExecutionContext* executionContext() const OVERRIDE; 127 virtual ExecutionContext* executionContext() const OVERRIDE;
137 128
138 protected: 129 protected:
139 TextTrack(Document&, TextTrackClient*, const AtomicString& kind, const Atomi cString& label, const AtomicString& language, const AtomicString& id, TextTrackT ype); 130 TextTrack(Document&, TextTrackClient*, const AtomicString& kind, const Atomi cString& label, const AtomicString& language, const AtomicString& id, TextTrackT ype);
140 131
132 virtual bool isValidKind(const AtomicString& kind) const OVERRIDE { return i sValidKindKeyword(kind); }
acolwell GONE FROM CHROMIUM 2013/12/06 01:35:54 nit: isValidKindKeyword() doesn't appear to be use
133 virtual AtomicString defaultKind() const OVERRIDE { return subtitlesKeyword( ); }
134
141 RefPtr<TextTrackCueList> m_cues; 135 RefPtr<TextTrackCueList> m_cues;
142 136
143 private: 137 private:
144 VTTRegionList* ensureVTTRegionList(); 138 VTTRegionList* ensureVTTRegionList();
145 RefPtr<VTTRegionList> m_regions; 139 RefPtr<VTTRegionList> m_regions;
146 140
147 TextTrackCueList* ensureTextTrackCueList(); 141 TextTrackCueList* ensureTextTrackCueList();
148 142
149 // FIXME: Remove this pointer and get the Document from m_client 143 // FIXME: Remove this pointer and get the Document from m_client
150 Document* m_document; 144 Document* m_document;
151 145
152 HTMLMediaElement* m_mediaElement; 146 TextTrackList* m_trackList;
153 AtomicString m_kind;
154 AtomicString m_label;
155 AtomicString m_language;
156 AtomicString m_id;
157 AtomicString m_mode; 147 AtomicString m_mode;
158 TextTrackClient* m_client; 148 TextTrackClient* m_client;
159 TextTrackType m_trackType; 149 TextTrackType m_trackType;
160 ReadinessState m_readinessState; 150 ReadinessState m_readinessState;
161 int m_trackIndex; 151 int m_trackIndex;
162 int m_renderedTrackIndex; 152 int m_renderedTrackIndex;
163 bool m_hasBeenConfigured; 153 bool m_hasBeenConfigured;
164 }; 154 };
165 155
166 } // namespace WebCore 156 } // namespace WebCore
167 157
168 #endif 158 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698