Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: third_party/WebKit/Source/web/WebPluginContainerImpl.h

Issue 2814643003: Remove FrameViewBase as base class of PluginView. (Closed)
Patch Set: Address final comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #ifndef WebPluginContainerImpl_h 32 #ifndef WebPluginContainerImpl_h
33 #define WebPluginContainerImpl_h 33 #define WebPluginContainerImpl_h
34 34
35 #include "core/dom/ContextLifecycleObserver.h" 35 #include "core/dom/ContextLifecycleObserver.h"
36 #include "core/plugins/PluginView.h" 36 #include "core/plugins/PluginView.h"
37 #include "platform/FrameViewBase.h" 37 #include "platform/heap/Handle.h"
38 #include "platform/wtf/Compiler.h" 38 #include "platform/wtf/Compiler.h"
39 #include "platform/wtf/PassRefPtr.h" 39 #include "platform/wtf/PassRefPtr.h"
40 #include "platform/wtf/Vector.h" 40 #include "platform/wtf/Vector.h"
41 #include "platform/wtf/text/WTFString.h" 41 #include "platform/wtf/text/WTFString.h"
42 #include "public/web/WebPluginContainer.h" 42 #include "public/web/WebPluginContainer.h"
43 #include "web/WebExport.h" 43 #include "web/WebExport.h"
44 44
45 namespace blink { 45 namespace blink {
46 46
47 class GestureEvent; 47 class GestureEvent;
48 class HTMLFrameOwnerElement; 48 class HTMLFrameOwnerElement;
49 class HTMLPlugInElement; 49 class HTMLPlugInElement;
50 class IntRect; 50 class IntRect;
51 class KeyboardEvent; 51 class KeyboardEvent;
52 class MouseEvent; 52 class MouseEvent;
53 class ResourceError; 53 class ResourceError;
54 class ResourceResponse; 54 class ResourceResponse;
55 class TouchEvent; 55 class TouchEvent;
56 class WebPlugin; 56 class WebPlugin;
57 class WheelEvent; 57 class WheelEvent;
58 struct WebPrintParams; 58 struct WebPrintParams;
59 struct WebPrintPresetOptions; 59 struct WebPrintPresetOptions;
60 60
61 class WEB_EXPORT WebPluginContainerImpl final 61 class WEB_EXPORT WebPluginContainerImpl final
62 : public PluginView, 62 : public GarbageCollectedFinalized<WebPluginContainerImpl>,
63 public PluginView,
63 NON_EXPORTED_BASE(public WebPluginContainer), 64 NON_EXPORTED_BASE(public WebPluginContainer),
64 public ContextClient { 65 public ContextClient {
65 USING_GARBAGE_COLLECTED_MIXIN(WebPluginContainerImpl); 66 USING_GARBAGE_COLLECTED_MIXIN(WebPluginContainerImpl);
66 USING_PRE_FINALIZER(WebPluginContainerImpl, Dispose); 67 USING_PRE_FINALIZER(WebPluginContainerImpl, Dispose);
67 68
68 public: 69 public:
69 static WebPluginContainerImpl* Create(HTMLPlugInElement* element, 70 static WebPluginContainerImpl* Create(HTMLPlugInElement* element,
70 WebPlugin* web_plugin) { 71 WebPlugin* web_plugin) {
71 return new WebPluginContainerImpl(element, web_plugin); 72 return new WebPluginContainerImpl(element, web_plugin);
72 } 73 }
74 ~WebPluginContainerImpl() override;
73 75
74 // PluginView methods 76 // PluginView methods
77 void SetParent(FrameView*) override;
78 FrameView* Parent() const override { return parent_; };
79 void SetParentVisible(bool) override;
75 WebLayer* PlatformLayer() const override; 80 WebLayer* PlatformLayer() const override;
76 v8::Local<v8::Object> ScriptableObject(v8::Isolate*) override; 81 v8::Local<v8::Object> ScriptableObject(v8::Isolate*) override;
77 bool SupportsKeyboardFocus() const override; 82 bool SupportsKeyboardFocus() const override;
78 bool SupportsInputMethod() const override; 83 bool SupportsInputMethod() const override;
79 bool CanProcessDrag() const override; 84 bool CanProcessDrag() const override;
80 bool WantsWheelEvents() override; 85 bool WantsWheelEvents() override;
81 void UpdateAllLifecyclePhases() override; 86 void UpdateAllLifecyclePhases() override;
82 void InvalidatePaintIfNeeded() override { IssuePaintInvalidations(); } 87 void InvalidatePaintIfNeeded() override { IssuePaintInvalidations(); }
83 88 void InvalidateRect(const IntRect&);
84 // FrameViewBase methods
85 void SetFrameRect(const IntRect&) override;
86 void Paint(GraphicsContext&, const CullRect&) const override;
87 void InvalidateRect(const IntRect&) override;
88 void SetFocused(bool, WebFocusType) override; 89 void SetFocused(bool, WebFocusType) override;
89 void Show() override;
90 void Hide() override;
91 void HandleEvent(Event*) override; 90 void HandleEvent(Event*) override;
92 void FrameRectsChanged() override; 91 void FrameRectsChanged() override;
93 void SetParentVisible(bool) override;
94 void GeometryMayHaveChanged() override; 92 void GeometryMayHaveChanged() override;
95 bool IsPluginContainer() const override { return true; } 93 bool IsPluginContainer() const override { return true; }
96 void EventListenersRemoved() override; 94 void EventListenersRemoved() override;
97 95
96 // FrameOrPlugin methods
97 void SetFrameRect(const IntRect& frame_rect) override {
98 frame_rect_ = frame_rect;
99 }
100 const IntRect& FrameRect() const override { return frame_rect_; }
101 void Paint(GraphicsContext&, const CullRect&) const override;
102 void Show() override;
103 void Hide() override;
104
98 // WebPluginContainer methods 105 // WebPluginContainer methods
99 WebElement GetElement() override; 106 WebElement GetElement() override;
100 WebDocument GetDocument() override; 107 WebDocument GetDocument() override;
101 void DispatchProgressEvent(const WebString& type, 108 void DispatchProgressEvent(const WebString& type,
102 bool length_computable, 109 bool length_computable,
103 unsigned long long loaded, 110 unsigned long long loaded,
104 unsigned long long total, 111 unsigned long long total,
105 const WebString& url) override; 112 const WebString& url) override;
106 void EnqueueMessageEvent(const WebDOMMessageEvent&) override; 113 void EnqueueMessageEvent(const WebDOMMessageEvent&) override;
107 void Invalidate() override; 114 void Invalidate() override;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // the visible screen of the root frame, in local space of the plugin. 182 // the visible screen of the root frame, in local space of the plugin.
176 // Sets |unclippedAbsoluteRect| to the visible rect for the plugin (but 183 // Sets |unclippedAbsoluteRect| to the visible rect for the plugin (but
177 // without also clipping to the screen), in local space of the plugin. 184 // without also clipping to the screen), in local space of the plugin.
178 void ComputeClipRectsForPlugin( 185 void ComputeClipRectsForPlugin(
179 const HTMLFrameOwnerElement* plugin_owner_element, 186 const HTMLFrameOwnerElement* plugin_owner_element,
180 IntRect& window_rect, 187 IntRect& window_rect,
181 IntRect& clipped_local_rect, 188 IntRect& clipped_local_rect,
182 IntRect& unclipped_int_local_rect) const; 189 IntRect& unclipped_int_local_rect) const;
183 190
184 WebPluginContainerImpl(HTMLPlugInElement*, WebPlugin*); 191 WebPluginContainerImpl(HTMLPlugInElement*, WebPlugin*);
185 ~WebPluginContainerImpl() override;
186 192
187 void HandleMouseEvent(MouseEvent*); 193 void HandleMouseEvent(MouseEvent*);
188 void HandleDragEvent(MouseEvent*); 194 void HandleDragEvent(MouseEvent*);
189 void HandleWheelEvent(WheelEvent*); 195 void HandleWheelEvent(WheelEvent*);
190 void HandleKeyboardEvent(KeyboardEvent*); 196 void HandleKeyboardEvent(KeyboardEvent*);
191 void HandleTouchEvent(TouchEvent*); 197 void HandleTouchEvent(TouchEvent*);
192 void HandleGestureEvent(GestureEvent*); 198 void HandleGestureEvent(GestureEvent*);
193 199
194 void SynthesizeMouseEventIfPossible(TouchEvent*); 200 void SynthesizeMouseEventIfPossible(TouchEvent*);
195 201
196 void FocusPlugin(); 202 void FocusPlugin();
197 203
198 void IssuePaintInvalidations(); 204 void IssuePaintInvalidations();
199 205
200 void CalculateGeometry(IntRect& window_rect, 206 void CalculateGeometry(IntRect& window_rect,
201 IntRect& clip_rect, 207 IntRect& clip_rect,
202 IntRect& unobscured_rect, 208 IntRect& unobscured_rect,
203 Vector<IntRect>& cut_out_rects); 209 Vector<IntRect>& cut_out_rects);
204 void WindowCutOutRects(const IntRect& frame_rect, 210 void WindowCutOutRects(const IntRect& frame_rect,
205 Vector<IntRect>& cut_out_rects); 211 Vector<IntRect>& cut_out_rects);
206 212
207 friend class WebPluginContainerTest; 213 friend class WebPluginContainerTest;
208 214
215 Member<FrameView> parent_;
209 Member<HTMLPlugInElement> element_; 216 Member<HTMLPlugInElement> element_;
210 WebPlugin* web_plugin_; 217 WebPlugin* web_plugin_;
211
212 WebLayer* web_layer_; 218 WebLayer* web_layer_;
213 219 IntRect frame_rect_;
214 IntRect pending_invalidation_rect_; 220 IntRect pending_invalidation_rect_;
215
216 TouchEventRequestType touch_event_request_type_; 221 TouchEventRequestType touch_event_request_type_;
217 bool wants_wheel_events_; 222 bool wants_wheel_events_;
218 223 bool self_visible_;
224 bool parent_visible_;
219 bool is_disposed_; 225 bool is_disposed_;
220 }; 226 };
221 227
222 DEFINE_TYPE_CASTS(WebPluginContainerImpl, 228 DEFINE_TYPE_CASTS(WebPluginContainerImpl,
223 FrameViewBase, 229 PluginView,
224 frameViewBase, 230 plugin,
225 frameViewBase->IsPluginContainer(), 231 plugin->IsPluginContainer(),
226 frameViewBase.IsPluginContainer()); 232 plugin.IsPluginContainer());
227 // Unlike FrameViewBase, we need not worry about object type for container. 233 // Unlike FrameViewBase, we need not worry about object type for container.
228 // WebPluginContainerImpl is the only subclass of WebPluginContainer. 234 // WebPluginContainerImpl is the only subclass of WebPluginContainer.
229 DEFINE_TYPE_CASTS(WebPluginContainerImpl, 235 DEFINE_TYPE_CASTS(WebPluginContainerImpl,
230 WebPluginContainer, 236 WebPluginContainer,
231 container, 237 container,
232 true, 238 true,
233 true); 239 true);
234 240
235 } // namespace blink 241 } // namespace blink
236 242
237 #endif 243 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/Scrollbar.cpp ('k') | third_party/WebKit/Source/web/WebPluginContainerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698