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 15 matching lines...) Expand all Loading... |
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
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/exported/WebPluginContainerBase.h" |
37 #include "platform/heap/Handle.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/platform/WebCoalescedInputEvent.h" | 42 #include "public/platform/WebCoalescedInputEvent.h" |
43 #include "public/platform/WebTouchEvent.h" | 43 #include "public/platform/WebTouchEvent.h" |
44 #include "public/web/WebPluginContainer.h" | 44 #include "public/web/WebPluginContainer.h" |
45 #include "web/WebExport.h" | 45 #include "web/WebExport.h" |
46 | 46 |
47 namespace blink { | 47 namespace blink { |
48 | 48 |
49 class GestureEvent; | 49 class GestureEvent; |
50 class HTMLFrameOwnerElement; | 50 class HTMLFrameOwnerElement; |
51 class HTMLPlugInElement; | 51 class HTMLPlugInElement; |
52 class IntRect; | 52 class IntRect; |
53 class KeyboardEvent; | 53 class KeyboardEvent; |
54 class MouseEvent; | 54 class MouseEvent; |
55 class ResourceError; | 55 class ResourceError; |
56 class ResourceResponse; | 56 class ResourceResponse; |
57 class TouchEvent; | 57 class TouchEvent; |
58 class WebPlugin; | 58 class WebPlugin; |
59 class WheelEvent; | 59 class WheelEvent; |
60 struct WebPrintParams; | 60 struct WebPrintParams; |
61 struct WebPrintPresetOptions; | 61 struct WebPrintPresetOptions; |
62 | 62 |
63 class WEB_EXPORT WebPluginContainerImpl final | 63 class WEB_EXPORT WebPluginContainerImpl final : public WebPluginContainerBase { |
64 : public GarbageCollectedFinalized<WebPluginContainerImpl>, | |
65 public PluginView, | |
66 NON_EXPORTED_BASE(public WebPluginContainer), | |
67 public ContextClient { | |
68 USING_GARBAGE_COLLECTED_MIXIN(WebPluginContainerImpl); | |
69 USING_PRE_FINALIZER(WebPluginContainerImpl, Dispose); | |
70 | |
71 public: | 64 public: |
72 static WebPluginContainerImpl* Create(HTMLPlugInElement* element, | 65 static WebPluginContainerImpl* Create(HTMLPlugInElement* element, |
73 WebPlugin* web_plugin) { | 66 WebPlugin* web_plugin) { |
74 return new WebPluginContainerImpl(element, web_plugin); | 67 return new WebPluginContainerImpl(element, web_plugin); |
75 } | 68 } |
76 ~WebPluginContainerImpl() override; | 69 ~WebPluginContainerImpl() override; |
77 | 70 |
78 // PluginView methods | 71 // PluginView methods |
79 void SetParent(FrameView*) override; | 72 void SetParent(FrameView*) override; |
80 FrameView* Parent() const override { return parent_; }; | 73 FrameView* Parent() const override { return parent_; }; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void SetWebLayer(WebLayer*) override; | 133 void SetWebLayer(WebLayer*) override; |
141 | 134 |
142 void RequestFullscreen() override; | 135 void RequestFullscreen() override; |
143 bool IsFullscreenElement() const override; | 136 bool IsFullscreenElement() const override; |
144 void CancelFullscreen() override; | 137 void CancelFullscreen() override; |
145 | 138 |
146 // Printing interface. The plugin can support custom printing | 139 // Printing interface. The plugin can support custom printing |
147 // (which means it controls the layout, number of pages etc). | 140 // (which means it controls the layout, number of pages etc). |
148 // Whether the plugin supports its own paginated print. The other print | 141 // Whether the plugin supports its own paginated print. The other print |
149 // interface methods are called only if this method returns true. | 142 // interface methods are called only if this method returns true. |
150 bool SupportsPaginatedPrint() const; | 143 bool SupportsPaginatedPrint() const override; |
151 // If the plugin content should not be scaled to the printable area of | 144 // If the plugin content should not be scaled to the printable area of |
152 // the page, then this method should return true. | 145 // the page, then this method should return true. |
153 bool IsPrintScalingDisabled() const; | 146 bool IsPrintScalingDisabled() const override; |
154 // Returns true on success and sets the out parameter to the print preset | 147 // Returns true on success and sets the out parameter to the print preset |
155 // options for the document. | 148 // options for the document. |
156 bool GetPrintPresetOptionsFromDocument(WebPrintPresetOptions*) const; | 149 bool GetPrintPresetOptionsFromDocument(WebPrintPresetOptions*) const override; |
157 // Sets up printing at the specified WebPrintParams. Returns the number of | 150 // Sets up printing at the specified WebPrintParams. Returns the number of |
158 // pages to be printed at these settings. | 151 // pages to be printed at these settings. |
159 int PrintBegin(const WebPrintParams&) const; | 152 int PrintBegin(const WebPrintParams&) const override; |
160 // Prints the page specified by pageNumber (0-based index) into the supplied | 153 // Prints the page specified by pageNumber (0-based index) into the supplied |
161 // canvas. | 154 // canvas. |
162 void PrintPage(int page_number, GraphicsContext&, const IntRect& paint_rect); | 155 void PrintPage(int page_number, |
| 156 GraphicsContext&, |
| 157 const IntRect& paint_rect) override; |
163 // Ends the print operation. | 158 // Ends the print operation. |
164 void PrintEnd(); | 159 void PrintEnd() override; |
165 | 160 |
166 // Copy the selected text. | 161 // Copy the selected text. |
167 void Copy(); | 162 void Copy(); |
168 | 163 |
169 // Pass the edit command to the plugin. | 164 // Pass the edit command to the plugin. |
170 bool ExecuteEditCommand(const WebString& name); | 165 bool ExecuteEditCommand(const WebString& name) override; |
171 bool ExecuteEditCommand(const WebString& name, const WebString& value); | 166 bool ExecuteEditCommand(const WebString& name, |
| 167 const WebString& value) override; |
172 | 168 |
173 // Resource load events for the plugin's source data: | 169 // Resource load events for the plugin's source data: |
174 void DidReceiveResponse(const ResourceResponse&) override; | 170 void DidReceiveResponse(const ResourceResponse&) override; |
175 void DidReceiveData(const char* data, int data_length) override; | 171 void DidReceiveData(const char* data, int data_length) override; |
176 void DidFinishLoading(); | 172 void DidFinishLoading() override; |
177 void DidFailLoading(const ResourceError&); | 173 void DidFailLoading(const ResourceError&) override; |
178 | 174 |
179 DECLARE_VIRTUAL_TRACE(); | 175 DECLARE_VIRTUAL_TRACE(); |
180 void Dispose() override; | 176 void Dispose() override; |
181 | 177 |
182 private: | 178 private: |
183 // Sets |windowRect| to the content rect of the plugin in screen space. | 179 // Sets |windowRect| to the content rect of the plugin in screen space. |
184 // Sets |clippedAbsoluteRect| to the visible rect for the plugin, clipped to | 180 // Sets |clippedAbsoluteRect| to the visible rect for the plugin, clipped to |
185 // the visible screen of the root frame, in local space of the plugin. | 181 // the visible screen of the root frame, in local space of the plugin. |
186 // Sets |unclippedAbsoluteRect| to the visible rect for the plugin (but | 182 // Sets |unclippedAbsoluteRect| to the visible rect for the plugin (but |
187 // without also clipping to the screen), in local space of the plugin. | 183 // without also clipping to the screen), in local space of the plugin. |
(...skipping 17 matching lines...) Expand all Loading... |
205 void HandleGestureEvent(GestureEvent*); | 201 void HandleGestureEvent(GestureEvent*); |
206 | 202 |
207 void SynthesizeMouseEventIfPossible(TouchEvent*); | 203 void SynthesizeMouseEventIfPossible(TouchEvent*); |
208 | 204 |
209 void FocusPlugin(); | 205 void FocusPlugin(); |
210 | 206 |
211 void IssuePaintInvalidations(); | 207 void IssuePaintInvalidations(); |
212 | 208 |
213 void CalculateGeometry(IntRect& window_rect, | 209 void CalculateGeometry(IntRect& window_rect, |
214 IntRect& clip_rect, | 210 IntRect& clip_rect, |
215 IntRect& unobscured_rect); | 211 IntRect& unobscured_rect) override; |
216 | 212 |
217 friend class WebPluginContainerTest; | 213 friend class WebPluginContainerTest; |
218 | 214 |
219 Member<FrameView> parent_; | 215 Member<FrameView> parent_; |
220 Member<HTMLPlugInElement> element_; | 216 Member<HTMLPlugInElement> element_; |
221 WebPlugin* web_plugin_; | 217 WebPlugin* web_plugin_; |
222 WebLayer* web_layer_; | 218 WebLayer* web_layer_; |
223 IntRect frame_rect_; | 219 IntRect frame_rect_; |
224 IntRect pending_invalidation_rect_; | 220 IntRect pending_invalidation_rect_; |
225 TouchEventRequestType touch_event_request_type_; | 221 TouchEventRequestType touch_event_request_type_; |
(...skipping 12 matching lines...) Expand all Loading... |
238 // WebPluginContainerImpl is the only subclass of WebPluginContainer. | 234 // WebPluginContainerImpl is the only subclass of WebPluginContainer. |
239 DEFINE_TYPE_CASTS(WebPluginContainerImpl, | 235 DEFINE_TYPE_CASTS(WebPluginContainerImpl, |
240 WebPluginContainer, | 236 WebPluginContainer, |
241 container, | 237 container, |
242 true, | 238 true, |
243 true); | 239 true); |
244 | 240 |
245 } // namespace blink | 241 } // namespace blink |
246 | 242 |
247 #endif | 243 #endif |
OLD | NEW |