OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/media/texttrack_impl.h" | 5 #include "content/renderer/media/texttrack_impl.h" |
6 | 6 |
7 #include "content/renderer/media/webinbandtexttrack_impl.h" | 7 #include "content/renderer/media/webinbandtexttrack_impl.h" |
8 #include "third_party/WebKit/public/web/WebInbandTextTrackClient.h" | 8 #include "third_party/WebKit/public/platform/WebInbandTextTrackClient.h" |
9 #include "third_party/WebKit/public/web/WebMediaPlayerClient.h" | 9 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 TextTrackImpl::TextTrackImpl(blink::WebMediaPlayerClient* client, | 13 TextTrackImpl::TextTrackImpl(blink::WebMediaPlayerClient* client, |
14 WebInbandTextTrackImpl* text_track) | 14 WebInbandTextTrackImpl* text_track) |
15 : client_(client), text_track_(text_track) { | 15 : client_(client), text_track_(text_track) { |
16 client_->addTextTrack(text_track_.get()); | 16 client_->addTextTrack(text_track_.get()); |
17 } | 17 } |
18 | 18 |
19 TextTrackImpl::~TextTrackImpl() { | 19 TextTrackImpl::~TextTrackImpl() { |
20 if (text_track_->client()) | 20 if (text_track_->client()) |
21 client_->removeTextTrack(text_track_.get()); | 21 client_->removeTextTrack(text_track_.get()); |
22 } | 22 } |
23 | 23 |
24 void TextTrackImpl::addWebVTTCue(const base::TimeDelta& start, | 24 void TextTrackImpl::addWebVTTCue(const base::TimeDelta& start, |
25 const base::TimeDelta& end, | 25 const base::TimeDelta& end, |
26 const std::string& id, | 26 const std::string& id, |
27 const std::string& content, | 27 const std::string& content, |
28 const std::string& settings) { | 28 const std::string& settings) { |
29 if (blink::WebInbandTextTrackClient* client = text_track_->client()) | 29 if (blink::WebInbandTextTrackClient* client = text_track_->client()) |
30 client->addWebVTTCue(start.InSecondsF(), | 30 client->addWebVTTCue(start.InSecondsF(), |
31 end.InSecondsF(), | 31 end.InSecondsF(), |
32 blink::WebString::fromUTF8(id), | 32 blink::WebString::fromUTF8(id), |
33 blink::WebString::fromUTF8(content), | 33 blink::WebString::fromUTF8(content), |
34 blink::WebString::fromUTF8(settings)); | 34 blink::WebString::fromUTF8(settings)); |
35 } | 35 } |
36 | 36 |
37 } // namespace content | 37 } // namespace content |
OLD | NEW |