Chromium Code Reviews| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 #if ENABLE(OILPAN) |
| 173 virtual void detach() OVERRIDE; | 169 virtual void detach() OVERRIDE; |
| 174 #endif | 170 #endif |
| 175 | 171 |
| 172 virtual void trace(Visitor*) OVERRIDE; | |
| 173 virtual void dispose() OVERRIDE; | |
| 174 | |
| 176 private: | 175 private: |
| 177 WebPluginContainerImpl(HTMLPlugInElement*, WebPlugin*); | 176 WebPluginContainerImpl(HTMLPlugInElement*, WebPlugin*); |
| 178 virtual ~WebPluginContainerImpl(); | 177 virtual ~WebPluginContainerImpl(); |
| 179 | 178 |
| 180 void handleMouseEvent(MouseEvent*); | 179 void handleMouseEvent(MouseEvent*); |
| 181 void handleDragEvent(MouseEvent*); | 180 void handleDragEvent(MouseEvent*); |
| 182 void handleWheelEvent(WheelEvent*); | 181 void handleWheelEvent(WheelEvent*); |
| 183 void handleKeyboardEvent(KeyboardEvent*); | 182 void handleKeyboardEvent(KeyboardEvent*); |
| 184 void handleTouchEvent(TouchEvent*); | 183 void handleTouchEvent(TouchEvent*); |
| 185 void handleGestureEvent(GestureEvent*); | 184 void handleGestureEvent(GestureEvent*); |
| 186 | 185 |
| 187 void synthesizeMouseEventIfPossible(TouchEvent*); | 186 void synthesizeMouseEventIfPossible(TouchEvent*); |
| 188 | 187 |
| 189 void focusPlugin(); | 188 void focusPlugin(); |
| 190 | 189 |
| 191 void calculateGeometry( | 190 void calculateGeometry( |
| 192 const IntRect& frameRect, | 191 const IntRect& frameRect, |
| 193 IntRect& windowRect, | 192 IntRect& windowRect, |
| 194 IntRect& clipRect, | 193 IntRect& clipRect, |
| 195 Vector<IntRect>& cutOutRects); | 194 Vector<IntRect>& cutOutRects); |
| 196 IntRect windowClipRect() const; | 195 IntRect windowClipRect() const; |
| 197 void windowCutOutRects( | 196 void windowCutOutRects( |
| 198 const IntRect& frameRect, | 197 const IntRect& frameRect, |
| 199 Vector<IntRect>& cutOutRects); | 198 Vector<IntRect>& cutOutRects); |
| 200 | 199 |
| 201 #if ENABLE(OILPAN) | 200 // Oilpan: this is a weak member to support renderer-less |
| 202 // FIXME: Oilpan: consider moving Widget to the heap, allowing this | 201 // persisted plugins and their finalization. To handle that |
| 203 // container object to be a FrameDestructionObserver. And thereby | 202 // correctly, a Persistent reference has to be kept; see |
| 204 // keep a traced member reference to the frame rather than as a | 203 // 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 // | 204 // |
| 210 // See the HTMLFrameOwnerElement::disconnectContentFrame comment for | 205 // To prevent a leak from this on-heap persistent reference |
| 211 // (even) more. | 206 // via a direct m_element cycle, it is kept weak. |
| 212 LocalFrame* m_frame; | 207 RawPtrWillBeWeakMember<HTMLPlugInElement> m_element; |
|
haraken
2014/09/26 09:19:25
This doesn't need any weak semantics, so I'd prefe
sof
2014/09/28 17:03:52
ok, made it HTMLPlugInElement* again (and adjusted
| |
| 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; | |
| 220 WebPlugin* m_webPlugin; | 208 WebPlugin* m_webPlugin; |
| 221 Vector<WebPluginLoadObserver*> m_pluginLoadObservers; | 209 Vector<WebPluginLoadObserver*> m_pluginLoadObservers; |
| 222 | 210 |
| 223 WebLayer* m_webLayer; | 211 WebLayer* m_webLayer; |
| 224 | 212 |
| 225 // The associated scrollbar group object, created lazily. Used for Pepper | 213 // The associated scrollbar group object, created lazily. Used for Pepper |
| 226 // scrollbars. | 214 // scrollbars. |
| 227 OwnPtr<ScrollbarGroup> m_scrollbarGroup; | 215 OwnPtr<ScrollbarGroup> m_scrollbarGroup; |
| 228 | 216 |
| 229 TouchEventRequestType m_touchEventRequestType; | 217 TouchEventRequestType m_touchEventRequestType; |
| 230 bool m_wantsWheelEvents; | 218 bool m_wantsWheelEvents; |
| 231 }; | 219 }; |
| 232 | 220 |
| 233 DEFINE_TYPE_CASTS(WebPluginContainerImpl, Widget, widget, widget->isPluginContai ner(), widget.isPluginContainer()); | 221 DEFINE_TYPE_CASTS(WebPluginContainerImpl, Widget, widget, widget->isPluginContai ner(), widget.isPluginContainer()); |
| 234 // Unlike Widget, we need not worry about object type for container. | 222 // Unlike Widget, we need not worry about object type for container. |
| 235 // WebPluginContainerImpl is the only subclass of WebPluginContainer. | 223 // WebPluginContainerImpl is the only subclass of WebPluginContainer. |
| 236 DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebPluginContainer, container, true, t rue); | 224 DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebPluginContainer, container, true, t rue); |
| 237 | 225 |
| 238 } // namespace blink | 226 } // namespace blink |
| 239 | 227 |
| 240 #endif | 228 #endif |
| OLD | NEW |