| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #ifndef TextTrack_h | 27 #ifndef TextTrack_h |
| 28 #define TextTrack_h | 28 #define TextTrack_h |
| 29 | 29 |
| 30 #include "core/dom/ExceptionCode.h" | 30 #include "core/dom/ExceptionCode.h" |
| 31 #include "core/html/track/TrackBase.h" | 31 #include "core/html/track/TrackBase.h" |
| 32 #include <wtf/PassOwnPtr.h> | 32 #include <wtf/PassOwnPtr.h> |
| 33 #include <wtf/RefCounted.h> | 33 #include <wtf/RefCounted.h> |
| 34 #include <wtf/text/WTFString.h> | 34 #include <wtf/text/WTFString.h> |
| 35 | 35 |
| 36 #if USE(PLATFORM_TEXT_TRACK_MENU) | |
| 37 #include "core/platform/graphics/PlatformTextTrack.h" | |
| 38 #endif | |
| 39 | |
| 40 namespace WebCore { | 36 namespace WebCore { |
| 41 | 37 |
| 42 class HTMLMediaElement; | 38 class HTMLMediaElement; |
| 43 class TextTrack; | 39 class TextTrack; |
| 44 class TextTrackCue; | 40 class TextTrackCue; |
| 45 class TextTrackCueList; | 41 class TextTrackCueList; |
| 46 #if ENABLE(WEBVTT_REGIONS) | 42 #if ENABLE(WEBVTT_REGIONS) |
| 47 class TextTrackRegion; | 43 class TextTrackRegion; |
| 48 class TextTrackRegionList; | 44 class TextTrackRegionList; |
| 49 #endif | 45 #endif |
| 50 | 46 |
| 51 class TextTrackClient { | 47 class TextTrackClient { |
| 52 public: | 48 public: |
| 53 virtual ~TextTrackClient() { } | 49 virtual ~TextTrackClient() { } |
| 54 virtual void textTrackKindChanged(TextTrack*) = 0; | 50 virtual void textTrackKindChanged(TextTrack*) = 0; |
| 55 virtual void textTrackModeChanged(TextTrack*) = 0; | 51 virtual void textTrackModeChanged(TextTrack*) = 0; |
| 56 virtual void textTrackAddCues(TextTrack*, const TextTrackCueList*) = 0; | 52 virtual void textTrackAddCues(TextTrack*, const TextTrackCueList*) = 0; |
| 57 virtual void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) = 0; | 53 virtual void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) = 0; |
| 58 virtual void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0; | 54 virtual void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0; |
| 59 virtual void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0; | 55 virtual void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0; |
| 60 }; | 56 }; |
| 61 | 57 |
| 62 class TextTrack : public TrackBase | 58 class TextTrack : public TrackBase { |
| 63 #if USE(PLATFORM_TEXT_TRACK_MENU) | |
| 64 , public PlatformTextTrackClient | |
| 65 #endif | |
| 66 { | |
| 67 public: | 59 public: |
| 68 static PassRefPtr<TextTrack> create(ScriptExecutionContext* context, TextTra
ckClient* client, const AtomicString& kind, const AtomicString& label, const Ato
micString& language) | 60 static PassRefPtr<TextTrack> create(ScriptExecutionContext* context, TextTra
ckClient* client, const AtomicString& kind, const AtomicString& label, const Ato
micString& language) |
| 69 { | 61 { |
| 70 return adoptRef(new TextTrack(context, client, kind, label, language, Ad
dTrack)); | 62 return adoptRef(new TextTrack(context, client, kind, label, language, Ad
dTrack)); |
| 71 } | 63 } |
| 72 virtual ~TextTrack(); | 64 virtual ~TextTrack(); |
| 73 | 65 |
| 74 void setMediaElement(HTMLMediaElement* element) { m_mediaElement = element;
} | 66 void setMediaElement(HTMLMediaElement* element) { m_mediaElement = element;
} |
| 75 HTMLMediaElement* mediaElement() { return m_mediaElement; } | 67 HTMLMediaElement* mediaElement() { return m_mediaElement; } |
| 76 | 68 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 int trackIndexRelativeToRenderedTracks(); | 130 int trackIndexRelativeToRenderedTracks(); |
| 139 | 131 |
| 140 bool hasBeenConfigured() const { return m_hasBeenConfigured; } | 132 bool hasBeenConfigured() const { return m_hasBeenConfigured; } |
| 141 void setHasBeenConfigured(bool flag) { m_hasBeenConfigured = flag; } | 133 void setHasBeenConfigured(bool flag) { m_hasBeenConfigured = flag; } |
| 142 | 134 |
| 143 virtual bool isDefault() const { return false; } | 135 virtual bool isDefault() const { return false; } |
| 144 virtual void setIsDefault(bool) { } | 136 virtual void setIsDefault(bool) { } |
| 145 | 137 |
| 146 void removeAllCues(); | 138 void removeAllCues(); |
| 147 | 139 |
| 148 #if USE(PLATFORM_TEXT_TRACK_MENU) | |
| 149 PassRefPtr<PlatformTextTrack> platformTextTrack(); | |
| 150 #endif | |
| 151 | |
| 152 protected: | 140 protected: |
| 153 TextTrack(ScriptExecutionContext*, TextTrackClient*, const AtomicString& kin
d, const AtomicString& label, const AtomicString& language, TextTrackType); | 141 TextTrack(ScriptExecutionContext*, TextTrackClient*, const AtomicString& kin
d, const AtomicString& label, const AtomicString& language, TextTrackType); |
| 154 #if ENABLE(WEBVTT_REGIONS) | 142 #if ENABLE(WEBVTT_REGIONS) |
| 155 TextTrackRegionList* regionList(); | 143 TextTrackRegionList* regionList(); |
| 156 #endif | 144 #endif |
| 157 | 145 |
| 158 RefPtr<TextTrackCueList> m_cues; | 146 RefPtr<TextTrackCueList> m_cues; |
| 159 | 147 |
| 160 private: | 148 private: |
| 161 | 149 |
| 162 #if ENABLE(WEBVTT_REGIONS) | 150 #if ENABLE(WEBVTT_REGIONS) |
| 163 TextTrackRegionList* ensureTextTrackRegionList(); | 151 TextTrackRegionList* ensureTextTrackRegionList(); |
| 164 RefPtr<TextTrackRegionList> m_regions; | 152 RefPtr<TextTrackRegionList> m_regions; |
| 165 #endif | 153 #endif |
| 166 | 154 |
| 167 #if USE(PLATFORM_TEXT_TRACK_MENU) | |
| 168 virtual TextTrack* publicTrack() OVERRIDE { return this; } | |
| 169 | |
| 170 RefPtr<PlatformTextTrack> m_platformTextTrack; | |
| 171 #endif | |
| 172 | |
| 173 TextTrackCueList* ensureTextTrackCueList(); | 155 TextTrackCueList* ensureTextTrackCueList(); |
| 174 | 156 |
| 175 HTMLMediaElement* m_mediaElement; | 157 HTMLMediaElement* m_mediaElement; |
| 176 AtomicString m_kind; | 158 AtomicString m_kind; |
| 177 AtomicString m_label; | 159 AtomicString m_label; |
| 178 AtomicString m_language; | 160 AtomicString m_language; |
| 179 AtomicString m_mode; | 161 AtomicString m_mode; |
| 180 TextTrackClient* m_client; | 162 TextTrackClient* m_client; |
| 181 TextTrackType m_trackType; | 163 TextTrackType m_trackType; |
| 182 ReadinessState m_readinessState; | 164 ReadinessState m_readinessState; |
| 183 int m_trackIndex; | 165 int m_trackIndex; |
| 184 int m_renderedTrackIndex; | 166 int m_renderedTrackIndex; |
| 185 bool m_hasBeenConfigured; | 167 bool m_hasBeenConfigured; |
| 186 }; | 168 }; |
| 187 | 169 |
| 188 } // namespace WebCore | 170 } // namespace WebCore |
| 189 | 171 |
| 190 #endif | 172 #endif |
| OLD | NEW |