OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ |
6 #define CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ | 6 #define CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "content/renderer/mouse_lock_dispatcher.h" | 13 #include "content/renderer/mouse_lock_dispatcher.h" |
14 #include "content/renderer/pepper/fullscreen_container.h" | 14 #include "content/renderer/pepper/fullscreen_container.h" |
15 #include "content/renderer/render_widget_fullscreen.h" | 15 #include "content/renderer/render_widget.h" |
16 #include "third_party/WebKit/public/web/WebWidget.h" | 16 #include "third_party/WebKit/public/web/WebWidget.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 class WebLayer; | 20 class WebLayer; |
21 } | 21 } |
22 | 22 |
23 namespace content { | 23 namespace content { |
| 24 class CompositorDependencies; |
24 class PepperPluginInstanceImpl; | 25 class PepperPluginInstanceImpl; |
25 | 26 |
26 // A RenderWidget that hosts a fullscreen pepper plugin. This provides a | 27 // A RenderWidget that hosts a fullscreen pepper plugin. This provides a |
27 // FullscreenContainer that the plugin instance can callback into to e.g. | 28 // FullscreenContainer that the plugin instance can callback into to e.g. |
28 // invalidate rects. | 29 // invalidate rects. |
29 class RenderWidgetFullscreenPepper : public RenderWidgetFullscreen, | 30 class RenderWidgetFullscreenPepper : public RenderWidget, |
30 public FullscreenContainer { | 31 public FullscreenContainer { |
31 public: | 32 public: |
32 static RenderWidgetFullscreenPepper* Create( | 33 static RenderWidgetFullscreenPepper* Create( |
33 int32_t routing_id, | 34 int32_t routing_id, |
34 int32_t opener_id, | 35 const RenderWidget::ShowCallback& show_callback, |
35 CompositorDependencies* compositor_deps, | 36 CompositorDependencies* compositor_deps, |
36 PepperPluginInstanceImpl* plugin, | 37 PepperPluginInstanceImpl* plugin, |
37 const GURL& active_url, | 38 const GURL& active_url, |
38 const ScreenInfo& screen_info); | 39 const ScreenInfo& screen_info); |
39 | 40 |
40 // pepper::FullscreenContainer API. | 41 // pepper::FullscreenContainer API. |
41 void Invalidate() override; | 42 void Invalidate() override; |
42 void InvalidateRect(const blink::WebRect& rect) override; | 43 void InvalidateRect(const blink::WebRect& rect) override; |
43 void ScrollRect(int dx, int dy, const blink::WebRect& rect) override; | 44 void ScrollRect(int dx, int dy, const blink::WebRect& rect) override; |
44 void Destroy() override; | 45 void Destroy() override; |
45 void PepperDidChangeCursor(const blink::WebCursorInfo& cursor) override; | 46 void PepperDidChangeCursor(const blink::WebCursorInfo& cursor) override; |
46 void SetLayer(blink::WebLayer* layer) override; | 47 void SetLayer(blink::WebLayer* layer) override; |
47 | 48 |
48 // IPC::Listener implementation. This overrides the implementation | 49 // RenderWidget overrides. |
49 // in RenderWidgetFullscreen. | |
50 bool OnMessageReceived(const IPC::Message& msg) override; | 50 bool OnMessageReceived(const IPC::Message& msg) override; |
51 | 51 |
52 // Could be NULL when this widget is closing. | 52 // Could be NULL when this widget is closing. |
53 PepperPluginInstanceImpl* plugin() const { return plugin_; } | 53 PepperPluginInstanceImpl* plugin() const { return plugin_; } |
54 | 54 |
55 MouseLockDispatcher* mouse_lock_dispatcher() const { | 55 MouseLockDispatcher* mouse_lock_dispatcher() const { |
56 return mouse_lock_dispatcher_.get(); | 56 return mouse_lock_dispatcher_.get(); |
57 } | 57 } |
58 | 58 |
59 protected: | 59 protected: |
60 RenderWidgetFullscreenPepper(int32_t routing_id, | 60 RenderWidgetFullscreenPepper(int32_t routing_id, |
61 CompositorDependencies* compositor_deps, | 61 CompositorDependencies* compositor_deps, |
62 PepperPluginInstanceImpl* plugin, | 62 PepperPluginInstanceImpl* plugin, |
63 const GURL& active_url, | 63 const GURL& active_url, |
64 const ScreenInfo& screen_info); | 64 const ScreenInfo& screen_info); |
65 ~RenderWidgetFullscreenPepper() override; | 65 ~RenderWidgetFullscreenPepper() override; |
66 | 66 |
67 // RenderWidget API. | 67 // RenderWidget API. |
68 void DidInitiatePaint() override; | 68 void DidInitiatePaint() override; |
69 void Close() override; | 69 void Close() override; |
70 void OnResize(const ResizeParams& params) override; | 70 void OnResize(const ResizeParams& params) override; |
71 | 71 |
72 // RenderWidgetFullscreen API. | |
73 blink::WebWidget* CreateWebWidget() override; | |
74 | |
75 // RenderWidget overrides. | 72 // RenderWidget overrides. |
76 GURL GetURLForGraphicsContext3D() override; | 73 GURL GetURLForGraphicsContext3D() override; |
77 void OnDeviceScaleFactorChanged() override; | 74 void OnDeviceScaleFactorChanged() override; |
78 | 75 |
79 private: | 76 private: |
80 // URL that is responsible for this widget, passed to ggl::CreateViewContext. | 77 // URL that is responsible for this widget, passed to ggl::CreateViewContext. |
81 GURL active_url_; | 78 GURL active_url_; |
82 | 79 |
83 // The plugin instance this widget wraps. | 80 // The plugin instance this widget wraps. |
84 PepperPluginInstanceImpl* plugin_; | 81 PepperPluginInstanceImpl* plugin_; |
85 | 82 |
86 blink::WebLayer* layer_; | 83 blink::WebLayer* layer_; |
87 | 84 |
88 std::unique_ptr<MouseLockDispatcher> mouse_lock_dispatcher_; | 85 std::unique_ptr<MouseLockDispatcher> mouse_lock_dispatcher_; |
89 | 86 |
90 DISALLOW_COPY_AND_ASSIGN(RenderWidgetFullscreenPepper); | 87 DISALLOW_COPY_AND_ASSIGN(RenderWidgetFullscreenPepper); |
91 }; | 88 }; |
92 | 89 |
93 } // namespace content | 90 } // namespace content |
94 | 91 |
95 #endif // CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ | 92 #endif // CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ |
OLD | NEW |