~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebKit/chromium/public/WebPluginContainer.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
struct WebPoint;
 
46
struct WebRect;
 
47
 
 
48
class WebPluginContainer {
 
49
public:
 
50
    enum TouchEventRequestType {
 
51
        TouchEventRequestTypeNone,
 
52
        TouchEventRequestTypeRaw,
 
53
        TouchEventRequestTypeSynthesizedMouse,
 
54
    };
 
55
 
 
56
    // Returns the element containing this plugin.
 
57
    virtual WebElement element() = 0;
 
58
 
 
59
    virtual void invalidate() = 0;
 
60
    virtual void invalidateRect(const WebRect&) = 0;
 
61
    virtual void scrollRect(int dx, int dy, const WebRect&) = 0;
 
62
 
 
63
    // Causes the container to report its current geometry via
 
64
    // WebPlugin::updateGeometry.
 
65
    virtual void reportGeometry() = 0;
 
66
    
 
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,
 
78
                                       int height,
 
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() {}
 
84
    
 
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
 
88
    // re-initialized.
 
89
    virtual void clearScriptObjects() = 0;
 
90
 
 
91
    // Returns the scriptable object associated with the DOM element
 
92
    // containing the plugin.
 
93
    virtual NPObject* scriptableObjectForElement() = 0;
 
94
 
 
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
 
97
    // execution, if any.
 
98
    virtual WebString executeScriptURL(const WebURL&, bool popupsAllowed) = 0;
 
99
 
 
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
 
105
    // the callback.
 
106
    virtual void loadFrameRequest(
 
107
        const WebURLRequest&, const WebString& target, bool notifyNeeded, void* notifyData) = 0;
 
108
 
 
109
    // Notifies that the zoom level has changed.
 
110
    // Note, this does NOT affect pageScaleFactor or pageZoomFactor
 
111
    virtual void zoomLevelChanged(double zoomLevel) = 0;
 
112
 
 
113
    // Notifies whether the contents of the plugin are entirely opaque.
 
114
    virtual void setOpaque(bool) = 0;
 
115
 
 
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;
 
119
 
 
120
    // Notifies when the plugin changes the kind of touch-events it accepts.
 
121
    virtual void requestTouchEventType(TouchEventRequestType) = 0;
 
122
 
 
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;
 
128
 
 
129
    // Converts view's window coordinates to plugin's local coordinates.
 
130
    virtual WebPoint windowToLocalPoint(const WebPoint&) = 0;
 
131
 
 
132
    virtual WebPlugin* plugin() = 0;
 
133
    virtual void setPlugin(WebPlugin*) = 0;
 
134
 
 
135
    virtual float deviceScaleFactor() = 0;
 
136
    virtual float pageScaleFactor() = 0;
 
137
    virtual float pageZoomFactor() = 0;
 
138
 
 
139
protected:
 
140
    ~WebPluginContainer() { }
 
141
};
 
142
 
 
143
} // namespace WebKit
 
144
 
 
145
#endif