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