OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 case WebInbandTextTrack::KindDescriptions: | 47 case WebInbandTextTrack::KindDescriptions: |
48 return TextTrack::descriptionsKeyword(); | 48 return TextTrack::descriptionsKeyword(); |
49 case WebInbandTextTrack::KindChapters: | 49 case WebInbandTextTrack::KindChapters: |
50 return TextTrack::chaptersKeyword(); | 50 return TextTrack::chaptersKeyword(); |
51 case WebInbandTextTrack::KindMetadata: | 51 case WebInbandTextTrack::KindMetadata: |
52 return TextTrack::metadataKeyword(); | 52 return TextTrack::metadataKeyword(); |
53 case WebInbandTextTrack::KindNone: | 53 case WebInbandTextTrack::KindNone: |
54 default: | 54 default: |
55 break; | 55 break; |
56 } | 56 } |
57 ASSERT_NOT_REACHED(); | 57 NOTREACHED(); |
58 return TextTrack::subtitlesKeyword(); | 58 return TextTrack::subtitlesKeyword(); |
59 } | 59 } |
60 | 60 |
61 } // namespace | 61 } // namespace |
62 | 62 |
63 InbandTextTrack* InbandTextTrack::create(WebInbandTextTrack* webTrack) | 63 InbandTextTrack* InbandTextTrack::create(WebInbandTextTrack* webTrack) |
64 { | 64 { |
65 return new InbandTextTrack(webTrack); | 65 return new InbandTextTrack(webTrack); |
66 } | 66 } |
67 | 67 |
68 InbandTextTrack::InbandTextTrack(WebInbandTextTrack* webTrack) | 68 InbandTextTrack::InbandTextTrack(WebInbandTextTrack* webTrack) |
69 : TextTrack(textTrackKindToString(webTrack->kind()), webTrack->label(), webT
rack->language(), webTrack->id(), InBand) | 69 : TextTrack(textTrackKindToString(webTrack->kind()), webTrack->label(), webT
rack->language(), webTrack->id(), InBand) |
70 , m_webTrack(webTrack) | 70 , m_webTrack(webTrack) |
71 { | 71 { |
72 m_webTrack->setClient(this); | 72 m_webTrack->setClient(this); |
73 } | 73 } |
74 | 74 |
75 InbandTextTrack::~InbandTextTrack() | 75 InbandTextTrack::~InbandTextTrack() |
76 { | 76 { |
77 if (m_webTrack) | 77 if (m_webTrack) |
78 m_webTrack->setClient(nullptr); | 78 m_webTrack->setClient(nullptr); |
79 } | 79 } |
80 | 80 |
81 void InbandTextTrack::setTrackList(TextTrackList* trackList) | 81 void InbandTextTrack::setTrackList(TextTrackList* trackList) |
82 { | 82 { |
83 TextTrack::setTrackList(trackList); | 83 TextTrack::setTrackList(trackList); |
84 if (trackList) | 84 if (trackList) |
85 return; | 85 return; |
86 | 86 |
87 ASSERT(m_webTrack); | 87 DCHECK(m_webTrack); |
88 m_webTrack->setClient(nullptr); | 88 m_webTrack->setClient(nullptr); |
89 m_webTrack = nullptr; | 89 m_webTrack = nullptr; |
90 } | 90 } |
91 | 91 |
92 void InbandTextTrack::addWebVTTCue(double start, double end, const WebString& id
, const WebString& content, const WebString& settings) | 92 void InbandTextTrack::addWebVTTCue(double start, double end, const WebString& id
, const WebString& content, const WebString& settings) |
93 { | 93 { |
94 HTMLMediaElement* owner = mediaElement(); | 94 HTMLMediaElement* owner = mediaElement(); |
95 ASSERT(owner); | 95 DCHECK(owner); |
96 VTTCue* cue = VTTCue::create(owner->document(), start, end, content); | 96 VTTCue* cue = VTTCue::create(owner->document(), start, end, content); |
97 cue->setId(id); | 97 cue->setId(id); |
98 cue->parseSettings(settings); | 98 cue->parseSettings(settings); |
99 addCue(cue); | 99 addCue(cue); |
100 } | 100 } |
101 | 101 |
102 } // namespace blink | 102 } // namespace blink |
OLD | NEW |