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 WebPluginContainerImpl_h | |
32 #define WebPluginContainerImpl_h | |
33 | |
34 // FIXME: This relative path is a temporary hack to support using this | |
35 // header from webkit/glue. | |
36 #include "../public/WebPluginContainer.h" | |
37 | |
38 #include "Widget.h" | |
39 #include <wtf/PassRefPtr.h> | |
40 #include <wtf/Vector.h> | |
41 | |
42 struct NPObject; | |
43 | |
44 namespace WebCore { | |
45 class HTMLPlugInElement; | |
46 class IntRect; | |
47 class KeyboardEvent; | |
48 class MouseEvent; | |
49 class ResourceError; | |
50 class ResourceResponse; | |
51 } | |
52 | |
53 namespace WebKit { | |
54 | |
55 class WebPlugin; | |
56 class WebPluginLoadObserver; | |
57 | |
58 class WebPluginContainerImpl : public WebCore::Widget, public WebPluginContainer { | |
59 public: | |
60 static PassRefPtr<WebPluginContainerImpl> create(WebCore::HTMLPlugInElement* element, WebPlugin* webPlugin) | |
61 { | |
62 return adoptRef(new WebPluginContainerImpl(element, webPlugin)); | |
63 } | |
64 | |
65 // Widget methods | |
66 virtual void setFrameRect(const WebCore::IntRect&); | |
67 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); | |
68 virtual void invalidateRect(const WebCore::IntRect&); | |
69 virtual void setFocus(); | |
70 virtual void show(); | |
71 virtual void hide(); | |
72 virtual void handleEvent(WebCore::Event*); | |
73 virtual void frameRectsChanged(); | |
74 virtual void setParentVisible(bool); | |
75 virtual void setParent(WebCore::ScrollView*); | |
76 | |
77 // WebPluginContainer methods | |
78 virtual void invalidate(); | |
79 virtual void invalidateRect(const WebRect&); | |
80 virtual void reportGeometry(); | |
81 virtual void clearScriptObjects(); | |
82 virtual NPObject* scriptableObjectForElement(); | |
83 virtual WebString executeScriptURL(const WebURL&, bool popupsAllowed); | |
84 virtual void loadFrameRequest(const WebURLRequest&, const WebString& target, bool notifyNeeded, void* notifyData); | |
85 | |
86 // Resource load events for the plugin's source data: | |
87 void didReceiveResponse(const WebCore::ResourceResponse&); | |
88 void didReceiveData(const char *data, int dataLength); | |
89 void didFinishLoading(); | |
90 void didFailLoading(const WebCore::ResourceError&); | |
91 | |
92 NPObject* scriptableObject(); | |
93 | |
94 // This cannot be null. | |
95 WebPlugin* plugin() { return m_webPlugin; } | |
96 | |
97 void willDestroyPluginLoadObserver(WebPluginLoadObserver*); | |
98 | |
99 private: | |
100 WebPluginContainerImpl(WebCore::HTMLPlugInElement* element, WebPlugin* webPlugin) | |
101 : m_element(element) | |
102 , m_webPlugin(webPlugin) { } | |
103 ~WebPluginContainerImpl(); | |
104 | |
105 void handleMouseEvent(WebCore::MouseEvent*); | |
106 void handleKeyboardEvent(WebCore::KeyboardEvent*); | |
107 | |
108 void calculateGeometry(const WebCore::IntRect& frameRect, | |
109 WebCore::IntRect& windowRect, | |
110 WebCore::IntRect& clipRect, | |
111 Vector<WebCore::IntRect>& cutOutRects); | |
112 WebCore::IntRect windowClipRect() const; | |
113 void windowCutOutRects(const WebCore::IntRect& frameRect, | |
114 Vector<WebCore::IntRect>& cutOutRects); | |
115 | |
116 WebCore::HTMLPlugInElement* m_element; | |
117 WebPlugin* m_webPlugin; | |
118 Vector<WebPluginLoadObserver*> m_pluginLoadObservers; | |
119 }; | |
120 | |
121 } // namespace WebKit | |
122 | |
123 #endif | |
OLD | NEW |