| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 class WebPluginContainerImpl final : public PluginView, public WebPluginContaine
r, public LocalFrameLifecycleObserver { | 64 class WebPluginContainerImpl final : public PluginView, public WebPluginContaine
r, public LocalFrameLifecycleObserver { |
| 65 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebPluginContainerImpl); | 65 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebPluginContainerImpl); |
| 66 public: | 66 public: |
| 67 static PassRefPtrWillBeRawPtr<WebPluginContainerImpl> create(HTMLPlugInEleme
nt* element, WebPlugin* webPlugin) | 67 static PassRefPtrWillBeRawPtr<WebPluginContainerImpl> create(HTMLPlugInEleme
nt* element, WebPlugin* webPlugin) |
| 68 { | 68 { |
| 69 return adoptRefWillBeNoop(new WebPluginContainerImpl(element, webPlugin)
); | 69 return adoptRefWillBeNoop(new WebPluginContainerImpl(element, webPlugin)
); |
| 70 } | 70 } |
| 71 | 71 |
| 72 // PluginView methods | 72 // PluginView methods |
| 73 virtual WebLayer* platformLayer() const override; | 73 WebLayer* platformLayer() const override; |
| 74 virtual v8::Local<v8::Object> scriptableObject(v8::Isolate*) override; | 74 v8::Local<v8::Object> scriptableObject(v8::Isolate*) override; |
| 75 virtual bool getFormValue(String&) override; | 75 bool getFormValue(String&) override; |
| 76 virtual bool supportsKeyboardFocus() const override; | 76 bool supportsKeyboardFocus() const override; |
| 77 virtual bool supportsInputMethod() const override; | 77 bool supportsInputMethod() const override; |
| 78 virtual bool canProcessDrag() const override; | 78 bool canProcessDrag() const override; |
| 79 virtual bool wantsWheelEvents() override; | 79 bool wantsWheelEvents() override; |
| 80 virtual void layoutIfNeeded() override; | 80 void layoutIfNeeded() override; |
| 81 virtual void invalidatePaintIfNeeded() override { issuePaintInvalidations();
} | 81 void invalidatePaintIfNeeded() override { issuePaintInvalidations(); } |
| 82 | 82 |
| 83 // Widget methods | 83 // Widget methods |
| 84 virtual void setFrameRect(const IntRect&) override; | 84 void setFrameRect(const IntRect&) override; |
| 85 virtual void paint(GraphicsContext*, const IntRect&) override; | 85 void paint(GraphicsContext*, const IntRect&) override; |
| 86 virtual void invalidateRect(const IntRect&) override; | 86 void invalidateRect(const IntRect&) override; |
| 87 virtual void setFocus(bool, WebFocusType) override; | 87 void setFocus(bool, WebFocusType) override; |
| 88 virtual void show() override; | 88 void show() override; |
| 89 virtual void hide() override; | 89 void hide() override; |
| 90 virtual void handleEvent(Event*) override; | 90 void handleEvent(Event*) override; |
| 91 virtual void frameRectsChanged() override; | 91 void frameRectsChanged() override; |
| 92 virtual void setParentVisible(bool) override; | 92 void setParentVisible(bool) override; |
| 93 virtual void setParent(Widget*) override; | 93 void setParent(Widget*) override; |
| 94 virtual void widgetPositionsUpdated() override; | 94 void widgetPositionsUpdated() override; |
| 95 virtual bool isPluginContainer() const override { return true; } | 95 bool isPluginContainer() const override { return true; } |
| 96 virtual void eventListenersRemoved() override; | 96 void eventListenersRemoved() override; |
| 97 virtual bool pluginShouldPersist() const override; | 97 bool pluginShouldPersist() const override; |
| 98 | 98 |
| 99 // WebPluginContainer methods | 99 // WebPluginContainer methods |
| 100 virtual WebElement element() override; | 100 WebElement element() override; |
| 101 virtual void invalidate() override; | 101 void invalidate() override; |
| 102 virtual void invalidateRect(const WebRect&) override; | 102 void invalidateRect(const WebRect&) override; |
| 103 virtual void scrollRect(const WebRect&) override; | 103 void scrollRect(const WebRect&) override; |
| 104 virtual void setNeedsLayout() override; | 104 void setNeedsLayout() override; |
| 105 virtual void reportGeometry() override; | 105 void reportGeometry() override; |
| 106 virtual void allowScriptObjects() override; | 106 void allowScriptObjects() override; |
| 107 virtual void clearScriptObjects() override; | 107 void clearScriptObjects() override; |
| 108 virtual NPObject* scriptableObjectForElement() override; | 108 NPObject* scriptableObjectForElement() override; |
| 109 virtual v8::Local<v8::Object> v8ObjectForElement() override; | 109 v8::Local<v8::Object> v8ObjectForElement() override; |
| 110 virtual WebString executeScriptURL(const WebURL&, bool popupsAllowed) overri
de; | 110 WebString executeScriptURL(const WebURL&, bool popupsAllowed) override; |
| 111 virtual void loadFrameRequest(const WebURLRequest&, const WebString& target,
bool notifyNeeded, void* notifyData) override; | 111 void loadFrameRequest(const WebURLRequest&, const WebString& target, bool no
tifyNeeded, void* notifyData) override; |
| 112 virtual void zoomLevelChanged(double zoomLevel) override; | 112 void zoomLevelChanged(double zoomLevel) override; |
| 113 virtual bool isRectTopmost(const WebRect&) override; | 113 bool isRectTopmost(const WebRect&) override; |
| 114 virtual void requestTouchEventType(TouchEventRequestType) override; | 114 void requestTouchEventType(TouchEventRequestType) override; |
| 115 virtual void setWantsWheelEvents(bool) override; | 115 void setWantsWheelEvents(bool) override; |
| 116 virtual WebPoint rootFrameToLocalPoint(const WebPoint&) override; | 116 WebPoint rootFrameToLocalPoint(const WebPoint&) override; |
| 117 virtual WebPoint localToRootFramePoint(const WebPoint&) override; | 117 WebPoint localToRootFramePoint(const WebPoint&) override; |
| 118 | 118 |
| 119 // This cannot be null. | 119 // This cannot be null. |
| 120 virtual WebPlugin* plugin() override { return m_webPlugin; } | 120 WebPlugin* plugin() override { return m_webPlugin; } |
| 121 virtual void setPlugin(WebPlugin*) override; | 121 void setPlugin(WebPlugin*) override; |
| 122 | 122 |
| 123 virtual float deviceScaleFactor() override; | 123 float deviceScaleFactor() override; |
| 124 virtual float pageScaleFactor() override; | 124 float pageScaleFactor() override; |
| 125 virtual float pageZoomFactor() override; | 125 float pageZoomFactor() override; |
| 126 | 126 |
| 127 virtual void setWebLayer(WebLayer*); | 127 virtual void setWebLayer(WebLayer*); |
| 128 | 128 |
| 129 // Printing interface. The plugin can support custom printing | 129 // Printing interface. The plugin can support custom printing |
| 130 // (which means it controls the layout, number of pages etc). | 130 // (which means it controls the layout, number of pages etc). |
| 131 // Whether the plugin supports its own paginated print. The other print | 131 // Whether the plugin supports its own paginated print. The other print |
| 132 // interface methods are called only if this method returns true. | 132 // interface methods are called only if this method returns true. |
| 133 bool supportsPaginatedPrint() const; | 133 bool supportsPaginatedPrint() const; |
| 134 // If the plugin content should not be scaled to the printable area of | 134 // If the plugin content should not be scaled to the printable area of |
| 135 // the page, then this method should return true. | 135 // the page, then this method should return true. |
| 136 bool isPrintScalingDisabled() const; | 136 bool isPrintScalingDisabled() const; |
| 137 // Returns true on success and sets the out parameter to the print preset op
tions for the document. | 137 // Returns true on success and sets the out parameter to the print preset op
tions for the document. |
| 138 bool getPrintPresetOptionsFromDocument(WebPrintPresetOptions*) const; | 138 bool getPrintPresetOptionsFromDocument(WebPrintPresetOptions*) const; |
| 139 // Sets up printing at the specified WebPrintParams. Returns the number of p
ages to be printed at these settings. | 139 // Sets up printing at the specified WebPrintParams. Returns the number of p
ages to be printed at these settings. |
| 140 int printBegin(const WebPrintParams&) const; | 140 int printBegin(const WebPrintParams&) const; |
| 141 // Prints the page specified by pageNumber (0-based index) into the supplied
canvas. | 141 // Prints the page specified by pageNumber (0-based index) into the supplied
canvas. |
| 142 void printPage(int pageNumber, GraphicsContext*, const IntRect& paintRect); | 142 void printPage(int pageNumber, GraphicsContext*, const IntRect& paintRect); |
| 143 // Ends the print operation. | 143 // Ends the print operation. |
| 144 void printEnd(); | 144 void printEnd(); |
| 145 | 145 |
| 146 // Copy the selected text. | 146 // Copy the selected text. |
| 147 void copy(); | 147 void copy(); |
| 148 | 148 |
| 149 // Pass the edit command to the plugin. | 149 // Pass the edit command to the plugin. |
| 150 bool executeEditCommand(const WebString& name); | 150 bool executeEditCommand(const WebString& name); |
| 151 bool executeEditCommand(const WebString& name, const WebString& value); | 151 bool executeEditCommand(const WebString& name, const WebString& value); |
| 152 | 152 |
| 153 // Resource load events for the plugin's source data: | 153 // Resource load events for the plugin's source data: |
| 154 virtual void didReceiveResponse(const ResourceResponse&) override; | 154 void didReceiveResponse(const ResourceResponse&) override; |
| 155 virtual void didReceiveData(const char *data, int dataLength) override; | 155 void didReceiveData(const char *data, int dataLength) override; |
| 156 virtual void didFinishLoading() override; | 156 void didFinishLoading() override; |
| 157 virtual void didFailLoading(const ResourceError&) override; | 157 void didFailLoading(const ResourceError&) override; |
| 158 | 158 |
| 159 void willDestroyPluginLoadObserver(WebPluginLoadObserver*); | 159 void willDestroyPluginLoadObserver(WebPluginLoadObserver*); |
| 160 | 160 |
| 161 DECLARE_VIRTUAL_TRACE(); | 161 DECLARE_VIRTUAL_TRACE(); |
| 162 virtual void dispose() override; | 162 void dispose() override; |
| 163 | 163 |
| 164 #if ENABLE(OILPAN) | 164 #if ENABLE(OILPAN) |
| 165 virtual LocalFrame* pluginFrame() const override { return frame(); } | 165 LocalFrame* pluginFrame() const override { return frame(); } |
| 166 virtual void shouldDisposePlugin() override; | 166 void shouldDisposePlugin() override; |
| 167 #endif | 167 #endif |
| 168 | 168 |
| 169 private: | 169 private: |
| 170 WebPluginContainerImpl(HTMLPlugInElement*, WebPlugin*); | 170 WebPluginContainerImpl(HTMLPlugInElement*, WebPlugin*); |
| 171 virtual ~WebPluginContainerImpl(); | 171 ~WebPluginContainerImpl() override; |
| 172 | 172 |
| 173 void handleMouseEvent(MouseEvent*); | 173 void handleMouseEvent(MouseEvent*); |
| 174 void handleDragEvent(MouseEvent*); | 174 void handleDragEvent(MouseEvent*); |
| 175 void handleWheelEvent(WheelEvent*); | 175 void handleWheelEvent(WheelEvent*); |
| 176 void handleKeyboardEvent(KeyboardEvent*); | 176 void handleKeyboardEvent(KeyboardEvent*); |
| 177 void handleTouchEvent(TouchEvent*); | 177 void handleTouchEvent(TouchEvent*); |
| 178 void handleGestureEvent(GestureEvent*); | 178 void handleGestureEvent(GestureEvent*); |
| 179 | 179 |
| 180 void synthesizeMouseEventIfPossible(TouchEvent*); | 180 void synthesizeMouseEventIfPossible(TouchEvent*); |
| 181 | 181 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 DEFINE_TYPE_CASTS(WebPluginContainerImpl, Widget, widget, widget->isPluginContai
ner(), widget.isPluginContainer()); | 216 DEFINE_TYPE_CASTS(WebPluginContainerImpl, Widget, widget, widget->isPluginContai
ner(), widget.isPluginContainer()); |
| 217 // Unlike Widget, we need not worry about object type for container. | 217 // Unlike Widget, we need not worry about object type for container. |
| 218 // WebPluginContainerImpl is the only subclass of WebPluginContainer. | 218 // WebPluginContainerImpl is the only subclass of WebPluginContainer. |
| 219 DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebPluginContainer, container, true, t
rue); | 219 DEFINE_TYPE_CASTS(WebPluginContainerImpl, WebPluginContainer, container, true, t
rue); |
| 220 | 220 |
| 221 } // namespace blink | 221 } // namespace blink |
| 222 | 222 |
| 223 #endif | 223 #endif |
| OLD | NEW |