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
83
84
85
86
87
88
89
90
|
// Copyright (c) 2012 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_WEBMEDIAPLAYER_PROXY_IMPL_ANDROID_H_
#define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_PROXY_IMPL_ANDROID_H_
#include <map>
#include "content/public/renderer/render_view_observer.h"
#include "webkit/media/android/webmediaplayer_proxy_android.h"
namespace webkit_media {
class WebMediaPlayerAndroid;
class WebMediaPlayerManagerAndroid;
}
namespace content {
// This class manages all the IPC communications between
// WebMediaPlayerAndroid and the MediaPlayerManagerAndroid in the browser
// process.
class WebMediaPlayerProxyImplAndroid
: public RenderViewObserver,
public webkit_media::WebMediaPlayerProxyAndroid {
public:
// Construct a WebMediaPlayerProxyImplAndroid object for the |render_view|.
// |manager| is passed to this class so that it can find the right
// WebMediaPlayerAndroid using player IDs.
WebMediaPlayerProxyImplAndroid(
RenderView* render_view,
webkit_media::WebMediaPlayerManagerAndroid* manager);
virtual ~WebMediaPlayerProxyImplAndroid();
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
// Methods inherited from WebMediaPlayerProxyAndroid.
virtual void Initialize(int player_id, const GURL& url,
bool is_media_source,
const GURL& first_party_for_cookies) OVERRIDE;
virtual void Start(int player_id) OVERRIDE;
virtual void Pause(int player_id) OVERRIDE;
virtual void Seek(int player_id, base::TimeDelta time) OVERRIDE;
virtual void ReleaseResources(int player_id) OVERRIDE;
virtual void DestroyPlayer(int player_id) OVERRIDE;
virtual void EnterFullscreen(int player_id) OVERRIDE;
virtual void ExitFullscreen(int player_id) OVERRIDE;
#if defined(GOOGLE_TV)
virtual void RequestExternalSurface(int player_id) OVERRIDE;
virtual void DemuxerReady(
int player_id,
const media::MediaPlayerHostMsg_DemuxerReady_Params& params) OVERRIDE;
virtual void ReadFromDemuxerAck(
int player_id,
const media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params&) OVERRIDE;
// Methods inherited from RenderViewObserver.
virtual void DidCommitCompositorFrame() OVERRIDE;
#endif
private:
webkit_media::WebMediaPlayerAndroid* GetWebMediaPlayer(int player_id);
// Message handlers.
void OnMediaMetadataChanged(int player_id, base::TimeDelta duration,
int width, int height, bool success);
void OnMediaPlaybackCompleted(int player_id);
void OnMediaBufferingUpdate(int player_id, int percent);
void OnMediaSeekCompleted(int player_id, base::TimeDelta current_time);
void OnMediaError(int player_id, int error);
void OnVideoSizeChanged(int player_id, int width, int height);
void OnTimeUpdate(int player_id, base::TimeDelta current_time);
void OnMediaPlayerReleased(int player_id);
void OnDidExitFullscreen(int player_id);
void OnDidEnterFullscreen(int player_id);
void OnPlayerPlay(int player_id);
void OnPlayerPause(int player_id);
#if defined(GOOGLE_TV)
void OnReadFromDemuxer(
int player_id, media::DemuxerStream::Type type, bool seek_done);
#endif
webkit_media::WebMediaPlayerManagerAndroid* manager_;
DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerProxyImplAndroid);
};
} // namespace content
#endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_PROXY_IMPL_ANDROID_H_
|