[email protected] | 29ed96a | 2012-02-04 18:12:16 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 2cff005 | 2011-03-18 16:51:44 | [diff] [blame] | 5 | #ifndef CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ |
| 6 | #define CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 7 | |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 10 | #include <memory> |
| 11 | |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 12 | #include "base/macros.h" |
[email protected] | 8905450 | 2012-06-03 10:29:24 | [diff] [blame] | 13 | #include "content/renderer/mouse_lock_dispatcher.h" |
[email protected] | 20790a22 | 2013-07-25 02:23:05 | [diff] [blame] | 14 | #include "content/renderer/pepper/fullscreen_container.h" |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 15 | #include "content/renderer/render_widget.h" |
[email protected] | 2255a933 | 2013-06-17 05:12:31 | [diff] [blame] | 16 | #include "third_party/WebKit/public/web/WebWidget.h" |
danakj | 870925d4 | 2016-05-03 20:07:38 | [diff] [blame] | 17 | #include "url/gurl.h" |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 18 | |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 19 | namespace blink { |
[email protected] | 9f2bed6 | 2013-03-13 11:24:46 | [diff] [blame] | 20 | class WebLayer; |
[email protected] | ed7defa | 2013-03-12 21:29:59 | [diff] [blame] | 21 | } |
| 22 | |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 23 | namespace content { |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 24 | class CompositorDependencies; |
[email protected] | adab233 | 2013-07-25 18:04:32 | [diff] [blame] | 25 | class PepperPluginInstanceImpl; |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 26 | |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 27 | // A RenderWidget that hosts a fullscreen pepper plugin. This provides a |
| 28 | // FullscreenContainer that the plugin instance can callback into to e.g. |
| 29 | // invalidate rects. |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 30 | class RenderWidgetFullscreenPepper : public RenderWidget, |
[email protected] | adab233 | 2013-07-25 18:04:32 | [diff] [blame] | 31 | public FullscreenContainer { |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 32 | public: |
| 33 | static RenderWidgetFullscreenPepper* Create( |
nick | 8331f8ad | 2016-11-15 20:42:45 | [diff] [blame] | 34 | int32_t routing_id, |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 35 | const RenderWidget::ShowCallback& show_callback, |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 36 | CompositorDependencies* compositor_deps, |
[email protected] | adab233 | 2013-07-25 18:04:32 | [diff] [blame] | 37 | PepperPluginInstanceImpl* plugin, |
[email protected] | bee6eb7 | 2012-07-26 03:47:32 | [diff] [blame] | 38 | const GURL& active_url, |
Dave Tapuska | 1bdf183 | 2017-07-07 18:07:19 | [diff] [blame] | 39 | const ScreenInfo& screen_info, |
| 40 | mojom::WidgetRequest widget_request); |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 41 | |
[email protected] | 92abcb83 | 2011-01-06 20:39:56 | [diff] [blame] | 42 | // pepper::FullscreenContainer API. |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 43 | void Invalidate() override; |
| 44 | void InvalidateRect(const blink::WebRect& rect) override; |
| 45 | void ScrollRect(int dx, int dy, const blink::WebRect& rect) override; |
| 46 | void Destroy() override; |
danakj | 53eccbc | 2016-03-02 22:51:07 | [diff] [blame] | 47 | void PepperDidChangeCursor(const blink::WebCursorInfo& cursor) override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 48 | void SetLayer(blink::WebLayer* layer) override; |
[email protected] | 8905450 | 2012-06-03 10:29:24 | [diff] [blame] | 49 | |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 50 | // RenderWidget overrides. |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 51 | bool OnMessageReceived(const IPC::Message& msg) override; |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 52 | |
[email protected] | a16eb07e | 2011-10-10 05:06:53 | [diff] [blame] | 53 | // Could be NULL when this widget is closing. |
[email protected] | adab233 | 2013-07-25 18:04:32 | [diff] [blame] | 54 | PepperPluginInstanceImpl* plugin() const { return plugin_; } |
[email protected] | a16eb07e | 2011-10-10 05:06:53 | [diff] [blame] | 55 | |
[email protected] | f032afe5 | 2012-10-22 20:24:01 | [diff] [blame] | 56 | MouseLockDispatcher* mouse_lock_dispatcher() const { |
| 57 | return mouse_lock_dispatcher_.get(); |
| 58 | } |
| 59 | |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 60 | protected: |
nick | 8331f8ad | 2016-11-15 20:42:45 | [diff] [blame] | 61 | RenderWidgetFullscreenPepper(int32_t routing_id, |
| 62 | CompositorDependencies* compositor_deps, |
dcheng | 35d31c11 | 2015-07-22 00:17:36 | [diff] [blame] | 63 | PepperPluginInstanceImpl* plugin, |
[email protected] | bee6eb7 | 2012-07-26 03:47:32 | [diff] [blame] | 64 | const GURL& active_url, |
Dave Tapuska | 1bdf183 | 2017-07-07 18:07:19 | [diff] [blame] | 65 | const ScreenInfo& screen_info, |
| 66 | mojom::WidgetRequest widget_request); |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 67 | ~RenderWidgetFullscreenPepper() override; |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 68 | |
| 69 | // RenderWidget API. |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 70 | void DidInitiatePaint() override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 71 | void Close() override; |
fsamuel | 664e8b6 | 2016-01-20 19:54:01 | [diff] [blame] | 72 | void OnResize(const ResizeParams& params) override; |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 73 | |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 74 | // RenderWidget overrides. |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 75 | GURL GetURLForGraphicsContext3D() override; |
oshima | 131114a | 2016-02-28 05:42:57 | [diff] [blame] | 76 | void OnDeviceScaleFactorChanged() override; |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 77 | |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 78 | private: |
[email protected] | d91233b7e | 2011-03-29 20:33:53 | [diff] [blame] | 79 | // URL that is responsible for this widget, passed to ggl::CreateViewContext. |
| 80 | GURL active_url_; |
| 81 | |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 82 | // The plugin instance this widget wraps. |
[email protected] | adab233 | 2013-07-25 18:04:32 | [diff] [blame] | 83 | PepperPluginInstanceImpl* plugin_; |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 84 | |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 85 | blink::WebLayer* layer_; |
[email protected] | 22f320a | 2011-08-30 01:17:00 | [diff] [blame] | 86 | |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 87 | std::unique_ptr<MouseLockDispatcher> mouse_lock_dispatcher_; |
[email protected] | 8905450 | 2012-06-03 10:29:24 | [diff] [blame] | 88 | |
[email protected] | 79c7bed | 2010-09-14 22:28:39 | [diff] [blame] | 89 | DISALLOW_COPY_AND_ASSIGN(RenderWidgetFullscreenPepper); |
| 90 | }; |
| 91 | |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 92 | } // namespace content |
| 93 | |
[email protected] | 2cff005 | 2011-03-18 16:51:44 | [diff] [blame] | 94 | #endif // CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ |