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 27 matching lines...) Expand all Loading... |
38 #include "public/web/WebPluginContainer.h" | 38 #include "public/web/WebPluginContainer.h" |
39 | 39 |
40 #include "wtf/OwnPtr.h" | 40 #include "wtf/OwnPtr.h" |
41 #include "wtf/PassRefPtr.h" | 41 #include "wtf/PassRefPtr.h" |
42 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
43 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
44 | 44 |
45 struct NPObject; | 45 struct NPObject; |
46 | 46 |
47 namespace blink { | 47 namespace blink { |
| 48 |
48 class GestureEvent; | 49 class GestureEvent; |
49 class HTMLPlugInElement; | 50 class HTMLPlugInElement; |
50 class IntRect; | 51 class IntRect; |
51 class KeyboardEvent; | 52 class KeyboardEvent; |
52 class MouseEvent; | 53 class MouseEvent; |
53 class PlatformGestureEvent; | 54 class PlatformGestureEvent; |
54 class ResourceError; | 55 class ResourceError; |
55 class ResourceResponse; | 56 class ResourceResponse; |
| 57 class ScrollbarGroup; |
56 class TouchEvent; | 58 class TouchEvent; |
57 class WheelEvent; | |
58 class Widget; | |
59 } | |
60 | |
61 namespace blink { | |
62 | |
63 struct WebPrintParams; | |
64 | |
65 class ScrollbarGroup; | |
66 class WebPlugin; | 59 class WebPlugin; |
67 class WebPluginLoadObserver; | 60 class WebPluginLoadObserver; |
68 class WebExternalTextureLayer; | 61 class WebExternalTextureLayer; |
| 62 class WheelEvent; |
| 63 class Widget; |
| 64 struct WebPrintParams; |
69 | 65 |
70 class WebPluginContainerImpl FINAL : public blink::PluginView, public WebPluginC
ontainer, public blink::FrameDestructionObserver { | 66 class WebPluginContainerImpl FINAL : public PluginView, public WebPluginContaine
r, public FrameDestructionObserver { |
71 public: | 67 public: |
72 static PassRefPtr<WebPluginContainerImpl> create(blink::HTMLPlugInElement* e
lement, WebPlugin* webPlugin) | 68 static PassRefPtr<WebPluginContainerImpl> create(HTMLPlugInElement* element,
WebPlugin* webPlugin) |
73 { | 69 { |
74 return adoptRef(new WebPluginContainerImpl(element, webPlugin)); | 70 return adoptRef(new WebPluginContainerImpl(element, webPlugin)); |
75 } | 71 } |
76 | 72 |
77 // PluginView methods | 73 // PluginView methods |
78 virtual WebLayer* platformLayer() const OVERRIDE; | 74 virtual WebLayer* platformLayer() const OVERRIDE; |
79 virtual v8::Local<v8::Object> scriptableObject(v8::Isolate*) OVERRIDE; | 75 virtual v8::Local<v8::Object> scriptableObject(v8::Isolate*) OVERRIDE; |
80 virtual bool getFormValue(String&) OVERRIDE; | 76 virtual bool getFormValue(String&) OVERRIDE; |
81 virtual bool supportsKeyboardFocus() const OVERRIDE; | 77 virtual bool supportsKeyboardFocus() const OVERRIDE; |
82 virtual bool supportsInputMethod() const OVERRIDE; | 78 virtual bool supportsInputMethod() const OVERRIDE; |
83 virtual bool canProcessDrag() const OVERRIDE; | 79 virtual bool canProcessDrag() const OVERRIDE; |
84 virtual bool wantsWheelEvents() OVERRIDE; | 80 virtual bool wantsWheelEvents() OVERRIDE; |
85 | 81 |
86 // Widget methods | 82 // Widget methods |
87 virtual void setFrameRect(const blink::IntRect&) OVERRIDE; | 83 virtual void setFrameRect(const IntRect&) OVERRIDE; |
88 virtual void paint(blink::GraphicsContext*, const blink::IntRect&) OVERRIDE; | 84 virtual void paint(GraphicsContext*, const IntRect&) OVERRIDE; |
89 virtual void invalidateRect(const blink::IntRect&) OVERRIDE; | 85 virtual void invalidateRect(const IntRect&) OVERRIDE; |
90 virtual void setFocus(bool) OVERRIDE; | 86 virtual void setFocus(bool) OVERRIDE; |
91 virtual void show() OVERRIDE; | 87 virtual void show() OVERRIDE; |
92 virtual void hide() OVERRIDE; | 88 virtual void hide() OVERRIDE; |
93 virtual void handleEvent(blink::Event*) OVERRIDE; | 89 virtual void handleEvent(Event*) OVERRIDE; |
94 virtual void frameRectsChanged() OVERRIDE; | 90 virtual void frameRectsChanged() OVERRIDE; |
95 virtual void setParentVisible(bool) OVERRIDE; | 91 virtual void setParentVisible(bool) OVERRIDE; |
96 virtual void setParent(blink::Widget*) OVERRIDE; | 92 virtual void setParent(Widget*) OVERRIDE; |
97 virtual void widgetPositionsUpdated() OVERRIDE; | 93 virtual void widgetPositionsUpdated() OVERRIDE; |
98 virtual bool isPluginContainer() const OVERRIDE { return true; } | 94 virtual bool isPluginContainer() const OVERRIDE { return true; } |
99 virtual void eventListenersRemoved() OVERRIDE; | 95 virtual void eventListenersRemoved() OVERRIDE; |
100 virtual bool pluginShouldPersist() const OVERRIDE; | 96 virtual bool pluginShouldPersist() const OVERRIDE; |
101 | 97 |
102 // WebPluginContainer methods | 98 // WebPluginContainer methods |
103 virtual WebElement element() OVERRIDE; | 99 virtual WebElement element() OVERRIDE; |
104 virtual void invalidate() OVERRIDE; | 100 virtual void invalidate() OVERRIDE; |
105 virtual void invalidateRect(const WebRect&) OVERRIDE; | 101 virtual void invalidateRect(const WebRect&) OVERRIDE; |
106 virtual void scrollRect(const WebRect&) OVERRIDE; | 102 virtual void scrollRect(const WebRect&) OVERRIDE; |
(...skipping 27 matching lines...) Expand all Loading... |
134 // interface methods are called only if this method returns true. | 130 // interface methods are called only if this method returns true. |
135 bool supportsPaginatedPrint() const; | 131 bool supportsPaginatedPrint() const; |
136 // If the plugin content should not be scaled to the printable area of | 132 // If the plugin content should not be scaled to the printable area of |
137 // the page, then this method should return true. | 133 // the page, then this method should return true. |
138 bool isPrintScalingDisabled() const; | 134 bool isPrintScalingDisabled() const; |
139 // Returns number of copies to be printed. | 135 // Returns number of copies to be printed. |
140 int getCopiesToPrint() const; | 136 int getCopiesToPrint() const; |
141 // 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. |
142 int printBegin(const WebPrintParams&) const; | 138 int printBegin(const WebPrintParams&) const; |
143 // 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. |
144 bool printPage(int pageNumber, blink::GraphicsContext* gc); | 140 bool printPage(int pageNumber, GraphicsContext*); |
145 // Ends the print operation. | 141 // Ends the print operation. |
146 void printEnd(); | 142 void printEnd(); |
147 | 143 |
148 // Copy the selected text. | 144 // Copy the selected text. |
149 void copy(); | 145 void copy(); |
150 | 146 |
151 // Pass the edit command to the plugin. | 147 // Pass the edit command to the plugin. |
152 bool executeEditCommand(const WebString& name); | 148 bool executeEditCommand(const WebString& name); |
153 bool executeEditCommand(const WebString& name, const WebString& value); | 149 bool executeEditCommand(const WebString& name, const WebString& value); |
154 | 150 |
155 // Resource load events for the plugin's source data: | 151 // Resource load events for the plugin's source data: |
156 virtual void didReceiveResponse(const blink::ResourceResponse&) OVERRIDE; | 152 virtual void didReceiveResponse(const ResourceResponse&) OVERRIDE; |
157 virtual void didReceiveData(const char *data, int dataLength) OVERRIDE; | 153 virtual void didReceiveData(const char *data, int dataLength) OVERRIDE; |
158 virtual void didFinishLoading() OVERRIDE; | 154 virtual void didFinishLoading() OVERRIDE; |
159 virtual void didFailLoading(const blink::ResourceError&) OVERRIDE; | 155 virtual void didFailLoading(const ResourceError&) OVERRIDE; |
160 | 156 |
161 void willDestroyPluginLoadObserver(WebPluginLoadObserver*); | 157 void willDestroyPluginLoadObserver(WebPluginLoadObserver*); |
162 | 158 |
163 ScrollbarGroup* scrollbarGroup(); | 159 ScrollbarGroup* scrollbarGroup(); |
164 | 160 |
165 void willStartLiveResize(); | 161 void willStartLiveResize(); |
166 void willEndLiveResize(); | 162 void willEndLiveResize(); |
167 | 163 |
168 bool paintCustomOverhangArea(blink::GraphicsContext*, const blink::IntRect&,
const blink::IntRect&, const blink::IntRect&); | 164 bool paintCustomOverhangArea(GraphicsContext*, const IntRect&, const IntRect
&, const IntRect&); |
169 | 165 |
170 #if ENABLE(OILPAN) | 166 #if ENABLE(OILPAN) |
171 virtual void detach() OVERRIDE; | 167 virtual void detach() OVERRIDE; |
172 #endif | 168 #endif |
173 | 169 |
174 private: | 170 private: |
175 WebPluginContainerImpl(blink::HTMLPlugInElement* element, WebPlugin* webPlug
in); | 171 WebPluginContainerImpl(HTMLPlugInElement*, WebPlugin*); |
176 virtual ~WebPluginContainerImpl(); | 172 virtual ~WebPluginContainerImpl(); |
177 | 173 |
178 void handleMouseEvent(blink::MouseEvent*); | 174 void handleMouseEvent(MouseEvent*); |
179 void handleDragEvent(blink::MouseEvent*); | 175 void handleDragEvent(MouseEvent*); |
180 void handleWheelEvent(blink::WheelEvent*); | 176 void handleWheelEvent(WheelEvent*); |
181 void handleKeyboardEvent(blink::KeyboardEvent*); | 177 void handleKeyboardEvent(KeyboardEvent*); |
182 void handleTouchEvent(blink::TouchEvent*); | 178 void handleTouchEvent(TouchEvent*); |
183 void handleGestureEvent(blink::GestureEvent*); | 179 void handleGestureEvent(GestureEvent*); |
184 | 180 |
185 void synthesizeMouseEventIfPossible(blink::TouchEvent*); | 181 void synthesizeMouseEventIfPossible(TouchEvent*); |
186 | 182 |
187 void focusPlugin(); | 183 void focusPlugin(); |
188 | 184 |
189 void calculateGeometry(const blink::IntRect& frameRect, | 185 void calculateGeometry( |
190 blink::IntRect& windowRect, | 186 const IntRect& frameRect, |
191 blink::IntRect& clipRect, | 187 IntRect& windowRect, |
192 Vector<blink::IntRect>& cutOutRects); | 188 IntRect& clipRect, |
193 blink::IntRect windowClipRect() const; | 189 Vector<IntRect>& cutOutRects); |
194 void windowCutOutRects(const blink::IntRect& frameRect, | 190 IntRect windowClipRect() const; |
195 Vector<blink::IntRect>& cutOutRects); | 191 void windowCutOutRects( |
| 192 const IntRect& frameRect, |
| 193 Vector<IntRect>& cutOutRects); |
196 | 194 |
197 // FIXME: Oilpan: consider moving Widget to the heap and turn this | 195 // FIXME: Oilpan: consider moving Widget to the heap and turn this |
198 // into a traced member. For the time being, it is a bare pointer | 196 // into a traced member. For the time being, it is a bare pointer |
199 // of its owning PlugInElement and managed as such. | 197 // of its owning PlugInElement and managed as such. |
200 blink::HTMLPlugInElement* m_element; | 198 HTMLPlugInElement* m_element; |
201 WebPlugin* m_webPlugin; | 199 WebPlugin* m_webPlugin; |
202 Vector<WebPluginLoadObserver*> m_pluginLoadObservers; | 200 Vector<WebPluginLoadObserver*> m_pluginLoadObservers; |
203 | 201 |
204 WebLayer* m_webLayer; | 202 WebLayer* m_webLayer; |
205 | 203 |
206 // The associated scrollbar group object, created lazily. Used for Pepper | 204 // The associated scrollbar group object, created lazily. Used for Pepper |
207 // scrollbars. | 205 // scrollbars. |
208 OwnPtr<ScrollbarGroup> m_scrollbarGroup; | 206 OwnPtr<ScrollbarGroup> m_scrollbarGroup; |
209 | 207 |
210 TouchEventRequestType m_touchEventRequestType; | 208 TouchEventRequestType m_touchEventRequestType; |
211 bool m_wantsWheelEvents; | 209 bool m_wantsWheelEvents; |
212 }; | 210 }; |
213 | 211 |
214 DEFINE_TYPE_CASTS(WebPluginContainerImpl, blink::Widget, widget, widget->isPlugi
nContainer(), widget.isPluginContainer()); | 212 DEFINE_TYPE_CASTS(WebPluginContainerImpl, Widget, widget, widget->isPluginContai
ner(), widget.isPluginContainer()); |
215 // Unlike Widget, we need not worry about object type for container. | 213 // Unlike Widget, we need not worry about object type for container. |
216 // WebPluginContainerImpl is the only subclass of WebPluginContainer. | 214 // WebPluginContainerImpl is the only subclass of WebPluginContainer. |
217 DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebPluginContainer, container, true, t
rue); | 215 DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebPluginContainer, container, true, t
rue); |
218 | 216 |
219 } // namespace blink | 217 } // namespace blink |
220 | 218 |
221 #endif | 219 #endif |
OLD | NEW |