OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "platform/Widget.h" | 36 #include "platform/Widget.h" |
37 #include "public/web/WebPluginContainer.h" | 37 #include "public/web/WebPluginContainer.h" |
38 | 38 |
39 #include "wtf/OwnPtr.h" | 39 #include "wtf/OwnPtr.h" |
40 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
42 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
43 | 43 |
44 struct NPObject; | 44 struct NPObject; |
45 | 45 |
46 namespace WebCore { | 46 namespace blink { |
47 class GestureEvent; | 47 class GestureEvent; |
48 class HTMLPlugInElement; | 48 class HTMLPlugInElement; |
49 class IntRect; | 49 class IntRect; |
50 class KeyboardEvent; | 50 class KeyboardEvent; |
51 class MouseEvent; | 51 class MouseEvent; |
52 class PlatformGestureEvent; | 52 class PlatformGestureEvent; |
53 class ResourceError; | 53 class ResourceError; |
54 class ResourceResponse; | 54 class ResourceResponse; |
55 class TouchEvent; | 55 class TouchEvent; |
56 class WheelEvent; | 56 class WheelEvent; |
57 class Widget; | 57 class Widget; |
58 } | 58 } |
59 | 59 |
60 namespace blink { | 60 namespace blink { |
61 | 61 |
62 struct WebPrintParams; | 62 struct WebPrintParams; |
63 | 63 |
64 class ScrollbarGroup; | 64 class ScrollbarGroup; |
65 class WebPlugin; | 65 class WebPlugin; |
66 class WebPluginLoadObserver; | 66 class WebPluginLoadObserver; |
67 class WebExternalTextureLayer; | 67 class WebExternalTextureLayer; |
68 | 68 |
69 class WebPluginContainerImpl FINAL : public WebCore::PluginView, public WebPlugi
nContainer, public WebCore::FrameDestructionObserver { | 69 class WebPluginContainerImpl FINAL : public blink::PluginView, public WebPluginC
ontainer, public blink::FrameDestructionObserver { |
70 public: | 70 public: |
71 static PassRefPtr<WebPluginContainerImpl> create(WebCore::HTMLPlugInElement*
element, WebPlugin* webPlugin) | 71 static PassRefPtr<WebPluginContainerImpl> create(blink::HTMLPlugInElement* e
lement, WebPlugin* webPlugin) |
72 { | 72 { |
73 return adoptRef(new WebPluginContainerImpl(element, webPlugin)); | 73 return adoptRef(new WebPluginContainerImpl(element, webPlugin)); |
74 } | 74 } |
75 | 75 |
76 // PluginView methods | 76 // PluginView methods |
77 virtual WebLayer* platformLayer() const OVERRIDE; | 77 virtual WebLayer* platformLayer() const OVERRIDE; |
78 virtual NPObject* scriptableObject() OVERRIDE; | 78 virtual NPObject* scriptableObject() OVERRIDE; |
79 virtual bool getFormValue(String&) OVERRIDE; | 79 virtual bool getFormValue(String&) OVERRIDE; |
80 virtual bool supportsKeyboardFocus() const OVERRIDE; | 80 virtual bool supportsKeyboardFocus() const OVERRIDE; |
81 virtual bool supportsInputMethod() const OVERRIDE; | 81 virtual bool supportsInputMethod() const OVERRIDE; |
82 virtual bool canProcessDrag() const OVERRIDE; | 82 virtual bool canProcessDrag() const OVERRIDE; |
83 virtual bool wantsWheelEvents() OVERRIDE; | 83 virtual bool wantsWheelEvents() OVERRIDE; |
84 | 84 |
85 // Widget methods | 85 // Widget methods |
86 virtual void setFrameRect(const WebCore::IntRect&) OVERRIDE; | 86 virtual void setFrameRect(const blink::IntRect&) OVERRIDE; |
87 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&) OVERR
IDE; | 87 virtual void paint(blink::GraphicsContext*, const blink::IntRect&) OVERRIDE; |
88 virtual void invalidateRect(const WebCore::IntRect&) OVERRIDE; | 88 virtual void invalidateRect(const blink::IntRect&) OVERRIDE; |
89 virtual void setFocus(bool) OVERRIDE; | 89 virtual void setFocus(bool) OVERRIDE; |
90 virtual void show() OVERRIDE; | 90 virtual void show() OVERRIDE; |
91 virtual void hide() OVERRIDE; | 91 virtual void hide() OVERRIDE; |
92 virtual void handleEvent(WebCore::Event*) OVERRIDE; | 92 virtual void handleEvent(blink::Event*) OVERRIDE; |
93 virtual void frameRectsChanged() OVERRIDE; | 93 virtual void frameRectsChanged() OVERRIDE; |
94 virtual void setParentVisible(bool) OVERRIDE; | 94 virtual void setParentVisible(bool) OVERRIDE; |
95 virtual void setParent(WebCore::Widget*) OVERRIDE; | 95 virtual void setParent(blink::Widget*) OVERRIDE; |
96 virtual void widgetPositionsUpdated() OVERRIDE; | 96 virtual void widgetPositionsUpdated() OVERRIDE; |
97 virtual bool isPluginContainer() const OVERRIDE { return true; } | 97 virtual bool isPluginContainer() const OVERRIDE { return true; } |
98 virtual void eventListenersRemoved() OVERRIDE; | 98 virtual void eventListenersRemoved() OVERRIDE; |
99 virtual bool pluginShouldPersist() const OVERRIDE; | 99 virtual bool pluginShouldPersist() const OVERRIDE; |
100 | 100 |
101 // WebPluginContainer methods | 101 // WebPluginContainer methods |
102 virtual WebElement element() OVERRIDE; | 102 virtual WebElement element() OVERRIDE; |
103 virtual void invalidate() OVERRIDE; | 103 virtual void invalidate() OVERRIDE; |
104 virtual void invalidateRect(const WebRect&) OVERRIDE; | 104 virtual void invalidateRect(const WebRect&) OVERRIDE; |
105 virtual void scrollRect(const WebRect&) OVERRIDE; | 105 virtual void scrollRect(const WebRect&) OVERRIDE; |
(...skipping 24 matching lines...) Expand all Loading... |
130 // (which means it controls the layout, number of pages etc). | 130 // (which means it controls the layout, number of pages etc). |
131 // Whether the plugin supports its own paginated print. The other print | 131 // Whether the plugin supports its own paginated print. The other print |
132 // interface methods are called only if this method returns true. | 132 // interface methods are called only if this method returns true. |
133 bool supportsPaginatedPrint() const; | 133 bool supportsPaginatedPrint() const; |
134 // If the plugin content should not be scaled to the printable area of | 134 // If the plugin content should not be scaled to the printable area of |
135 // the page, then this method should return true. | 135 // the page, then this method should return true. |
136 bool isPrintScalingDisabled() const; | 136 bool isPrintScalingDisabled() const; |
137 // Sets up printing at the specified WebPrintParams. Returns the number of p
ages to be printed at these settings. | 137 // Sets up printing at the specified WebPrintParams. Returns the number of p
ages to be printed at these settings. |
138 int printBegin(const WebPrintParams&) const; | 138 int printBegin(const WebPrintParams&) const; |
139 // Prints the page specified by pageNumber (0-based index) into the supplied
canvas. | 139 // Prints the page specified by pageNumber (0-based index) into the supplied
canvas. |
140 bool printPage(int pageNumber, WebCore::GraphicsContext* gc); | 140 bool printPage(int pageNumber, blink::GraphicsContext* gc); |
141 // Ends the print operation. | 141 // Ends the print operation. |
142 void printEnd(); | 142 void printEnd(); |
143 | 143 |
144 // Copy the selected text. | 144 // Copy the selected text. |
145 void copy(); | 145 void copy(); |
146 | 146 |
147 // Pass the edit command to the plugin. | 147 // Pass the edit command to the plugin. |
148 bool executeEditCommand(const WebString& name); | 148 bool executeEditCommand(const WebString& name); |
149 bool executeEditCommand(const WebString& name, const WebString& value); | 149 bool executeEditCommand(const WebString& name, const WebString& value); |
150 | 150 |
151 // Resource load events for the plugin's source data: | 151 // Resource load events for the plugin's source data: |
152 virtual void didReceiveResponse(const WebCore::ResourceResponse&) OVERRIDE; | 152 virtual void didReceiveResponse(const blink::ResourceResponse&) OVERRIDE; |
153 virtual void didReceiveData(const char *data, int dataLength) OVERRIDE; | 153 virtual void didReceiveData(const char *data, int dataLength) OVERRIDE; |
154 virtual void didFinishLoading() OVERRIDE; | 154 virtual void didFinishLoading() OVERRIDE; |
155 virtual void didFailLoading(const WebCore::ResourceError&) OVERRIDE; | 155 virtual void didFailLoading(const blink::ResourceError&) OVERRIDE; |
156 | 156 |
157 void willDestroyPluginLoadObserver(WebPluginLoadObserver*); | 157 void willDestroyPluginLoadObserver(WebPluginLoadObserver*); |
158 | 158 |
159 ScrollbarGroup* scrollbarGroup(); | 159 ScrollbarGroup* scrollbarGroup(); |
160 | 160 |
161 void willStartLiveResize(); | 161 void willStartLiveResize(); |
162 void willEndLiveResize(); | 162 void willEndLiveResize(); |
163 | 163 |
164 bool paintCustomOverhangArea(WebCore::GraphicsContext*, const WebCore::IntRe
ct&, const WebCore::IntRect&, const WebCore::IntRect&); | 164 bool paintCustomOverhangArea(blink::GraphicsContext*, const blink::IntRect&,
const blink::IntRect&, const blink::IntRect&); |
165 | 165 |
166 #if ENABLE(OILPAN) | 166 #if ENABLE(OILPAN) |
167 virtual void detach() OVERRIDE; | 167 virtual void detach() OVERRIDE; |
168 #endif | 168 #endif |
169 | 169 |
170 private: | 170 private: |
171 WebPluginContainerImpl(WebCore::HTMLPlugInElement* element, WebPlugin* webPl
ugin); | 171 WebPluginContainerImpl(blink::HTMLPlugInElement* element, WebPlugin* webPlug
in); |
172 virtual ~WebPluginContainerImpl(); | 172 virtual ~WebPluginContainerImpl(); |
173 | 173 |
174 void handleMouseEvent(WebCore::MouseEvent*); | 174 void handleMouseEvent(blink::MouseEvent*); |
175 void handleDragEvent(WebCore::MouseEvent*); | 175 void handleDragEvent(blink::MouseEvent*); |
176 void handleWheelEvent(WebCore::WheelEvent*); | 176 void handleWheelEvent(blink::WheelEvent*); |
177 void handleKeyboardEvent(WebCore::KeyboardEvent*); | 177 void handleKeyboardEvent(blink::KeyboardEvent*); |
178 void handleTouchEvent(WebCore::TouchEvent*); | 178 void handleTouchEvent(blink::TouchEvent*); |
179 void handleGestureEvent(WebCore::GestureEvent*); | 179 void handleGestureEvent(blink::GestureEvent*); |
180 | 180 |
181 void synthesizeMouseEventIfPossible(WebCore::TouchEvent*); | 181 void synthesizeMouseEventIfPossible(blink::TouchEvent*); |
182 | 182 |
183 void focusPlugin(); | 183 void focusPlugin(); |
184 | 184 |
185 void calculateGeometry(const WebCore::IntRect& frameRect, | 185 void calculateGeometry(const blink::IntRect& frameRect, |
186 WebCore::IntRect& windowRect, | 186 blink::IntRect& windowRect, |
187 WebCore::IntRect& clipRect, | 187 blink::IntRect& clipRect, |
188 Vector<WebCore::IntRect>& cutOutRects); | 188 Vector<blink::IntRect>& cutOutRects); |
189 WebCore::IntRect windowClipRect() const; | 189 blink::IntRect windowClipRect() const; |
190 void windowCutOutRects(const WebCore::IntRect& frameRect, | 190 void windowCutOutRects(const blink::IntRect& frameRect, |
191 Vector<WebCore::IntRect>& cutOutRects); | 191 Vector<blink::IntRect>& cutOutRects); |
192 | 192 |
193 // FIXME: Oilpan: consider moving Widget to the heap and turn this | 193 // FIXME: Oilpan: consider moving Widget to the heap and turn this |
194 // into a traced member. For the time being, it is a bare pointer | 194 // into a traced member. For the time being, it is a bare pointer |
195 // of its owning PlugInElement and managed as such. | 195 // of its owning PlugInElement and managed as such. |
196 WebCore::HTMLPlugInElement* m_element; | 196 blink::HTMLPlugInElement* m_element; |
197 WebPlugin* m_webPlugin; | 197 WebPlugin* m_webPlugin; |
198 Vector<WebPluginLoadObserver*> m_pluginLoadObservers; | 198 Vector<WebPluginLoadObserver*> m_pluginLoadObservers; |
199 | 199 |
200 WebLayer* m_webLayer; | 200 WebLayer* m_webLayer; |
201 | 201 |
202 // The associated scrollbar group object, created lazily. Used for Pepper | 202 // The associated scrollbar group object, created lazily. Used for Pepper |
203 // scrollbars. | 203 // scrollbars. |
204 OwnPtr<ScrollbarGroup> m_scrollbarGroup; | 204 OwnPtr<ScrollbarGroup> m_scrollbarGroup; |
205 | 205 |
206 TouchEventRequestType m_touchEventRequestType; | 206 TouchEventRequestType m_touchEventRequestType; |
207 bool m_wantsWheelEvents; | 207 bool m_wantsWheelEvents; |
208 }; | 208 }; |
209 | 209 |
210 DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebCore::Widget, widget, widget->isPlu
ginContainer(), widget.isPluginContainer()); | 210 DEFINE_TYPE_CASTS(WebPluginContainerImpl, blink::Widget, widget, widget->isPlugi
nContainer(), widget.isPluginContainer()); |
211 // Unlike Widget, we need not worry about object type for container. | 211 // Unlike Widget, we need not worry about object type for container. |
212 // WebPluginContainerImpl is the only subclass of WebPluginContainer. | 212 // WebPluginContainerImpl is the only subclass of WebPluginContainer. |
213 DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebPluginContainer, container, true, t
rue); | 213 DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebPluginContainer, container, true, t
rue); |
214 | 214 |
215 } // namespace blink | 215 } // namespace blink |
216 | 216 |
217 #endif | 217 #endif |
OLD | NEW |