OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 namespace blink { | 47 namespace blink { |
48 | 48 |
49 class GestureEvent; | 49 class GestureEvent; |
50 class HTMLPlugInElement; | 50 class HTMLPlugInElement; |
51 class IntRect; | 51 class IntRect; |
52 class KeyboardEvent; | 52 class KeyboardEvent; |
53 class MouseEvent; | 53 class MouseEvent; |
54 class PlatformGestureEvent; | 54 class PlatformGestureEvent; |
55 class ResourceError; | 55 class ResourceError; |
56 class ResourceResponse; | 56 class ResourceResponse; |
| 57 class ScriptController; |
57 class ScrollbarGroup; | 58 class ScrollbarGroup; |
58 class TouchEvent; | 59 class TouchEvent; |
59 class WebPlugin; | 60 class WebPlugin; |
60 class WebPluginLoadObserver; | 61 class WebPluginLoadObserver; |
61 class WebExternalTextureLayer; | 62 class WebExternalTextureLayer; |
62 class WheelEvent; | 63 class WheelEvent; |
63 class Widget; | 64 class Widget; |
64 struct WebPrintParams; | 65 struct WebPrintParams; |
65 | 66 |
66 class WebPluginContainerImpl FINAL | 67 class WebPluginContainerImpl FINAL : public PluginView, public WebPluginContaine
r, public FrameDestructionObserver { |
67 : public PluginView | 68 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebPluginContainerImpl); |
68 , public WebPluginContainer | 69 public: |
69 #if !ENABLE(OILPAN) | 70 static PassRefPtrWillBeRawPtr<WebPluginContainerImpl> create(HTMLPlugInEleme
nt* element, WebPlugin* webPlugin) |
70 , public FrameDestructionObserver | |
71 #endif | |
72 { | 71 { |
73 public: | 72 return adoptRefWillBeNoop(new WebPluginContainerImpl(element, webPlugin)
); |
74 static PassRefPtr<WebPluginContainerImpl> create(HTMLPlugInElement* element,
WebPlugin* webPlugin) | |
75 { | |
76 return adoptRef(new WebPluginContainerImpl(element, webPlugin)); | |
77 } | 73 } |
78 | 74 |
79 // PluginView methods | 75 // PluginView methods |
80 virtual WebLayer* platformLayer() const OVERRIDE; | 76 virtual WebLayer* platformLayer() const OVERRIDE; |
81 virtual v8::Local<v8::Object> scriptableObject(v8::Isolate*) OVERRIDE; | 77 virtual v8::Local<v8::Object> scriptableObject(v8::Isolate*) OVERRIDE; |
82 virtual bool getFormValue(String&) OVERRIDE; | 78 virtual bool getFormValue(String&) OVERRIDE; |
83 virtual bool supportsKeyboardFocus() const OVERRIDE; | 79 virtual bool supportsKeyboardFocus() const OVERRIDE; |
84 virtual bool supportsInputMethod() const OVERRIDE; | 80 virtual bool supportsInputMethod() const OVERRIDE; |
85 virtual bool canProcessDrag() const OVERRIDE; | 81 virtual bool canProcessDrag() const OVERRIDE; |
86 virtual bool wantsWheelEvents() OVERRIDE; | 82 virtual bool wantsWheelEvents() OVERRIDE; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 158 |
163 void willDestroyPluginLoadObserver(WebPluginLoadObserver*); | 159 void willDestroyPluginLoadObserver(WebPluginLoadObserver*); |
164 | 160 |
165 ScrollbarGroup* scrollbarGroup(); | 161 ScrollbarGroup* scrollbarGroup(); |
166 | 162 |
167 void willStartLiveResize(); | 163 void willStartLiveResize(); |
168 void willEndLiveResize(); | 164 void willEndLiveResize(); |
169 | 165 |
170 bool paintCustomOverhangArea(GraphicsContext*, const IntRect&, const IntRect
&, const IntRect&); | 166 bool paintCustomOverhangArea(GraphicsContext*, const IntRect&, const IntRect
&, const IntRect&); |
171 | 167 |
172 #if ENABLE(OILPAN) | 168 virtual void trace(Visitor*) OVERRIDE; |
173 virtual void detach() OVERRIDE; | 169 virtual void dispose() OVERRIDE; |
174 #endif | |
175 | 170 |
176 private: | 171 private: |
177 WebPluginContainerImpl(HTMLPlugInElement*, WebPlugin*); | 172 WebPluginContainerImpl(HTMLPlugInElement*, WebPlugin*); |
178 virtual ~WebPluginContainerImpl(); | 173 virtual ~WebPluginContainerImpl(); |
179 | 174 |
180 void handleMouseEvent(MouseEvent*); | 175 void handleMouseEvent(MouseEvent*); |
181 void handleDragEvent(MouseEvent*); | 176 void handleDragEvent(MouseEvent*); |
182 void handleWheelEvent(WheelEvent*); | 177 void handleWheelEvent(WheelEvent*); |
183 void handleKeyboardEvent(KeyboardEvent*); | 178 void handleKeyboardEvent(KeyboardEvent*); |
184 void handleTouchEvent(TouchEvent*); | 179 void handleTouchEvent(TouchEvent*); |
185 void handleGestureEvent(GestureEvent*); | 180 void handleGestureEvent(GestureEvent*); |
186 | 181 |
187 void synthesizeMouseEventIfPossible(TouchEvent*); | 182 void synthesizeMouseEventIfPossible(TouchEvent*); |
188 | 183 |
189 void focusPlugin(); | 184 void focusPlugin(); |
190 | 185 |
191 void calculateGeometry( | 186 void calculateGeometry( |
192 const IntRect& frameRect, | 187 const IntRect& frameRect, |
193 IntRect& windowRect, | 188 IntRect& windowRect, |
194 IntRect& clipRect, | 189 IntRect& clipRect, |
195 Vector<IntRect>& cutOutRects); | 190 Vector<IntRect>& cutOutRects); |
196 IntRect windowClipRect() const; | 191 IntRect windowClipRect() const; |
197 void windowCutOutRects( | 192 void windowCutOutRects( |
198 const IntRect& frameRect, | 193 const IntRect& frameRect, |
199 Vector<IntRect>& cutOutRects); | 194 Vector<IntRect>& cutOutRects); |
200 | 195 |
201 #if ENABLE(OILPAN) | 196 // Oilpan: this is kept as a bare pointer to support renderer-less |
202 // FIXME: Oilpan: consider moving Widget to the heap, allowing this | 197 // persisted plugins and their finalization. To handle that |
203 // container object to be a FrameDestructionObserver. And thereby | 198 // step correctly, an untraced reference is kept; see |
204 // keep a traced member reference to the frame rather than as a | 199 // HTMLPlugInElement::m_persistedPluginWidget comment. |
205 // bare pointer. Instead, the owning object (HTMLFrameOwnerElement) | |
206 // explicitly deletes this object when it is disconnected from its | |
207 // frame. Any access to an invalid frame via this bare pointer | |
208 // is therefore not possible. | |
209 // | 200 // |
210 // See the HTMLFrameOwnerElement::disconnectContentFrame comment for | 201 // Note: using a traced Member<> would create a direct cycle |
211 // (even) more. | 202 // with m_persistedPluginWidget, hence not done. A weak member |
212 LocalFrame* m_frame; | 203 // is an alternative, but it is not unsafe to use a bare pointer. |
213 | |
214 LocalFrame* frame() const { return m_frame; } | |
215 #endif | |
216 | |
217 // FIXME: see above; for the time being, a bare pointer to the owning | |
218 // HTMLPlugInElement and managed as such. | |
219 HTMLPlugInElement* m_element; | 204 HTMLPlugInElement* m_element; |
220 WebPlugin* m_webPlugin; | 205 WebPlugin* m_webPlugin; |
221 Vector<WebPluginLoadObserver*> m_pluginLoadObservers; | 206 Vector<WebPluginLoadObserver*> m_pluginLoadObservers; |
222 | 207 |
223 WebLayer* m_webLayer; | 208 WebLayer* m_webLayer; |
224 | 209 |
225 // The associated scrollbar group object, created lazily. Used for Pepper | 210 // The associated scrollbar group object, created lazily. Used for Pepper |
226 // scrollbars. | 211 // scrollbars. |
227 OwnPtr<ScrollbarGroup> m_scrollbarGroup; | 212 OwnPtr<ScrollbarGroup> m_scrollbarGroup; |
228 | 213 |
229 TouchEventRequestType m_touchEventRequestType; | 214 TouchEventRequestType m_touchEventRequestType; |
230 bool m_wantsWheelEvents; | 215 bool m_wantsWheelEvents; |
231 }; | 216 }; |
232 | 217 |
233 DEFINE_TYPE_CASTS(WebPluginContainerImpl, Widget, widget, widget->isPluginContai
ner(), widget.isPluginContainer()); | 218 DEFINE_TYPE_CASTS(WebPluginContainerImpl, Widget, widget, widget->isPluginContai
ner(), widget.isPluginContainer()); |
234 // Unlike Widget, we need not worry about object type for container. | 219 // Unlike Widget, we need not worry about object type for container. |
235 // WebPluginContainerImpl is the only subclass of WebPluginContainer. | 220 // WebPluginContainerImpl is the only subclass of WebPluginContainer. |
236 DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebPluginContainer, container, true, t
rue); | 221 DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebPluginContainer, container, true, t
rue); |
237 | 222 |
238 } // namespace blink | 223 } // namespace blink |
239 | 224 |
240 #endif | 225 #endif |
OLD | NEW |