summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webmediaplayer_impl.h
blob: ddbdc16b31abb9f9d372cb0160ba2ccb758a3c8f (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright (c) 2008 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.
//
// Wrapper over WebCore::MediaPlayerPrivate. It also would handle resource 
// loading for the internal media player.

#ifndef WEBKIT_GLUE_WEBMEDIAPLAYER_IMPL_H_
#define WEBKIT_GLUE_WEBMEDIAPLAYER_IMPL_H_

#include "ResourceHandleClient.h"

#include "webkit/glue/webmediaplayer.h"

#if ENABLE(VIDEO)

namespace WebCore {
class MediaPlayerPrivate;
class ResourceHandle;
}

namespace webkit_glue {

class WebMediaPlayerDelegate;

class WebMediaPlayerImpl : public WebMediaPlayer,
                           WebCore::ResourceHandleClient {
public:
  WebMediaPlayerImpl(WebCore::MediaPlayerPrivate* media_player_private);

  virtual ~WebMediaPlayerImpl();

  virtual void Initialize(WebMediaPlayerDelegate* delegate);

  // Get the web frame associated with the media player
  virtual WebFrame* GetWebFrame();
  
  // Notify the media player about network state change.
  virtual void NotifynetworkStateChange();

  // Notify the media player about ready state change.
  virtual void NotifyReadyStateChange();

  // Notify the media player about time change.
  virtual void NotifyTimeChange();

  // Notify the media player about volume change.
  virtual void NotifyVolumeChange();

  // Tell the media player to repaint itself.
  virtual void Repaint();

  // Load a media resource.
  virtual void LoadMediaResource(const GURL& url);

  // Cancel loading the media resource.
  virtual void CancelLoad();

  // ResourceHandleClient methods
  void willSendRequest(WebCore::ResourceHandle* handle,
                       WebCore::ResourceRequest& request,
                       const WebCore::ResourceResponse&);
  void didReceiveResponse(WebCore::ResourceHandle* handle,
                          const WebCore::ResourceResponse& response);
  void didReceiveData(WebCore::ResourceHandle* handle, const char *buffer,
                      int length, int);
  void didFinishLoading(WebCore::ResourceHandle* handle);
  void didFail(WebCore::ResourceHandle* handle, const WebCore::ResourceError&);

private:
  WebCore::MediaPlayerPrivate* media_player_private_;
  WebMediaPlayerDelegate* delegate_;
  RefPtr<WebCore::ResourceHandle> resource_handle_;

  DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
};

}  // namespace webkit_glue

#endif // ENABLE(VIDEO)

#endif // ifndef WEBKIT_GLUE_WEBMEDIAPLAYER_H_