1 // Copyright (c) 2012 The Chromium Authors. 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_RENDER_WIDGET_FULLSCREEN_PEPPER_H_
6 #define CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/renderer/mouse_lock_dispatcher.h"
10 #include "content/renderer/pepper/fullscreen_container.h"
11 #include "content/renderer/render_widget_fullscreen.h"
12 #include "third_party/WebKit/public/web/WebWidget.h"
19 class PepperPluginInstanceImpl
;
21 // A RenderWidget that hosts a fullscreen pepper plugin. This provides a
22 // FullscreenContainer that the plugin instance can callback into to e.g.
24 class RenderWidgetFullscreenPepper
: public RenderWidgetFullscreen
,
25 public FullscreenContainer
{
27 static RenderWidgetFullscreenPepper
* Create(
29 PepperPluginInstanceImpl
* plugin
,
30 const GURL
& active_url
,
31 const blink::WebScreenInfo
& screen_info
);
33 // pepper::FullscreenContainer API.
34 void Invalidate() override
;
35 void InvalidateRect(const blink::WebRect
& rect
) override
;
36 void ScrollRect(int dx
, int dy
, const blink::WebRect
& rect
) override
;
37 void Destroy() override
;
38 void DidChangeCursor(const blink::WebCursorInfo
& cursor
) override
;
39 void SetLayer(blink::WebLayer
* layer
) override
;
41 // IPC::Listener implementation. This overrides the implementation
42 // in RenderWidgetFullscreen.
43 bool OnMessageReceived(const IPC::Message
& msg
) override
;
45 // Could be NULL when this widget is closing.
46 PepperPluginInstanceImpl
* plugin() const { return plugin_
; }
48 MouseLockDispatcher
* mouse_lock_dispatcher() const {
49 return mouse_lock_dispatcher_
.get();
53 RenderWidgetFullscreenPepper(PepperPluginInstanceImpl
* plugin
,
54 const GURL
& active_url
,
55 const blink::WebScreenInfo
& screen_info
);
56 ~RenderWidgetFullscreenPepper() override
;
59 void DidInitiatePaint() override
;
60 void DidFlushPaint() override
;
61 void Close() override
;
62 void OnResize(const ViewMsg_Resize_Params
& params
) override
;
64 // RenderWidgetFullscreen API.
65 blink::WebWidget
* CreateWebWidget() override
;
67 // RenderWidget overrides.
68 GURL
GetURLForGraphicsContext3D() override
;
69 void SetDeviceScaleFactor(float device_scale_factor
) override
;
72 // URL that is responsible for this widget, passed to ggl::CreateViewContext.
75 // The plugin instance this widget wraps.
76 PepperPluginInstanceImpl
* plugin_
;
78 blink::WebLayer
* layer_
;
80 scoped_ptr
<MouseLockDispatcher
> mouse_lock_dispatcher_
;
82 DISALLOW_COPY_AND_ASSIGN(RenderWidgetFullscreenPepper
);
85 } // namespace content
87 #endif // CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_