OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are | |
6 * met: | |
7 * | |
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 | |
13 * distribution. | |
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. | |
17 * | |
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. | |
29 */ | |
30 | |
31 #ifndef WebPluginContainer_h | |
32 #define WebPluginContainer_h | |
33 | |
34 #include "../platform/WebCommon.h" | |
35 | |
36 struct NPObject; | |
37 | |
38 namespace WebKit { | |
39 | |
40 class WebElement; | |
41 class WebPlugin; | |
42 class WebString; | |
43 class WebURL; | |
44 class WebURLRequest; | |
45 class WebLayer; | |
46 struct WebPoint; | |
47 struct WebRect; | |
48 | |
49 class WebPluginContainer { | |
50 public: | |
51 enum TouchEventRequestType { | |
52 TouchEventRequestTypeNone, | |
53 TouchEventRequestTypeRaw, | |
54 TouchEventRequestTypeSynthesizedMouse, | |
55 }; | |
56 | |
57 // Returns the element containing this plugin. | |
58 virtual WebElement element() = 0; | |
59 | |
60 virtual void invalidate() = 0; | |
61 virtual void invalidateRect(const WebRect&) = 0; | |
62 virtual void scrollRect(int dx, int dy, const WebRect&) = 0; | |
63 | |
64 // Causes the container to report its current geometry via | |
65 // WebPlugin::updateGeometry. | |
66 virtual void reportGeometry() = 0; | |
67 | |
68 // Allow the plugin to pass script objects to the browser. The container | |
69 // tracks ownership of script objects in order to allow browser references | |
70 // to them to be dropped when clearScriptObjects is called. | |
71 virtual void allowScriptObjects() = 0; | |
72 | |
73 // Drop any references to script objects allocated by the plugin. | |
74 // These are objects derived from WebPlugin::scriptableObject. This is | |
75 // called when the plugin is being destroyed or if it needs to be | |
76 // re-initialized. | |
77 virtual void clearScriptObjects() = 0; | |
78 | |
79 // Returns the scriptable object associated with the DOM element | |
80 // containing the plugin. | |
81 virtual NPObject* scriptableObjectForElement() = 0; | |
82 | |
83 // Executes a "javascript:" URL on behalf of the plugin in the context | |
84 // of the frame containing the plugin. Returns the result of script | |
85 // execution, if any. | |
86 virtual WebString executeScriptURL(const WebURL&, bool popupsAllowed) = 0; | |
87 | |
88 // Loads an URL in the specified frame (or the frame containing this | |
89 // plugin if target is empty). If notifyNeeded is true, then upon | |
90 // completion, WebPlugin::didFinishLoadingFrameRequest is called if the | |
91 // load was successful or WebPlugin::didFailLoadingFrameRequest is | |
92 // called if the load failed. The given notifyData is passed along to | |
93 // the callback. | |
94 virtual void loadFrameRequest( | |
95 const WebURLRequest&, const WebString& target, bool notifyNeeded, void*
notifyData) = 0; | |
96 | |
97 // Notifies that the zoom level has changed. | |
98 // Note, this does NOT affect pageScaleFactor or pageZoomFactor | |
99 virtual void zoomLevelChanged(double zoomLevel) = 0; | |
100 | |
101 // Determines whether the given rectangle in this plugin is above all other | |
102 // content. The rectangle is in the plugin's coordinate system. | |
103 virtual bool isRectTopmost(const WebRect&) = 0; | |
104 | |
105 // Notifies when the plugin changes the kind of touch-events it accepts. | |
106 virtual void requestTouchEventType(TouchEventRequestType) = 0; | |
107 | |
108 // Notifies when the plugin starts/stops accepting wheel events. Without | |
109 // calling the function with true, the container might not always able to | |
110 // receive wheel events in some cases (such as when threaded compositing | |
111 // is in use but a scroll bar is not in use). | |
112 virtual void setWantsWheelEvents(bool) = 0; | |
113 | |
114 // Converts view's window coordinates to plugin's local coordinates. | |
115 virtual WebPoint windowToLocalPoint(const WebPoint&) = 0; | |
116 | |
117 // Converts plugin's local coordinate to view's window coordinates. | |
118 virtual WebPoint localToWindowPoint(const WebPoint&) = 0; | |
119 | |
120 virtual WebPlugin* plugin() = 0; | |
121 virtual void setPlugin(WebPlugin*) = 0; | |
122 | |
123 virtual float deviceScaleFactor() = 0; | |
124 virtual float pageScaleFactor() = 0; | |
125 virtual float pageZoomFactor() = 0; | |
126 | |
127 // Sets the layer representing the plugin for compositing. The | |
128 // WebPluginContainer does *not* take ownership. | |
129 virtual void setWebLayer(WebLayer*) = 0; | |
130 | |
131 protected: | |
132 ~WebPluginContainer() { } | |
133 }; | |
134 | |
135 } // namespace WebKit | |
136 | |
137 #endif | |
OLD | NEW |