1 // Copyright 2016 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_PLAYER_RENDERER_HOST_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_PLAYER_RENDERER_HOST_H_
11 #include "base/memory/weak_ptr.h"
12 #include "cc/layers/video_layer.h"
13 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
14 #include "media/blink/video_frame_compositor.h"
15 #include "ppapi/c/pp_rect.h"
16 #include "ppapi/c/samsung/pp_media_player_samsung.h"
17 #include "ppapi/host/resource_host.h"
18 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
19 #include "ui/gfx/geometry/size.h"
20 #include "ui/gfx/geometry/rect.h"
29 class RendererPpapiHost;
31 class PepperMediaPlayerRendererHost
32 : public ppapi::host::ResourceHost,
33 public PepperPluginInstanceImpl::GeometryChangeListener {
35 PepperMediaPlayerRendererHost(RendererPpapiHost*,
39 virtual ~PepperMediaPlayerRendererHost();
41 // PepperPluginInstanceImpl::GeometryChangeListener implementation
42 void GeometryDidChange(const PP_Rect&) override;
44 bool IsMediaPlayerRendererHost() override;
45 void ViewInitiatedPaint();
46 bool BindToInstance(PepperPluginInstanceImpl* new_instance);
48 scoped_refptr<cc::VideoLayer> video_layer() { return video_layer_; }
51 PepperPluginInstanceImpl* GetPluginInstance();
53 // Update video rect position on the brwoser-side player host. This methods
54 // initiates an IPC data exchange with BROWSER process.
55 void UpdateVideoPosition(PepperPluginInstanceImpl* plugin,
56 const PP_Rect& hole_rect,
57 const PP_Rect& clip_rect);
60 void OnDrawableContentRectChanged(gfx::Rect rect);
62 RendererPpapiHost* renderer_ppapi_host_;
63 PepperPluginInstanceImpl* bound_instance_;
64 base::WeakPtrFactory<PepperMediaPlayerRendererHost> factory_;
66 scoped_refptr<cc::VideoLayer> video_layer_;
67 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
68 media::VideoFrameCompositor* compositor_;
70 DISALLOW_COPY_AND_ASSIGN(PepperMediaPlayerRendererHost);
73 } // namespace content
75 #endif // CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_PLAYER_RENDERER_HOST_H_