| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "content/renderer/pepper_parent_context_provider.h" | 9 #include "content/renderer/pepper_parent_context_provider.h" |
| 10 #include "content/renderer/render_widget_fullscreen.h" | 10 #include "content/renderer/render_widget_fullscreen.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class RenderWidgetFullscreenPepper : public RenderWidgetFullscreen, | 26 class RenderWidgetFullscreenPepper : public RenderWidgetFullscreen, |
| 27 public webkit::ppapi::FullscreenContainer, | 27 public webkit::ppapi::FullscreenContainer, |
| 28 public PepperParentContextProvider { | 28 public PepperParentContextProvider { |
| 29 public: | 29 public: |
| 30 static RenderWidgetFullscreenPepper* Create( | 30 static RenderWidgetFullscreenPepper* Create( |
| 31 int32 opener_id, | 31 int32 opener_id, |
| 32 webkit::ppapi::PluginInstance* plugin, | 32 webkit::ppapi::PluginInstance* plugin, |
| 33 const GURL& active_url); | 33 const GURL& active_url); |
| 34 | 34 |
| 35 // pepper::FullscreenContainer API. | 35 // pepper::FullscreenContainer API. |
| 36 virtual void Invalidate(); | 36 virtual void Invalidate() OVERRIDE; |
| 37 virtual void InvalidateRect(const WebKit::WebRect& rect); | 37 virtual void InvalidateRect(const WebKit::WebRect& rect) OVERRIDE; |
| 38 virtual void ScrollRect(int dx, int dy, const WebKit::WebRect& rect); | 38 virtual void ScrollRect(int dx, int dy, const WebKit::WebRect& rect) OVERRIDE; |
| 39 virtual void Destroy(); | 39 virtual void Destroy() OVERRIDE; |
| 40 virtual void DidChangeCursor(const WebKit::WebCursorInfo& cursor); | 40 virtual void DidChangeCursor(const WebKit::WebCursorInfo& cursor) OVERRIDE; |
| 41 virtual webkit::ppapi::PluginDelegate::PlatformContext3D* CreateContext3D(); | 41 virtual webkit::ppapi::PluginDelegate::PlatformContext3D* |
| 42 CreateContext3D() OVERRIDE; |
| 42 | 43 |
| 43 RendererGLContext* context() const { return context_; } | 44 RendererGLContext* context() const { return context_; } |
| 44 void SwapBuffers(); | 45 void SwapBuffers(); |
| 45 | 46 |
| 46 // Could be NULL when this widget is closing. | 47 // Could be NULL when this widget is closing. |
| 47 webkit::ppapi::PluginInstance* plugin() const { return plugin_; } | 48 webkit::ppapi::PluginInstance* plugin() const { return plugin_; } |
| 48 | 49 |
| 49 protected: | 50 protected: |
| 50 RenderWidgetFullscreenPepper(webkit::ppapi::PluginInstance* plugin, | 51 RenderWidgetFullscreenPepper(webkit::ppapi::PluginInstance* plugin, |
| 51 const GURL& active_url); | 52 const GURL& active_url); |
| 52 virtual ~RenderWidgetFullscreenPepper(); | 53 virtual ~RenderWidgetFullscreenPepper(); |
| 53 | 54 |
| 54 // RenderWidget API. | 55 // RenderWidget API. |
| 55 virtual void DidInitiatePaint(); | 56 virtual void DidInitiatePaint() OVERRIDE; |
| 56 virtual void DidFlushPaint(); | 57 virtual void DidFlushPaint() OVERRIDE; |
| 57 virtual void Close(); | 58 virtual void Close() OVERRIDE; |
| 58 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint( | 59 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint( |
| 59 const gfx::Rect& paint_bounds, | 60 const gfx::Rect& paint_bounds, |
| 60 TransportDIB** dib, | 61 TransportDIB** dib, |
| 61 gfx::Rect* location, | 62 gfx::Rect* location, |
| 62 gfx::Rect* clip); | 63 gfx::Rect* clip) OVERRIDE; |
| 63 virtual void OnResize(const gfx::Size& new_size, | 64 virtual void OnResize(const gfx::Size& new_size, |
| 64 const gfx::Rect& resizer_rect, | 65 const gfx::Rect& resizer_rect, |
| 65 bool is_fullscreen); | 66 bool is_fullscreen) OVERRIDE; |
| 66 | 67 |
| 67 // RenderWidgetFullscreen API. | 68 // RenderWidgetFullscreen API. |
| 68 virtual WebKit::WebWidget* CreateWebWidget(); | 69 virtual WebKit::WebWidget* CreateWebWidget() OVERRIDE; |
| 69 | 70 |
| 70 // RenderWidget overrides. | 71 // RenderWidget overrides. |
| 71 virtual bool SupportsAsynchronousSwapBuffers() OVERRIDE; | 72 virtual bool SupportsAsynchronousSwapBuffers() OVERRIDE; |
| 72 | 73 |
| 73 private: | 74 private: |
| 74 // Creates the GL context for compositing. | 75 // Creates the GL context for compositing. |
| 75 void CreateContext(); | 76 void CreateContext(); |
| 76 | 77 |
| 77 // Initialize the GL states and resources for compositing. | 78 // Initialize the GL states and resources for compositing. |
| 78 bool InitContext(); | 79 bool InitContext(); |
| 79 | 80 |
| 80 // Checks (and returns) whether accelerated compositing should be on or off, | 81 // Checks (and returns) whether accelerated compositing should be on or off, |
| 81 // and notify the browser. | 82 // and notify the browser. |
| 82 bool CheckCompositing(); | 83 bool CheckCompositing(); |
| 83 | 84 |
| 84 // Called when the compositing context gets lost. | 85 // Called when the compositing context gets lost. |
| 85 void OnLostContext(RendererGLContext::ContextLostReason); | 86 void OnLostContext(RendererGLContext::ContextLostReason); |
| 86 | 87 |
| 87 // Binding of RendererGLContext swapbuffers callback to | 88 // Binding of RendererGLContext swapbuffers callback to |
| 88 // RenderWidget::OnSwapBuffersCompleted. | 89 // RenderWidget::OnSwapBuffersCompleted. |
| 89 void OnSwapBuffersCompleteByRendererGLContext(); | 90 void OnSwapBuffersCompleteByRendererGLContext(); |
| 90 | 91 |
| 91 // Implementation of PepperParentContextProvider. | 92 // Implementation of PepperParentContextProvider. |
| 92 virtual RendererGLContext* GetParentContextForPlatformContext3D(); | 93 virtual RendererGLContext* GetParentContextForPlatformContext3D() OVERRIDE; |
| 93 | 94 |
| 94 // URL that is responsible for this widget, passed to ggl::CreateViewContext. | 95 // URL that is responsible for this widget, passed to ggl::CreateViewContext. |
| 95 GURL active_url_; | 96 GURL active_url_; |
| 96 | 97 |
| 97 // The plugin instance this widget wraps. | 98 // The plugin instance this widget wraps. |
| 98 webkit::ppapi::PluginInstance* plugin_; | 99 webkit::ppapi::PluginInstance* plugin_; |
| 99 | 100 |
| 100 // GL context for compositing. | 101 // GL context for compositing. |
| 101 RendererGLContext* context_; | 102 RendererGLContext* context_; |
| 102 unsigned int buffer_; | 103 unsigned int buffer_; |
| 103 unsigned int program_; | 104 unsigned int program_; |
| 104 | 105 |
| 105 base::WeakPtrFactory<RenderWidgetFullscreenPepper> weak_ptr_factory_; | 106 base::WeakPtrFactory<RenderWidgetFullscreenPepper> weak_ptr_factory_; |
| 106 | 107 |
| 107 DISALLOW_COPY_AND_ASSIGN(RenderWidgetFullscreenPepper); | 108 DISALLOW_COPY_AND_ASSIGN(RenderWidgetFullscreenPepper); |
| 108 }; | 109 }; |
| 109 | 110 |
| 110 #endif // CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ | 111 #endif // CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ |
| OLD | NEW |