2
* Copyright (C) 2009 Google Inc. All rights reserved.
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are
8
* * Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* * Redistributions in binary form must reproduce the above
11
* copyright notice, this list of conditions and the following disclaimer
12
* in the documentation and/or other materials provided with the
14
* * Neither the name of Google Inc. nor the names of its
15
* contributors may be used to endorse or promote products derived from
16
* this software without specific prior written permission.
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
#ifndef WebPluginContainer_h
32
#define WebPluginContainer_h
34
#include "platform/WebCommon.h"
48
class WebPluginContainer {
50
enum TouchEventRequestType {
51
TouchEventRequestTypeNone,
52
TouchEventRequestTypeRaw,
53
TouchEventRequestTypeSynthesizedMouse,
56
// Returns the element containing this plugin.
57
virtual WebElement element() = 0;
59
virtual void invalidate() = 0;
60
virtual void invalidateRect(const WebRect&) = 0;
61
virtual void scrollRect(int dx, int dy, const WebRect&) = 0;
63
// Causes the container to report its current geometry via
64
// WebPlugin::updateGeometry.
65
virtual void reportGeometry() = 0;
67
// Sets the id of the texture used for hw-accel compositing.
68
// The default value for id is zero which indicates software rendering.
69
// A non-zero value will trigger hw-accelerated compositing.
70
virtual void setBackingTextureId(unsigned) = 0;
71
// Notifies the container that the plugin allocated a new IOSurface for
72
// its rendering, and that the compositor should bind to this texture
73
// and use it for subsequent rendering. A non-zero ioSurfaceId triggers
74
// hardware-accelerated compositing; a zero value switches back to the
75
// software rendered path. (This entry point is used only on Mac OS,
76
// but is defined on all platforms for simplicity.)
77
virtual void setBackingIOSurfaceId(int width,
79
uint32_t ioSurfaceId) = 0;
80
// Called when the backing texture is ready to be composited.
81
// FIXME: consider renaming to something more general, now that
82
// there are multiple providers. One idea: commitBackingStore.
83
virtual void commitBackingTexture() {}
85
// Drop any references to script objects allocated by the plugin.
86
// These are objects derived from WebPlugin::scriptableObject. This is
87
// called when the plugin is being destroyed or if it needs to be
89
virtual void clearScriptObjects() = 0;
91
// Returns the scriptable object associated with the DOM element
92
// containing the plugin.
93
virtual NPObject* scriptableObjectForElement() = 0;
95
// Executes a "javascript:" URL on behalf of the plugin in the context
96
// of the frame containing the plugin. Returns the result of script
98
virtual WebString executeScriptURL(const WebURL&, bool popupsAllowed) = 0;
100
// Loads an URL in the specified frame (or the frame containing this
101
// plugin if target is empty). If notifyNeeded is true, then upon
102
// completion, WebPlugin::didFinishLoadingFrameRequest is called if the
103
// load was successful or WebPlugin::didFailLoadingFrameRequest is
104
// called if the load failed. The given notifyData is passed along to
106
virtual void loadFrameRequest(
107
const WebURLRequest&, const WebString& target, bool notifyNeeded, void* notifyData) = 0;
109
// Notifies that the zoom level has changed.
110
// Note, this does NOT affect pageScaleFactor or pageZoomFactor
111
virtual void zoomLevelChanged(double zoomLevel) = 0;
113
// Notifies whether the contents of the plugin are entirely opaque.
114
virtual void setOpaque(bool) = 0;
116
// Determines whether the given rectangle in this plugin is above all other
117
// content. The rectangle is in the plugin's coordinate system.
118
virtual bool isRectTopmost(const WebRect&) = 0;
120
// Notifies when the plugin changes the kind of touch-events it accepts.
121
virtual void requestTouchEventType(TouchEventRequestType) = 0;
123
// Notifies when the plugin starts/stops accepting wheel events. Without
124
// calling the function with true, the container might not always able to
125
// receive wheel events in some cases (such as when threaded compositing
126
// is in use but a scroll bar is not in use).
127
virtual void setWantsWheelEvents(bool) = 0;
129
// Converts view's window coordinates to plugin's local coordinates.
130
virtual WebPoint windowToLocalPoint(const WebPoint&) = 0;
132
virtual WebPlugin* plugin() = 0;
133
virtual void setPlugin(WebPlugin*) = 0;
135
virtual float deviceScaleFactor() = 0;
136
virtual float pageScaleFactor() = 0;
137
virtual float pageZoomFactor() = 0;
140
~WebPluginContainer() { }
143
} // namespace WebKit