| Index: content/renderer/render_widget_fullscreen_pepper.cc
|
| diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc
|
| index 2a71e50d4594730385bc2a5154b27e3c0bbab76d..9fcc1a0ff4d2778e5f8f6b5f164791c7c085f763 100644
|
| --- a/content/renderer/render_widget_fullscreen_pepper.cc
|
| +++ b/content/renderer/render_widget_fullscreen_pepper.cc
|
| @@ -35,10 +35,8 @@ namespace {
|
| // WebWidget that simply wraps the pepper plugin.
|
| class PepperWidget : public WebWidget {
|
| public:
|
| - PepperWidget(webkit::ppapi::PluginInstance* plugin,
|
| - RenderWidgetFullscreenPepper* widget)
|
| - : plugin_(plugin),
|
| - widget_(widget) {
|
| + explicit PepperWidget(RenderWidgetFullscreenPepper* widget)
|
| + : widget_(widget) {
|
| }
|
|
|
| virtual ~PepperWidget() {}
|
| @@ -56,9 +54,12 @@ class PepperWidget : public WebWidget {
|
| }
|
|
|
| virtual void resize(const WebSize& size) {
|
| + if (!widget_->plugin())
|
| + return;
|
| +
|
| size_ = size;
|
| WebRect plugin_rect(0, 0, size_.width, size_.height);
|
| - plugin_->ViewChanged(plugin_rect, plugin_rect);
|
| + widget_->plugin()->ViewChanged(plugin_rect, plugin_rect);
|
| widget_->Invalidate();
|
| }
|
|
|
| @@ -72,15 +73,21 @@ class PepperWidget : public WebWidget {
|
| }
|
|
|
| virtual void paint(WebCanvas* canvas, const WebRect& rect) {
|
| + if (!widget_->plugin())
|
| + return;
|
| +
|
| WebRect plugin_rect(0, 0, size_.width, size_.height);
|
| - plugin_->Paint(canvas, plugin_rect, rect);
|
| + widget_->plugin()->Paint(canvas, plugin_rect, rect);
|
| }
|
|
|
| virtual void composite(bool finish) {
|
| + if (!widget_->plugin())
|
| + return;
|
| +
|
| RendererGLContext* context = widget_->context();
|
| DCHECK(context);
|
| gpu::gles2::GLES2Implementation* gl = context->GetImplementation();
|
| - unsigned int texture = plugin_->GetBackingTextureId();
|
| + unsigned int texture = widget_->plugin()->GetBackingTextureId();
|
| gl->BindTexture(GL_TEXTURE_2D, texture);
|
| gl->DrawArrays(GL_TRIANGLES, 0, 3);
|
| widget_->SwapBuffers();
|
| @@ -91,10 +98,13 @@ class PepperWidget : public WebWidget {
|
| }
|
|
|
| virtual bool handleInputEvent(const WebInputEvent& event) {
|
| + if (!widget_->plugin())
|
| + return false;
|
| +
|
| // This cursor info is ignored, we always set the cursor directly from
|
| // RenderWidgetFullscreenPepper::DidChangeCursor.
|
| WebCursorInfo cursor;
|
| - bool result = plugin_->HandleInputEvent(event, &cursor);
|
| + bool result = widget_->plugin()->HandleInputEvent(event, &cursor);
|
|
|
| // For normal web pages, WebViewImpl does input event translations and
|
| // generates context menu events. Since we don't have a WebView, we need to
|
| @@ -123,7 +133,7 @@ class PepperWidget : public WebWidget {
|
| if (send_context_menu_event) {
|
| WebMouseEvent context_menu_event(mouse_event);
|
| context_menu_event.type = WebInputEvent::ContextMenu;
|
| - plugin_->HandleInputEvent(context_menu_event, &cursor);
|
| + widget_->plugin()->HandleInputEvent(context_menu_event, &cursor);
|
| }
|
| }
|
| return result;
|
| @@ -178,11 +188,11 @@ class PepperWidget : public WebWidget {
|
| }
|
|
|
| virtual bool isAcceleratedCompositingActive() const {
|
| - return widget_->context() && (plugin_->GetBackingTextureId() != 0);
|
| + return widget_->context() && widget_->plugin() &&
|
| + (widget_->plugin()->GetBackingTextureId() != 0);
|
| }
|
|
|
| private:
|
| - scoped_refptr<webkit::ppapi::PluginInstance> plugin_;
|
| RenderWidgetFullscreenPepper* widget_;
|
| WebSize size_;
|
|
|
| @@ -321,7 +331,7 @@ void RenderWidgetFullscreenPepper::OnResize(const gfx::Size& size,
|
| }
|
|
|
| WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() {
|
| - return new PepperWidget(plugin_, this);
|
| + return new PepperWidget(this);
|
| }
|
|
|
| bool RenderWidgetFullscreenPepper::SupportsAsynchronousSwapBuffers() {
|
|
|