#ifndef WebPluginContainerImpl_h
#define WebPluginContainerImpl_h
#include "WebPluginContainer.h"
#include "core/plugins/PluginView.h"
#include "platform/Widget.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassRefPtr.h"
#include "wtf/text/WTFString.h"
#include "wtf/Vector.h"
struct NPObject;
namespace WebCore {
class GestureEvent;
class HTMLPlugInElement;
class IntRect;
class KeyboardEvent;
class MouseEvent;
class PlatformGestureEvent;
class ResourceError;
class ResourceResponse;
class TouchEvent;
class WheelEvent;
class Widget;
}
namespace blink {
struct WebPrintParams;
class ScrollbarGroup;
class WebPlugin;
class WebPluginLoadObserver;
class WebExternalTextureLayer;
class WebPluginContainerImpl FINAL : public WebCore::PluginView, public WebPluginContainer {
public:
static PassRefPtr<WebPluginContainerImpl> create(WebCore::HTMLPlugInElement* element, WebPlugin* webPlugin)
{
return adoptRef(new WebPluginContainerImpl(element, webPlugin));
}
virtual WebLayer* platformLayer() const OVERRIDE;
virtual NPObject* scriptableObject() OVERRIDE;
virtual bool getFormValue(String&) OVERRIDE;
virtual bool supportsKeyboardFocus() const OVERRIDE;
virtual bool supportsInputMethod() const OVERRIDE;
virtual bool canProcessDrag() const OVERRIDE;
virtual bool wantsWheelEvents() OVERRIDE;
virtual void setFrameRect(const WebCore::IntRect&) OVERRIDE;
virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&) OVERRIDE;
virtual void invalidateRect(const WebCore::IntRect&) OVERRIDE;
virtual void setFocus(bool) OVERRIDE;
virtual void show() OVERRIDE;
virtual void hide() OVERRIDE;
virtual void handleEvent(WebCore::Event*) OVERRIDE;
virtual void frameRectsChanged() OVERRIDE;
virtual void setParentVisible(bool) OVERRIDE;
virtual void setParent(WebCore::Widget*) OVERRIDE;
virtual void widgetPositionsUpdated() OVERRIDE;
virtual bool isPluginContainer() const OVERRIDE { return true; }
virtual void eventListenersRemoved() OVERRIDE;
virtual bool pluginShouldPersist() const OVERRIDE;
virtual WebElement element() OVERRIDE;
virtual void invalidate() OVERRIDE;
virtual void invalidateRect(const WebRect&) OVERRIDE;
virtual void scrollRect(int dx, int dy, const WebRect&) OVERRIDE;
virtual void reportGeometry() OVERRIDE;
virtual void allowScriptObjects() OVERRIDE;
virtual void clearScriptObjects() OVERRIDE;
virtual NPObject* scriptableObjectForElement() OVERRIDE;
virtual WebString executeScriptURL(const WebURL&, bool popupsAllowed) OVERRIDE;
virtual void loadFrameRequest(const WebURLRequest&, const WebString& target, bool notifyNeeded, void* notifyData) OVERRIDE;
virtual void zoomLevelChanged(double zoomLevel) OVERRIDE;
virtual bool isRectTopmost(const WebRect&) OVERRIDE;
virtual void requestTouchEventType(TouchEventRequestType) OVERRIDE;
virtual void setWantsWheelEvents(bool) OVERRIDE;
virtual WebPoint windowToLocalPoint(const WebPoint&) OVERRIDE;
virtual WebPoint localToWindowPoint(const WebPoint&) OVERRIDE;
virtual WebPlugin* plugin() OVERRIDE { return m_webPlugin; }
virtual void setPlugin(WebPlugin*) OVERRIDE;
virtual float deviceScaleFactor() OVERRIDE;
virtual float pageScaleFactor() OVERRIDE;
virtual float pageZoomFactor() OVERRIDE;
virtual void setWebLayer(WebLayer*);
bool supportsPaginatedPrint() const;
bool isPrintScalingDisabled() const;
int printBegin(const WebPrintParams&) const;
bool printPage(int pageNumber, WebCore::GraphicsContext* gc);
void printEnd();
void copy();
bool executeEditCommand(const WebString& name);
bool executeEditCommand(const WebString& name, const WebString& value);
virtual void didReceiveResponse(const WebCore::ResourceResponse&) OVERRIDE;
virtual void didReceiveData(const char *data, int dataLength) OVERRIDE;
virtual void didFinishLoading() OVERRIDE;
virtual void didFailLoading(const WebCore::ResourceError&) OVERRIDE;
void willDestroyPluginLoadObserver(WebPluginLoadObserver*);
ScrollbarGroup* scrollbarGroup();
void willStartLiveResize();
void willEndLiveResize();
bool paintCustomOverhangArea(WebCore::GraphicsContext*, const WebCore::IntRect&, const WebCore::IntRect&, const WebCore::IntRect&);
private:
WebPluginContainerImpl(WebCore::HTMLPlugInElement* element, WebPlugin* webPlugin);
virtual ~WebPluginContainerImpl();
void handleMouseEvent(WebCore::MouseEvent*);
void handleDragEvent(WebCore::MouseEvent*);
void handleWheelEvent(WebCore::WheelEvent*);
void handleKeyboardEvent(WebCore::KeyboardEvent*);
void handleTouchEvent(WebCore::TouchEvent*);
void handleGestureEvent(WebCore::GestureEvent*);
void synthesizeMouseEventIfPossible(WebCore::TouchEvent*);
void focusPlugin();
void calculateGeometry(const WebCore::IntRect& frameRect,
WebCore::IntRect& windowRect,
WebCore::IntRect& clipRect,
Vector<WebCore::IntRect>& cutOutRects);
WebCore::IntRect windowClipRect() const;
void windowCutOutRects(const WebCore::IntRect& frameRect,
Vector<WebCore::IntRect>& cutOutRects);
WebCore::HTMLPlugInElement* m_element;
WebPlugin* m_webPlugin;
Vector<WebPluginLoadObserver*> m_pluginLoadObservers;
WebLayer* m_webLayer;
OwnPtr<ScrollbarGroup> m_scrollbarGroup;
TouchEventRequestType m_touchEventRequestType;
bool m_wantsWheelEvents;
};
DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebCore::Widget, widget, widget->isPluginContainer(), widget.isPluginContainer());
DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebPluginContainer, container, true, true);
}
#endif