diff options
-rw-r--r-- | chrome/chrome_renderer.gypi | 2 | ||||
-rw-r--r-- | chrome/renderer/pepper_plugin_delegate_impl.cc | 6 | ||||
-rw-r--r-- | chrome/renderer/pepper_plugin_delegate_impl.h | 2 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 9 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 9 | ||||
-rw-r--r-- | chrome/renderer/render_widget_fullscreen.cc | 8 | ||||
-rw-r--r-- | chrome/renderer/render_widget_fullscreen.h | 4 | ||||
-rw-r--r-- | chrome/renderer/render_widget_fullscreen_pepper.cc | 212 | ||||
-rw-r--r-- | chrome/renderer/render_widget_fullscreen_pepper.h | 58 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_fullscreen_container.h | 33 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_delegate.h | 6 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_instance.cc | 77 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_instance.h | 10 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_module.cc | 3 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_webplugin_impl.cc | 8 |
15 files changed, 430 insertions, 17 deletions
diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi index fce5d8e..38e122f 100644 --- a/chrome/chrome_renderer.gypi +++ b/chrome/chrome_renderer.gypi @@ -159,6 +159,8 @@ 'renderer/render_widget.h', 'renderer/render_widget_fullscreen.cc', 'renderer/render_widget_fullscreen.h', + 'renderer/render_widget_fullscreen_pepper.cc', + 'renderer/render_widget_fullscreen_pepper.h', 'renderer/renderer_glue.cc', 'renderer/renderer_histogram_snapshots.cc', 'renderer/renderer_histogram_snapshots.h', diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc index a3f2735..511b284 100644 --- a/chrome/renderer/pepper_plugin_delegate_impl.cc +++ b/chrome/renderer/pepper_plugin_delegate_impl.cc @@ -641,3 +641,9 @@ scoped_refptr<base::MessageLoopProxy> PepperPluginDelegateImpl::GetFileThreadMessageLoopProxy() { return RenderThread::current()->GetFileThreadMessageLoopProxy(); } + +pepper::FullscreenContainer* +PepperPluginDelegateImpl::CreateFullscreenContainer( + pepper::PluginInstance* instance) { + return render_view_->CreatePepperFullscreenContainer(instance); +} diff --git a/chrome/renderer/pepper_plugin_delegate_impl.h b/chrome/renderer/pepper_plugin_delegate_impl.h index ebc19ee..180ce43 100644 --- a/chrome/renderer/pepper_plugin_delegate_impl.h +++ b/chrome/renderer/pepper_plugin_delegate_impl.h @@ -67,6 +67,8 @@ class PepperPluginDelegateImpl int flags, AsyncOpenFileCallback* callback); virtual scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy(); + virtual pepper::FullscreenContainer* CreateFullscreenContainer( + pepper::PluginInstance* instance); private: // Pointer to the RenderView that owns us. diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 39a65e8..486bfbe 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -70,6 +70,7 @@ #include "chrome/renderer/render_thread.h" #include "chrome/renderer/render_view_visitor.h" #include "chrome/renderer/render_widget_fullscreen.h" +#include "chrome/renderer/render_widget_fullscreen_pepper.h" #include "chrome/renderer/renderer_webapplicationcachehost_impl.h" #include "chrome/renderer/renderer_webstoragenamespace_impl.h" #include "chrome/renderer/speech_input_dispatcher.h" @@ -1763,6 +1764,14 @@ WebWidget* RenderView::createFullscreenWindow(WebKit::WebPopupType popup_type) { return widget->webwidget(); } +pepper::FullscreenContainer* RenderView::CreatePepperFullscreenContainer( + pepper::PluginInstance* plugin) { + RenderWidgetFullscreenPepper* widget = + RenderWidgetFullscreenPepper::Create(routing_id_, render_thread_, plugin); + widget->show(WebKit::WebNavigationPolicyIgnore); + return widget->container(); +} + WebStorageNamespace* RenderView::createSessionStorageNamespace(unsigned quota) { if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) return WebStorageNamespace::createSessionStorageNamespace(quota); diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 97ee04a..4a181c2 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -90,6 +90,11 @@ class Point; class Rect; } +namespace pepper { +class PluginInstance; +class FullscreenContainer; +} + namespace webkit_glue { class ImageResourceFetcher; struct FileUploadData; @@ -282,6 +287,10 @@ class RenderView : public RenderWidget, // the plugin. void OnPepperPluginDestroy(WebPluginDelegatePepper* pepper_plugin); + // Creates a fullscreen container for a pepper plugin instance. + pepper::FullscreenContainer* CreatePepperFullscreenContainer( + pepper::PluginInstance* plugin); + // Create a new plugin without checking the content settings. WebKit::WebPlugin* CreatePluginNoCheck(WebKit::WebFrame* frame, const WebKit::WebPluginParams& params); diff --git a/chrome/renderer/render_widget_fullscreen.cc b/chrome/renderer/render_widget_fullscreen.cc index e822b49..ce6f367 100644 --- a/chrome/renderer/render_widget_fullscreen.cc +++ b/chrome/renderer/render_widget_fullscreen.cc @@ -21,11 +21,9 @@ RenderWidgetFullscreen* RenderWidgetFullscreen::Create( return widget.release(); } -// static -WebWidget* RenderWidgetFullscreen::CreateWebWidget( - RenderWidgetFullscreen* render_widget) { +WebWidget* RenderWidgetFullscreen::CreateWebWidget() { // TODO(boliu): Handle full screen render widgets here. - return RenderWidget::CreateWebWidget(render_widget); + return RenderWidget::CreateWebWidget(this); } void RenderWidgetFullscreen::Init(int32 opener_id) { @@ -33,7 +31,7 @@ void RenderWidgetFullscreen::Init(int32 opener_id) { RenderWidget::DoInit( opener_id, - RenderWidgetFullscreen::CreateWebWidget(this), + CreateWebWidget(), new ViewHostMsg_CreateFullscreenWidget( opener_id, popup_type_, &routing_id_)); } diff --git a/chrome/renderer/render_widget_fullscreen.h b/chrome/renderer/render_widget_fullscreen.h index 2573819..b0d7cb7 100644 --- a/chrome/renderer/render_widget_fullscreen.h +++ b/chrome/renderer/render_widget_fullscreen.h @@ -19,12 +19,10 @@ class RenderWidgetFullscreen : public RenderWidget { RenderThreadBase* render_thread, WebKit::WebPopupType popup_type); - static WebKit::WebWidget* CreateWebWidget( - RenderWidgetFullscreen* render_widget); - virtual void show(WebKit::WebNavigationPolicy); protected: + virtual WebKit::WebWidget* CreateWebWidget(); RenderWidgetFullscreen(RenderThreadBase* render_thread, WebKit::WebPopupType popup_type); diff --git a/chrome/renderer/render_widget_fullscreen_pepper.cc b/chrome/renderer/render_widget_fullscreen_pepper.cc new file mode 100644 index 0000000..5b1b1f3 --- /dev/null +++ b/chrome/renderer/render_widget_fullscreen_pepper.cc @@ -0,0 +1,212 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/renderer/render_widget_fullscreen_pepper.h" + +#include "chrome/common/render_messages.h" +#include "chrome/renderer/render_thread.h" +#include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSize.h" +#include "third_party/WebKit/WebKit/chromium/public/WebWidget.h" +#include "webkit/glue/plugins/pepper_fullscreen_container.h" +#include "webkit/glue/plugins/pepper_plugin_instance.h" + +using WebKit::WebCanvas; +using WebKit::WebCompositionUnderline; +using WebKit::WebCursorInfo; +using WebKit::WebInputEvent; +using WebKit::WebRect; +using WebKit::WebSize; +using WebKit::WebString; +using WebKit::WebTextDirection; +using WebKit::WebTextInputType; +using WebKit::WebVector; +using WebKit::WebWidget; + +namespace { + +// WebWidget that simply wraps the pepper plugin. +class PepperWidget : public WebWidget { + public: + PepperWidget(pepper::PluginInstance* plugin, + RenderWidgetFullscreenPepper* widget) + : plugin_(plugin), + widget_(widget), + cursor_(WebCursorInfo::TypePointer) { + } + + // WebWidget API + virtual void close() { + delete this; + } + + virtual WebSize size() { + return size_; + } + + virtual void resize(const WebSize& size) { + size_ = size; + WebRect plugin_rect(0, 0, size_.width, size_.height); + // TODO(piman): transparently scale the plugin instead of resizing it. + plugin_->ViewChanged(plugin_rect, plugin_rect); + widget_->GenerateFullRepaint(); + } + + virtual void layout() { + } + + virtual void paint(WebCanvas* canvas, const WebRect& rect) { + if (!plugin_) + return; + WebRect plugin_rect(0, 0, size_.width, size_.height); + plugin_->Paint(canvas, plugin_rect, rect); + } + + virtual void composite(bool finish) { + NOTIMPLEMENTED(); + } + + virtual void themeChanged() { + NOTIMPLEMENTED(); + } + + virtual bool handleInputEvent(const WebInputEvent& event) { + if (!plugin_) + return false; + return plugin_->HandleInputEvent(event, &cursor_); + } + + virtual void mouseCaptureLost() { + NOTIMPLEMENTED(); + } + + virtual void setFocus(bool focus) { + NOTIMPLEMENTED(); + } + + virtual bool setComposition( + const WebString& text, + const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, + int selectionEnd) { + NOTIMPLEMENTED(); + return false; + } + + virtual bool confirmComposition() { + NOTIMPLEMENTED(); + return false; + } + + virtual WebTextInputType textInputType() { + NOTIMPLEMENTED(); + return WebKit::WebTextInputTypeNone; + } + + virtual WebRect caretOrSelectionBounds() { + NOTIMPLEMENTED(); + return WebRect(); + } + + virtual void setTextDirection(WebTextDirection) { + NOTIMPLEMENTED(); + } + + virtual bool isAcceleratedCompositingActive() const { + // TODO(piman): see if supporting accelerated compositing makes sense. + return false; + } + + private: + pepper::PluginInstance* plugin_; + RenderWidgetFullscreenPepper* widget_; + WebSize size_; + WebCursorInfo cursor_; + + DISALLOW_COPY_AND_ASSIGN(PepperWidget); +}; + + +// A FullscreenContainer that forwards the API calls to the +// RenderWidgetFullscreenPepper. +class WidgetFullscreenContainer : public pepper::FullscreenContainer { + public: + explicit WidgetFullscreenContainer(RenderWidgetFullscreenPepper* widget) + : widget_(widget) { + } + virtual ~WidgetFullscreenContainer() { } + + virtual void Invalidate() { + widget_->GenerateFullRepaint(); + } + + virtual void InvalidateRect(const WebKit::WebRect& rect) { + widget_->didInvalidateRect(rect); + } + + virtual void Destroy() { + widget_->SendClose(); + } + + private: + RenderWidgetFullscreenPepper* widget_; + + DISALLOW_COPY_AND_ASSIGN(WidgetFullscreenContainer); +}; + +} // anonymous namespace + +// static +RenderWidgetFullscreenPepper* RenderWidgetFullscreenPepper::Create( + int32 opener_id, RenderThreadBase* render_thread, + pepper::PluginInstance* plugin) { + DCHECK_NE(MSG_ROUTING_NONE, opener_id); + scoped_refptr<RenderWidgetFullscreenPepper> widget = + new RenderWidgetFullscreenPepper(render_thread, plugin); + widget->Init(opener_id); + return widget.release(); +} + +RenderWidgetFullscreenPepper::RenderWidgetFullscreenPepper( + RenderThreadBase* render_thread, pepper::PluginInstance* plugin) + : RenderWidgetFullscreen(render_thread, WebKit::WebPopupTypeSelect), + plugin_(plugin), + ALLOW_THIS_IN_INITIALIZER_LIST( + container_(new WidgetFullscreenContainer(this))) { +} + +RenderWidgetFullscreenPepper::~RenderWidgetFullscreenPepper() { +} + +WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { + return new PepperWidget(plugin_, this); +} + +void RenderWidgetFullscreenPepper::Close() { + // If the fullscreen window is closed (e.g. user pressed escape), reset to + // normal mode. + if (plugin_) + plugin_->SetFullscreen(false); +} + +void RenderWidgetFullscreenPepper::DidInitiatePaint() { + if (plugin_) + plugin_->ViewInitiatedPaint(); +} + +void RenderWidgetFullscreenPepper::DidFlushPaint() { + if (plugin_) + plugin_->ViewFlushedPaint(); +} + +void RenderWidgetFullscreenPepper::SendClose() { + // This function is called by the plugin instance as it's going away, so reset + // plugin_ to NULL to avoid calling into a dangling pointer e.g. on Close(). + plugin_ = NULL; + Send(new ViewHostMsg_Close(routing_id_)); +} + +void RenderWidgetFullscreenPepper::GenerateFullRepaint() { + didInvalidateRect(gfx::Rect(size_.width(), size_.height())); +} diff --git a/chrome/renderer/render_widget_fullscreen_pepper.h b/chrome/renderer/render_widget_fullscreen_pepper.h new file mode 100644 index 0000000..437e75d --- /dev/null +++ b/chrome/renderer/render_widget_fullscreen_pepper.h @@ -0,0 +1,58 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ +#define CHROME_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ + +#include "chrome/renderer/render_widget_fullscreen.h" +#include "third_party/WebKit/WebKit/chromium/public/WebWidget.h" + +namespace pepper { +class PluginInstance; +class FullscreenContainer; +} + +// A RenderWidget that hosts a fullscreen pepper plugin. This provides a +// FullscreenContainer that the plugin instance can callback into to e.g. +// invalidate rects. +class RenderWidgetFullscreenPepper : public RenderWidgetFullscreen { + public: + static RenderWidgetFullscreenPepper* Create( + int32 opener_id, + RenderThreadBase* render_thread, + pepper::PluginInstance* plugin); + + // Asks the browser to close this view, which will tear off the window and + // close this widget. + void SendClose(); + + // Invalidate the whole widget to force a redraw. + void GenerateFullRepaint(); + + pepper::FullscreenContainer* container() const { return container_.get(); } + + protected: + RenderWidgetFullscreenPepper(RenderThreadBase* render_thread, + pepper::PluginInstance* plugin); + virtual ~RenderWidgetFullscreenPepper(); + + // RenderWidget API. + virtual void DidInitiatePaint(); + virtual void DidFlushPaint(); + virtual void Close(); + + // RenderWidgetFullscreen API. + virtual WebKit::WebWidget* CreateWebWidget(); + + private: + // The plugin instance this widget wraps. + pepper::PluginInstance* plugin_; + + // The FullscreenContainer that the plugin instance can callback into. + scoped_ptr<pepper::FullscreenContainer> container_; + + DISALLOW_COPY_AND_ASSIGN(RenderWidgetFullscreenPepper); +}; + +#endif // CHROME_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ diff --git a/webkit/glue/plugins/pepper_fullscreen_container.h b/webkit/glue/plugins/pepper_fullscreen_container.h new file mode 100644 index 0000000..5f67538 --- /dev/null +++ b/webkit/glue/plugins/pepper_fullscreen_container.h @@ -0,0 +1,33 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_GLUE_PLUGINS_PEPPER_FULLSCREEN_CONTAINER_H_ +#define WEBKIT_GLUE_PLUGINS_PEPPER_FULLSCREEN_CONTAINER_H_ + +namespace WebKit { +struct WebRect; +} // namespace WebKit + +namespace pepper { + +// This class is like a lightweight WebPluginContainer for fullscreen pepper +// plugins, that only handles painting. +class FullscreenContainer { + public: + virtual ~FullscreenContainer() {} + + // Invalidates the full plugin region. + virtual void Invalidate() = 0; + + // Invalidates a partial region of the plugin. + virtual void InvalidateRect(const WebKit::WebRect&) = 0; + + // Destroys the fullscreen window. This also destroys the FullscreenContainer + // instance. + virtual void Destroy() = 0; +}; + +} // namespace pepper + +#endif // WEBKIT_GLUE_PLUGINS_PEPPER_FULLSCREEN_CONTAINER_H_ diff --git a/webkit/glue/plugins/pepper_plugin_delegate.h b/webkit/glue/plugins/pepper_plugin_delegate.h index 162b4bb6..3393ba0 100644 --- a/webkit/glue/plugins/pepper_plugin_delegate.h +++ b/webkit/glue/plugins/pepper_plugin_delegate.h @@ -46,6 +46,7 @@ namespace pepper { class FileIO; class PluginInstance; +class FullscreenContainer; // Virtual interface that the browser implements to implement features for // Pepper plugins. @@ -167,6 +168,11 @@ class PluginDelegate { // of the file thread in this renderer. virtual scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy() = 0; + + // Create a fullscreen container for a plugin instance. This effectively + // switches the plugin to fullscreen. + virtual FullscreenContainer* CreateFullscreenContainer( + PluginInstance* instance) = 0; }; } // namespace pepper diff --git a/webkit/glue/plugins/pepper_plugin_instance.cc b/webkit/glue/plugins/pepper_plugin_instance.cc index e6b1c18..1a1290e 100644 --- a/webkit/glue/plugins/pepper_plugin_instance.cc +++ b/webkit/glue/plugins/pepper_plugin_instance.cc @@ -23,6 +23,7 @@ #include "skia/ext/vector_platform_device.h" #include "skia/ext/platform_canvas.h" #include "third_party/ppapi/c/dev/ppb_find_dev.h" +#include "third_party/ppapi/c/dev/ppb_fullscreen_dev.h" #include "third_party/ppapi/c/dev/ppp_find_dev.h" #include "third_party/ppapi/c/dev/ppp_zoom_dev.h" #include "third_party/ppapi/c/pp_event.h" @@ -44,6 +45,7 @@ #include "webkit/glue/plugins/pepper_buffer.h" #include "webkit/glue/plugins/pepper_graphics_2d.h" #include "webkit/glue/plugins/pepper_event_conversion.h" +#include "webkit/glue/plugins/pepper_fullscreen_container.h" #include "webkit/glue/plugins/pepper_image_data.h" #include "webkit/glue/plugins/pepper_plugin_delegate.h" #include "webkit/glue/plugins/pepper_plugin_module.h" @@ -207,6 +209,25 @@ const PPB_Find_Dev ppb_find = { &SelectedFindResultChanged, }; +bool IsFullscreen(PP_Instance instance_id) { + PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); + if (!instance) + return false; + return instance->IsFullscreen(); +} + +bool SetFullscreen(PP_Instance instance_id, bool fullscreen) { + PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); + if (!instance) + return false; + return instance->SetFullscreen(fullscreen); +} + +const PPB_Fullscreen_Dev ppb_fullscreen = { + &IsFullscreen, + &SetFullscreen, +}; + } // namespace PluginInstance::PluginInstance(PluginDelegate* delegate, @@ -225,7 +246,8 @@ PluginInstance::PluginInstance(PluginDelegate* delegate, pdf_output_done_(false), #endif // defined (OS_LINUX) plugin_print_interface_(NULL), - plugin_graphics_3d_interface_(NULL) { + plugin_graphics_3d_interface_(NULL), + fullscreen_container_(NULL) { memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); DCHECK(delegate); module_->InstanceCreated(this); @@ -252,6 +274,11 @@ const PPB_Find_Dev* PluginInstance::GetFindInterface() { return &ppb_find; } +// static +const PPB_Fullscreen_Dev* PluginInstance::GetFullscreenInterface() { + return &ppb_fullscreen; +} + PP_Instance PluginInstance::GetPPInstance() { return reinterpret_cast<intptr_t>(this); } @@ -264,12 +291,19 @@ void PluginInstance::Paint(WebCanvas* canvas, } void PluginInstance::InvalidateRect(const gfx::Rect& rect) { - if (!container_ || position_.IsEmpty()) - return; // Nothing to do. - if (rect.IsEmpty()) - container_->invalidate(); - else - container_->invalidateRect(rect); + if (fullscreen_container_) { + if (rect.IsEmpty()) + fullscreen_container_->Invalidate(); + else + fullscreen_container_->InvalidateRect(rect); + } else { + if (!container_ || position_.IsEmpty()) + return; // Nothing to do. + if (rect.IsEmpty()) + container_->invalidate(); + else + container_->invalidateRect(rect); + } } PP_Var PluginInstance::GetWindowObject() { @@ -379,6 +413,10 @@ PP_Var PluginInstance::ExecuteScript(PP_Var script, PP_Var* exception) { void PluginInstance::Delete() { instance_interface_->Delete(GetPPInstance()); + if (fullscreen_container_) { + fullscreen_container_->Destroy(); + fullscreen_container_ = NULL; + } container_ = NULL; } @@ -640,6 +678,31 @@ void PluginInstance::Graphics3DContextLost() { plugin_graphics_3d_interface_->Graphics3DContextLost(GetPPInstance()); } +bool PluginInstance::IsFullscreen() { + return fullscreen_container_ != NULL; +} + +bool PluginInstance::SetFullscreen(bool fullscreen) { + bool is_fullscreen = (fullscreen_container_ != NULL); + if (fullscreen == is_fullscreen) + return true; + LOG(INFO) << "Setting fullscreen to " << (fullscreen ? "on" : "off"); + if (fullscreen) { + fullscreen_container_ = delegate_->CreateFullscreenContainer(this); + } else { + fullscreen_container_->Destroy(); + fullscreen_container_ = NULL; + // TODO(piman): currently the fullscreen container resizes the plugin to the + // fullscreen size so we need to reset the size here. Eventually it will + // transparently scale and this won't be necessary. + if (container_) { + container_->reportGeometry(); + container_->invalidate(); + } + } + return true; +} + bool PluginInstance::PrintPDFOutput(PP_Resource print_output, WebKit::WebCanvas* canvas) { scoped_refptr<Buffer> buffer(Resource::GetAs<Buffer>(print_output)); diff --git a/webkit/glue/plugins/pepper_plugin_instance.h b/webkit/glue/plugins/pepper_plugin_instance.h index 1260beb8..bf8f027 100644 --- a/webkit/glue/plugins/pepper_plugin_instance.h +++ b/webkit/glue/plugins/pepper_plugin_instance.h @@ -24,6 +24,7 @@ struct PP_Var; struct PPB_Instance; struct PPB_Find_Dev; +struct PPB_Fullscreen_Dev; struct PPP_Find_Dev; struct PPP_Instance; struct PPP_Zoom_Dev; @@ -47,6 +48,7 @@ class ImageData; class PluginDelegate; class PluginModule; class URLLoader; +class FullscreenContainer; class PluginInstance : public base::RefCounted<PluginInstance> { public: @@ -63,6 +65,7 @@ class PluginInstance : public base::RefCounted<PluginInstance> { // Returns a pointer to the interface implementing PPB_Find that is // exposed to the plugin. static const PPB_Find_Dev* GetFindInterface(); + static const PPB_Fullscreen_Dev* GetFullscreenInterface(); PluginDelegate* delegate() const { return delegate_; } PluginModule* module() const { return module_.get(); } @@ -128,6 +131,10 @@ class PluginInstance : public base::RefCounted<PluginInstance> { void Graphics3DContextLost(); + // Implementation of PPB_Fullscreen_Dev. + bool IsFullscreen(); + bool SetFullscreen(bool fullscreen); + private: bool LoadFindInterface(); bool LoadZoomInterface(); @@ -210,6 +217,9 @@ class PluginInstance : public base::RefCounted<PluginInstance> { // Containes the cursor if it's set by the plugin. scoped_ptr<WebKit::WebCursorInfo> cursor_; + // Plugin container for fullscreen mode. NULL if not in fullscreen mode. + FullscreenContainer* fullscreen_container_; + DISALLOW_COPY_AND_ASSIGN(PluginInstance); }; diff --git a/webkit/glue/plugins/pepper_plugin_module.cc b/webkit/glue/plugins/pepper_plugin_module.cc index 2286285..1d1fb6b 100644 --- a/webkit/glue/plugins/pepper_plugin_module.cc +++ b/webkit/glue/plugins/pepper_plugin_module.cc @@ -21,6 +21,7 @@ #include "third_party/ppapi/c/dev/ppb_file_system_dev.h" #include "third_party/ppapi/c/dev/ppb_find_dev.h" #include "third_party/ppapi/c/dev/ppb_font_dev.h" +#include "third_party/ppapi/c/dev/ppb_fullscreen_dev.h" #include "third_party/ppapi/c/dev/ppb_graphics_3d_dev.h" #include "third_party/ppapi/c/dev/ppb_opengles_dev.h" #include "third_party/ppapi/c/dev/ppb_scrollbar_dev.h" @@ -231,6 +232,8 @@ const void* GetInterface(const char* name) { return Font::GetInterface(); if (strcmp(name, PPB_FIND_DEV_INTERFACE) == 0) return PluginInstance::GetFindInterface(); + if (strcmp(name, PPB_FULLSCREEN_DEV_INTERFACE) == 0) + return PluginInstance::GetFullscreenInterface(); if (strcmp(name, PPB_URLUTIL_DEV_INTERFACE) == 0) return UrlUtil::GetInterface(); if (strcmp(name, PPB_PRIVATE_INTERFACE) == 0) diff --git a/webkit/glue/plugins/pepper_webplugin_impl.cc b/webkit/glue/plugins/pepper_webplugin_impl.cc index 95b3012..d566280 100644 --- a/webkit/glue/plugins/pepper_webplugin_impl.cc +++ b/webkit/glue/plugins/pepper_webplugin_impl.cc @@ -81,7 +81,8 @@ NPObject* WebPluginImpl::scriptableObject() { } void WebPluginImpl::paint(WebCanvas* canvas, const WebRect& rect) { - instance_->Paint(canvas, plugin_rect_, rect); + if (!instance_->IsFullscreen()) + instance_->Paint(canvas, plugin_rect_, rect); } void WebPluginImpl::updateGeometry( @@ -90,7 +91,8 @@ void WebPluginImpl::updateGeometry( const WebVector<WebRect>& cut_outs_rects, bool is_visible) { plugin_rect_ = window_rect; - instance_->ViewChanged(plugin_rect_, clip_rect); + if (!instance_->IsFullscreen()) + instance_->ViewChanged(plugin_rect_, clip_rect); } void WebPluginImpl::updateFocus(bool focused) { @@ -105,6 +107,8 @@ bool WebPluginImpl::acceptsInputEvents() { bool WebPluginImpl::handleInputEvent(const WebKit::WebInputEvent& event, WebKit::WebCursorInfo& cursor_info) { + if (instance_->IsFullscreen()) + return false; return instance_->HandleInputEvent(event, &cursor_info); } |