OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2013 Apple Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions | |
6 * are met: | |
7 * 1. Redistributions of source code must retain the above copyright | |
8 * notice, this list of conditions and the following disclaimer. | |
9 * 2. Redistributions in binary form must reproduce the above copyright | |
10 * notice, this list of conditions and the following disclaimer in the | |
11 * documentation and/or other materials provided with the distribution. | |
12 * | |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | |
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
23 * THE POSSIBILITY OF SUCH DAMAGE. | |
24 */ | |
25 | |
26 #ifndef PlatformTextTrack_h | |
27 #define PlatformTextTrack_h | |
28 | |
29 #if USE(PLATFORM_TEXT_TRACK_MENU) | |
30 | |
31 #include <wtf/RefCounted.h> | |
32 #include <wtf/text/WTFString.h> | |
33 | |
34 namespace WebCore { | |
35 | |
36 class TextTrack; | |
37 class InbandTextTrackPrivate; | |
38 | |
39 class PlatformTextTrackClient { | |
40 public: | |
41 virtual ~PlatformTextTrackClient() { } | |
42 | |
43 virtual TextTrack* publicTrack() = 0; | |
44 virtual InbandTextTrackPrivate* privateTrack() { return 0; } | |
45 }; | |
46 | |
47 class PlatformTextTrack : public RefCounted<PlatformTextTrack> { | |
48 public: | |
49 enum TrackKind { Subtitle = 0, Caption = 1, Description = 2, Chapter = 3, Me
taData = 4 }; | |
50 enum TrackType { InBand = 0, OutOfBand = 1, Script = 2 }; | |
51 | |
52 static PassRefPtr<PlatformTextTrack> create(PlatformTextTrackClient* client,
const String& label, const String& language, TrackKind kind, TrackType type) | |
53 { | |
54 return adoptRef(new PlatformTextTrack(client, label, language, kind, typ
e)); | |
55 } | |
56 | |
57 virtual ~PlatformTextTrack() { } | |
58 | |
59 TrackType type() const { return m_type; } | |
60 TrackKind kind() const { return m_kind; } | |
61 String label() const { return m_label; } | |
62 String language() const { return m_language; } | |
63 PlatformTextTrackClient* client() const { return m_client; } | |
64 | |
65 protected: | |
66 PlatformTextTrack(PlatformTextTrackClient* client, const String& label, cons
t String& language, TrackKind kind, TrackType type) | |
67 : m_label(label) | |
68 , m_language(language) | |
69 , m_kind(kind) | |
70 , m_type(type) | |
71 , m_client(client) | |
72 { | |
73 } | |
74 | |
75 String m_label; | |
76 String m_language; | |
77 TrackKind m_kind; | |
78 TrackType m_type; | |
79 PlatformTextTrackClient* m_client; | |
80 }; | |
81 | |
82 } | |
83 | |
84 #endif | |
85 | |
86 #endif // PlatformTextTrack_h | |
OLD | NEW |