summaryrefslogtreecommitdiffstats
path: root/content/renderer/media/texttrack_impl.h
blob: 3285b60ed1021c4f67281cc350cac4019b0125e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_RENDERER_MEDIA_TEXTTRACK_IMPL_H_
#define CONTENT_RENDERER_MEDIA_TEXTTRACK_IMPL_H_

#include <string>

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "media/base/text_track.h"

namespace base {
class MessageLoopProxy;
}

namespace blink {
class WebInbandTextTrackClient;
class WebMediaPlayerClient;
}

namespace content {

class WebInbandTextTrackImpl;

class TextTrackImpl : public media::TextTrack {
 public:
  // Constructor assumes ownership of the |text_track| object.
  TextTrackImpl(const scoped_refptr<base::MessageLoopProxy>& message_loop,
                blink::WebMediaPlayerClient* client,
                scoped_ptr<WebInbandTextTrackImpl> text_track);

  virtual ~TextTrackImpl();

  virtual void addWebVTTCue(const base::TimeDelta& start,
                            const base::TimeDelta& end,
                            const std::string& id,
                            const std::string& content,
                            const std::string& settings) OVERRIDE;

 private:
  static void OnAddCue(WebInbandTextTrackImpl* text_track,
                       const base::TimeDelta& start,
                       const base::TimeDelta& end,
                       const std::string& id,
                       const std::string& content,
                       const std::string& settings);

  static void OnRemoveTrack(blink::WebMediaPlayerClient* client,
                            scoped_ptr<WebInbandTextTrackImpl> text_track);

  scoped_refptr<base::MessageLoopProxy> message_loop_;
  blink::WebMediaPlayerClient* client_;
  scoped_ptr<WebInbandTextTrackImpl> text_track_;
  DISALLOW_COPY_AND_ASSIGN(TextTrackImpl);
};

}  // namespace content

#endif  // CONTENT_RENDERER_MEDIA_TEXTTRACK_IMPL_H_