| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 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. | |
| 4 | |
| 5 #ifndef CHROME_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ | |
| 6 #define CHROME_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ | |
| 7 | |
| 8 #include "chrome/renderer/render_widget_fullscreen.h" | |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" | |
| 10 #include "webkit/plugins/ppapi/fullscreen_container.h" | |
| 11 | |
| 12 namespace webkit { | |
| 13 namespace ppapi { | |
| 14 | |
| 15 class PluginInstance; | |
| 16 | |
| 17 } // namespace ppapi | |
| 18 } // namespace webkit | |
| 19 | |
| 20 namespace ggl { | |
| 21 class Context; | |
| 22 } // namespace ggl | |
| 23 | |
| 24 // A RenderWidget that hosts a fullscreen pepper plugin. This provides a | |
| 25 // FullscreenContainer that the plugin instance can callback into to e.g. | |
| 26 // invalidate rects. | |
| 27 class RenderWidgetFullscreenPepper : public RenderWidgetFullscreen, | |
| 28 public webkit::ppapi::FullscreenContainer { | |
| 29 public: | |
| 30 static RenderWidgetFullscreenPepper* Create( | |
| 31 int32 opener_id, | |
| 32 RenderThreadBase* render_thread, | |
| 33 webkit::ppapi::PluginInstance* plugin); | |
| 34 | |
| 35 // pepper::FullscreenContainer API. | |
| 36 virtual void Invalidate(); | |
| 37 virtual void InvalidateRect(const WebKit::WebRect& rect); | |
| 38 virtual void ScrollRect(int dx, int dy, const WebKit::WebRect& rect); | |
| 39 virtual void Destroy(); | |
| 40 virtual webkit::ppapi::PluginDelegate::PlatformContext3D* CreateContext3D(); | |
| 41 | |
| 42 ggl::Context* context() const { return context_; } | |
| 43 | |
| 44 protected: | |
| 45 RenderWidgetFullscreenPepper(RenderThreadBase* render_thread, | |
| 46 webkit::ppapi::PluginInstance* plugin); | |
| 47 virtual ~RenderWidgetFullscreenPepper(); | |
| 48 | |
| 49 // RenderWidget API. | |
| 50 virtual void DidInitiatePaint(); | |
| 51 virtual void DidFlushPaint(); | |
| 52 virtual void Close(); | |
| 53 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint( | |
| 54 const gfx::Rect& paint_bounds, | |
| 55 TransportDIB** dib, | |
| 56 gfx::Rect* location, | |
| 57 gfx::Rect* clip); | |
| 58 virtual void OnResize(const gfx::Size& new_size, | |
| 59 const gfx::Rect& resizer_rect); | |
| 60 | |
| 61 // RenderWidgetFullscreen API. | |
| 62 virtual WebKit::WebWidget* CreateWebWidget(); | |
| 63 | |
| 64 private: | |
| 65 // Creates the GL context for compositing. | |
| 66 void CreateContext(); | |
| 67 | |
| 68 // Destroys the GL context for compositing. | |
| 69 void DestroyContext(); | |
| 70 | |
| 71 // Initialize the GL states and resources for compositing. | |
| 72 bool InitContext(); | |
| 73 | |
| 74 // Checks (and returns) whether accelerated compositing should be on or off, | |
| 75 // and notify the browser. | |
| 76 bool CheckCompositing(); | |
| 77 | |
| 78 // The plugin instance this widget wraps. | |
| 79 webkit::ppapi::PluginInstance* plugin_; | |
| 80 | |
| 81 // GL context for compositing. | |
| 82 ggl::Context* context_; | |
| 83 unsigned int buffer_; | |
| 84 unsigned int program_; | |
| 85 | |
| 86 DISALLOW_COPY_AND_ASSIGN(RenderWidgetFullscreenPepper); | |
| 87 }; | |
| 88 | |
| 89 #endif // CHROME_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ | |
| OLD | NEW |