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 "media/blink/texttrack_impl.h" | 5 #include "media/blink/texttrack_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "media/base/bind_to_current_loop.h" | 12 #include "media/base/bind_to_current_loop.h" |
13 #include "media/blink/webinbandtexttrack_impl.h" | 13 #include "media/blink/webinbandtexttrack_impl.h" |
14 #include "third_party/WebKit/public/platform/WebInbandTextTrackClient.h" | 14 #include "third_party/WebKit/public/platform/WebInbandTextTrackClient.h" |
15 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 15 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 | 18 |
19 TextTrackImpl::TextTrackImpl( | 19 TextTrackImpl::TextTrackImpl( |
20 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 20 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
21 blink::WebMediaPlayerClient* client, | 21 blink::WebMediaPlayerClient* client, |
22 scoped_ptr<WebInbandTextTrackImpl> text_track) | 22 std::unique_ptr<WebInbandTextTrackImpl> text_track) |
23 : task_runner_(task_runner), | 23 : task_runner_(task_runner), |
24 client_(client), | 24 client_(client), |
25 text_track_(std::move(text_track)) { | 25 text_track_(std::move(text_track)) { |
26 client_->addTextTrack(text_track_.get()); | 26 client_->addTextTrack(text_track_.get()); |
27 } | 27 } |
28 | 28 |
29 TextTrackImpl::~TextTrackImpl() { | 29 TextTrackImpl::~TextTrackImpl() { |
30 task_runner_->PostTask( | 30 task_runner_->PostTask( |
31 FROM_HERE, | 31 FROM_HERE, |
32 base::Bind(&TextTrackImpl::OnRemoveTrack, | 32 base::Bind(&TextTrackImpl::OnRemoveTrack, |
(...skipping 24 matching lines...) Expand all Loading... |
57 client->addWebVTTCue(start.InSecondsF(), | 57 client->addWebVTTCue(start.InSecondsF(), |
58 end.InSecondsF(), | 58 end.InSecondsF(), |
59 blink::WebString::fromUTF8(id), | 59 blink::WebString::fromUTF8(id), |
60 blink::WebString::fromUTF8(content), | 60 blink::WebString::fromUTF8(content), |
61 blink::WebString::fromUTF8(settings)); | 61 blink::WebString::fromUTF8(settings)); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 void TextTrackImpl::OnRemoveTrack( | 65 void TextTrackImpl::OnRemoveTrack( |
66 blink::WebMediaPlayerClient* client, | 66 blink::WebMediaPlayerClient* client, |
67 scoped_ptr<WebInbandTextTrackImpl> text_track) { | 67 std::unique_ptr<WebInbandTextTrackImpl> text_track) { |
68 if (text_track->client()) | 68 if (text_track->client()) |
69 client->removeTextTrack(text_track.get()); | 69 client->removeTextTrack(text_track.get()); |
70 } | 70 } |
71 | 71 |
72 } // namespace media | 72 } // namespace media |
OLD | NEW |