| 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 "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 11 #include "content/renderer/mouse_lock_dispatcher.h" | 11 #include "content/renderer/mouse_lock_dispatcher.h" |
| 12 #include "content/renderer/pepper/pepper_parent_context_provider.h" | |
| 13 #include "content/renderer/render_widget_fullscreen.h" | 12 #include "content/renderer/render_widget_fullscreen.h" |
| 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" |
| 16 #include "webkit/plugins/ppapi/fullscreen_container.h" | 15 #include "webkit/plugins/ppapi/fullscreen_container.h" |
| 17 | 16 |
| 18 namespace webkit { | 17 namespace webkit { |
| 19 namespace ppapi { | 18 namespace ppapi { |
| 20 | 19 |
| 21 class PluginInstance; | 20 class PluginInstance; |
| 22 | 21 |
| 23 } // namespace ppapi | 22 } // namespace ppapi |
| 24 } // namespace webkit | 23 } // namespace webkit |
| 25 | 24 |
| 26 namespace content { | 25 namespace content { |
| 27 class WebGraphicsContext3DCommandBufferImpl; | 26 class WebGraphicsContext3DCommandBufferImpl; |
| 28 | 27 |
| 29 // A RenderWidget that hosts a fullscreen pepper plugin. This provides a | 28 // A RenderWidget that hosts a fullscreen pepper plugin. This provides a |
| 30 // FullscreenContainer that the plugin instance can callback into to e.g. | 29 // FullscreenContainer that the plugin instance can callback into to e.g. |
| 31 // invalidate rects. | 30 // invalidate rects. |
| 32 class RenderWidgetFullscreenPepper : | 31 class RenderWidgetFullscreenPepper : |
| 33 public RenderWidgetFullscreen, | 32 public RenderWidgetFullscreen, |
| 34 public webkit::ppapi::FullscreenContainer, | 33 public webkit::ppapi::FullscreenContainer, |
| 35 public PepperParentContextProvider, | |
| 36 public WebGraphicsContext3DSwapBuffersClient { | 34 public WebGraphicsContext3DSwapBuffersClient { |
| 37 public: | 35 public: |
| 38 static RenderWidgetFullscreenPepper* Create( | 36 static RenderWidgetFullscreenPepper* Create( |
| 39 int32 opener_id, | 37 int32 opener_id, |
| 40 webkit::ppapi::PluginInstance* plugin, | 38 webkit::ppapi::PluginInstance* plugin, |
| 41 const GURL& active_url, | 39 const GURL& active_url, |
| 42 const WebKit::WebScreenInfo& screen_info); | 40 const WebKit::WebScreenInfo& screen_info); |
| 43 | 41 |
| 44 // WebGraphicscontext3DSwapBuffersClient implementation | 42 // WebGraphicscontext3DSwapBuffersClient implementation |
| 45 virtual void OnViewContextSwapBuffersPosted() OVERRIDE; | 43 virtual void OnViewContextSwapBuffersPosted() OVERRIDE; |
| 46 virtual void OnViewContextSwapBuffersComplete() OVERRIDE; | 44 virtual void OnViewContextSwapBuffersComplete() OVERRIDE; |
| 47 virtual void OnViewContextSwapBuffersAborted() OVERRIDE; | 45 virtual void OnViewContextSwapBuffersAborted() OVERRIDE; |
| 48 | 46 |
| 49 // pepper::FullscreenContainer API. | 47 // pepper::FullscreenContainer API. |
| 50 virtual void Invalidate() OVERRIDE; | 48 virtual void Invalidate() OVERRIDE; |
| 51 virtual void InvalidateRect(const WebKit::WebRect& rect) OVERRIDE; | 49 virtual void InvalidateRect(const WebKit::WebRect& rect) OVERRIDE; |
| 52 virtual void ScrollRect(int dx, int dy, const WebKit::WebRect& rect) OVERRIDE; | 50 virtual void ScrollRect(int dx, int dy, const WebKit::WebRect& rect) OVERRIDE; |
| 53 virtual void Destroy() OVERRIDE; | 51 virtual void Destroy() OVERRIDE; |
| 54 virtual void DidChangeCursor(const WebKit::WebCursorInfo& cursor) OVERRIDE; | 52 virtual void DidChangeCursor(const WebKit::WebCursorInfo& cursor) OVERRIDE; |
| 55 virtual webkit::ppapi::PluginDelegate::PlatformContext3D* | 53 virtual webkit::ppapi::PluginDelegate::PlatformContext3D* |
| 56 CreateContext3D() OVERRIDE; | 54 CreateContext3D() OVERRIDE; |
| 57 virtual void ReparentContext( | |
| 58 webkit::ppapi::PluginDelegate::PlatformContext3D*) OVERRIDE; | |
| 59 | 55 |
| 60 // IPC::Listener implementation. This overrides the implementation | 56 // IPC::Listener implementation. This overrides the implementation |
| 61 // in RenderWidgetFullscreen. | 57 // in RenderWidgetFullscreen. |
| 62 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 58 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 63 | 59 |
| 64 WebGraphicsContext3DCommandBufferImpl* context() const { return context_; } | 60 WebGraphicsContext3DCommandBufferImpl* context() const { return context_; } |
| 65 void SwapBuffers(); | 61 void SwapBuffers(); |
| 66 | 62 |
| 67 // Could be NULL when this widget is closing. | 63 // Could be NULL when this widget is closing. |
| 68 webkit::ppapi::PluginInstance* plugin() const { return plugin_; } | 64 webkit::ppapi::PluginInstance* plugin() const { return plugin_; } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Creates the GL context for compositing. | 100 // Creates the GL context for compositing. |
| 105 void CreateContext(); | 101 void CreateContext(); |
| 106 | 102 |
| 107 // Initialize the GL states and resources for compositing. | 103 // Initialize the GL states and resources for compositing. |
| 108 bool InitContext(); | 104 bool InitContext(); |
| 109 | 105 |
| 110 // Checks (and returns) whether accelerated compositing should be on or off, | 106 // Checks (and returns) whether accelerated compositing should be on or off, |
| 111 // and notify the browser. | 107 // and notify the browser. |
| 112 bool CheckCompositing(); | 108 bool CheckCompositing(); |
| 113 | 109 |
| 114 // Implementation of PepperParentContextProvider. | |
| 115 virtual WebGraphicsContext3DCommandBufferImpl* | |
| 116 GetParentContextForPlatformContext3D() OVERRIDE; | |
| 117 | |
| 118 // URL that is responsible for this widget, passed to ggl::CreateViewContext. | 110 // URL that is responsible for this widget, passed to ggl::CreateViewContext. |
| 119 GURL active_url_; | 111 GURL active_url_; |
| 120 | 112 |
| 121 // The plugin instance this widget wraps. | 113 // The plugin instance this widget wraps. |
| 122 webkit::ppapi::PluginInstance* plugin_; | 114 webkit::ppapi::PluginInstance* plugin_; |
| 123 | 115 |
| 124 // GL context for compositing. | 116 // GL context for compositing. |
| 125 WebGraphicsContext3DCommandBufferImpl* context_; | 117 WebGraphicsContext3DCommandBufferImpl* context_; |
| 126 unsigned int buffer_; | 118 unsigned int buffer_; |
| 127 unsigned int program_; | 119 unsigned int program_; |
| 128 | 120 |
| 129 base::WeakPtrFactory<RenderWidgetFullscreenPepper> weak_ptr_factory_; | 121 base::WeakPtrFactory<RenderWidgetFullscreenPepper> weak_ptr_factory_; |
| 130 | 122 |
| 131 scoped_ptr<MouseLockDispatcher> mouse_lock_dispatcher_; | 123 scoped_ptr<MouseLockDispatcher> mouse_lock_dispatcher_; |
| 132 | 124 |
| 133 DISALLOW_COPY_AND_ASSIGN(RenderWidgetFullscreenPepper); | 125 DISALLOW_COPY_AND_ASSIGN(RenderWidgetFullscreenPepper); |
| 134 }; | 126 }; |
| 135 | 127 |
| 136 } // namespace content | 128 } // namespace content |
| 137 | 129 |
| 138 #endif // CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ | 130 #endif // CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ |
| OLD | NEW |