summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h')
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h207
1 files changed, 102 insertions, 105 deletions
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index 06d4c8ce2..bf569fe29 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,28 +39,28 @@
#include <wtf/text/StringHash.h>
namespace WebCore {
- class HTTPHeaderMap;
- class ProtectionSpace;
- class SharedBuffer;
+class MachSendRight;
+class HTTPHeaderMap;
+class ProtectionSpace;
+class SharedBuffer;
}
-OBJC_CLASS WKNPAPIPlugInContainer;
-
namespace WebKit {
class NetscapePluginStream;
-
+class NetscapePluginUnix;
+
class NetscapePlugin : public Plugin {
public:
- static PassRefPtr<NetscapePlugin> create(PassRefPtr<NetscapePluginModule> pluginModule);
+ static RefPtr<NetscapePlugin> create(PassRefPtr<NetscapePluginModule>);
virtual ~NetscapePlugin();
- static PassRefPtr<NetscapePlugin> fromNPP(NPP);
+ static RefPtr<NetscapePlugin> fromNPP(NPP);
// In-process NetscapePlugins don't support asynchronous initialization.
- virtual bool isBeingAsynchronouslyInitialized() const { return false; }
+ bool isBeingAsynchronouslyInitialized() const override { return false; }
-#if PLATFORM(MAC)
+#if PLATFORM(COCOA)
NPError setDrawingModel(NPDrawingModel);
NPError setEventModel(NPEventModel);
NPBool convertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double& destX, double& destY, NPCoordinateSpace destSpace);
@@ -71,14 +71,11 @@ public:
bool hasHandledAKeyDownEvent() const { return m_hasHandledAKeyDownEvent; }
- mach_port_t compositingRenderServerPort();
- void openPluginPreferencePane();
+ const WebCore::MachSendRight& compositingRenderServerPort();
// Computes an affine transform from the given coordinate space to the screen coordinate space.
bool getScreenTransform(NPCoordinateSpace sourceSpace, WebCore::AffineTransform&);
- WKNPAPIPlugInContainer* plugInContainer();
-
#ifndef NP_NO_CARBON
WindowRef windowRef() const;
bool isWindowActive() const { return m_windowHasFocus; }
@@ -90,6 +87,12 @@ public:
#endif
+#if PLUGIN_ARCHITECTURE(X11)
+ const WebCore::IntRect& frameRectInWindowCoordinates() const { return m_frameRectInWindowCoordinates; }
+#endif
+ const WebCore::IntRect& clipRect() const { return m_clipRect; }
+ const WebCore::IntSize& size() const { return m_pluginSize; }
+
PluginQuirks quirks() const { return m_pluginModule->pluginQuirks(); }
void invalidate(const NPRect*);
@@ -103,6 +106,9 @@ public:
static void setException(const String&);
bool evaluate(NPObject*, const String&scriptString, NPVariant* result);
bool isPrivateBrowsingEnabled();
+ bool isMuted() const;
+ bool isWindowed() const { return m_isWindowed; }
+ bool isVisible() const { return m_isVisible; }
static void setSetExceptionFunction(void (*)(const String&));
@@ -120,9 +126,6 @@ public:
void pluginThreadAsyncCall(void (*function)(void*), void* userData);
- // Called on the plug-in run loop (which is currently the main thread run loop).
- void handlePluginThreadAsyncCall(void (*function)(void*), void* userData);
-
unsigned scheduleTimer(unsigned interval, bool repeat, void (*timerFunc)(NPP, unsigned timerID));
void unscheduleTimer(unsigned timerID);
@@ -132,6 +135,11 @@ public:
void setCookiesForURL(const String& urlString, const String& cookieString);
bool getAuthenticationInfo(const WebCore::ProtectionSpace&, String& username, String& password);
+ void setIsPlayingAudio(bool);
+
+ void registerRedirect(NetscapePluginStream*, const WebCore::URL& requestURL, int redirectResponseStatus, void* notificationData);
+ void urlRedirectResponse(void* notifyData, bool allow);
+
// Member functions for calling into the plug-in.
NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData*);
NPError NPP_Destroy(NPSavedData**);
@@ -143,9 +151,13 @@ public:
int32_t NPP_Write(NPStream*, int32_t offset, int32_t len, void* buffer);
int16_t NPP_HandleEvent(void* event);
void NPP_URLNotify(const char* url, NPReason, void* notifyData);
+ bool NPP_URLRedirectNotify(const char* url, int32_t status, void* notifyData);
NPError NPP_GetValue(NPPVariable, void *value);
NPError NPP_SetValue(NPNVariable, void *value);
+ // Convert the given point from plug-in coordinates to root view coordinates.
+ WebCore::IntPoint convertToRootView(const WebCore::IntPoint&) const override;
+
private:
NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule);
@@ -164,7 +176,7 @@ private:
bool platformInvalidate(const WebCore::IntRect&);
void platformGeometryDidChange();
void platformVisibilityDidChange();
- void platformPaint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect, bool isSnapshot = false);
+ void platformPaint(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect, bool isSnapshot = false);
bool platformHandleMouseEvent(const WebMouseEvent&);
bool platformHandleWheelEvent(const WebWheelEvent&);
@@ -176,60 +188,62 @@ private:
static bool wantsPluginRelativeNPWindowCoordinates();
// Plugin
- virtual bool initialize(const Parameters&);
- virtual void destroy();
- virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect);
- virtual PassRefPtr<ShareableBitmap> snapshot();
-#if PLATFORM(MAC)
- virtual PlatformLayer* pluginLayer();
+ bool initialize(const Parameters&) override;
+ void destroy() override;
+ void paint(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect) override;
+ RefPtr<ShareableBitmap> snapshot() override;
+#if PLATFORM(COCOA)
+ PlatformLayer* pluginLayer() override;
#endif
- virtual bool isTransparent();
- virtual bool wantsWheelEvents() override;
- virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform);
- virtual void visibilityDidChange(bool isVisible);
- virtual void frameDidFinishLoading(uint64_t requestID);
- virtual void frameDidFail(uint64_t requestID, bool wasCancelled);
- virtual void didEvaluateJavaScript(uint64_t requestID, const String& result);
- virtual void streamDidReceiveResponse(uint64_t streamID, const WebCore::URL& responseURL, uint32_t streamLength,
- uint32_t lastModifiedTime, const String& mimeType, const String& headers, const String& suggestedFileName);
- virtual void streamDidReceiveData(uint64_t streamID, const char* bytes, int length);
- virtual void streamDidFinishLoading(uint64_t streamID);
- virtual void streamDidFail(uint64_t streamID, bool wasCancelled);
- virtual void manualStreamDidReceiveResponse(const WebCore::URL& responseURL, uint32_t streamLength,
- uint32_t lastModifiedTime, const String& mimeType, const String& headers, const String& suggestedFileName);
- virtual void manualStreamDidReceiveData(const char* bytes, int length);
- virtual void manualStreamDidFinishLoading();
- virtual void manualStreamDidFail(bool wasCancelled);
+ bool isTransparent() override;
+ bool wantsWheelEvents() override;
+ void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform) override;
+ void visibilityDidChange(bool isVisible) override;
+ void frameDidFinishLoading(uint64_t requestID) override;
+ void frameDidFail(uint64_t requestID, bool wasCancelled) override;
+ void didEvaluateJavaScript(uint64_t requestID, const String& result) override;
+ void streamWillSendRequest(uint64_t streamID, const WebCore::URL& requestURL, const WebCore::URL& responseURL, int responseStatus) override;
+ void streamDidReceiveResponse(uint64_t streamID, const WebCore::URL& responseURL, uint32_t streamLength,
+ uint32_t lastModifiedTime, const String& mimeType, const String& headers, const String& suggestedFileName) override;
+ void streamDidReceiveData(uint64_t streamID, const char* bytes, int length) override;
+ void streamDidFinishLoading(uint64_t streamID) override;
+ void streamDidFail(uint64_t streamID, bool wasCancelled) override;
+ void manualStreamDidReceiveResponse(const WebCore::URL& responseURL, uint32_t streamLength,
+ uint32_t lastModifiedTime, const String& mimeType, const String& headers, const String& suggestedFileName) override;
+ void manualStreamDidReceiveData(const char* bytes, int length) override;
+ void manualStreamDidFinishLoading() override;
+ void manualStreamDidFail(bool wasCancelled) override;
- virtual bool handleMouseEvent(const WebMouseEvent&);
- virtual bool handleWheelEvent(const WebWheelEvent&);
- virtual bool handleMouseEnterEvent(const WebMouseEvent&);
- virtual bool handleMouseLeaveEvent(const WebMouseEvent&);
- virtual bool handleContextMenuEvent(const WebMouseEvent&);
- virtual bool handleKeyboardEvent(const WebKeyboardEvent&);
- virtual void setFocus(bool);
-
- virtual bool handleEditingCommand(const String& commandName, const String& argument) override;
- virtual bool isEditingCommandEnabled(const String&) override;
-
- virtual bool shouldAllowScripting() override;
- virtual bool shouldAllowNavigationFromDrags() override;
+ bool handleMouseEvent(const WebMouseEvent&) override;
+ bool handleWheelEvent(const WebWheelEvent&) override;
+ bool handleMouseEnterEvent(const WebMouseEvent&) override;
+ bool handleMouseLeaveEvent(const WebMouseEvent&) override;
+ bool handleContextMenuEvent(const WebMouseEvent&) override;
+ bool handleKeyboardEvent(const WebKeyboardEvent&) override;
+ void setFocus(bool) override;
+
+ bool handleEditingCommand(const String& commandName, const String& argument) override;
+ bool isEditingCommandEnabled(const String&) override;
+
+ bool shouldAllowScripting() override;
+ bool shouldAllowNavigationFromDrags() override;
- virtual bool handlesPageScaleFactor() override;
+ bool handlesPageScaleFactor() const override;
- virtual NPObject* pluginScriptableNPObject();
+ NPObject* pluginScriptableNPObject() override;
- virtual unsigned countFindMatches(const String&, WebCore::FindOptions, unsigned maxMatchCount) override;
- virtual bool findString(const String&, WebCore::FindOptions, unsigned maxMatchCount) override;
+ unsigned countFindMatches(const String&, WebCore::FindOptions, unsigned maxMatchCount) override;
+ bool findString(const String&, WebCore::FindOptions, unsigned maxMatchCount) override;
+
+ void windowFocusChanged(bool) override;
+ void windowVisibilityChanged(bool) override;
-#if PLATFORM(MAC)
- virtual void windowFocusChanged(bool);
- virtual void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates);
- virtual void windowVisibilityChanged(bool);
+#if PLATFORM(COCOA)
+ void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates) override;
- virtual uint64_t pluginComplexTextInputIdentifier() const;
- virtual void sendComplexTextInput(const String& textInput);
- virtual void setLayerHostingMode(LayerHostingMode) override;
+ uint64_t pluginComplexTextInputIdentifier() const override;
+ void sendComplexTextInput(const String& textInput) override;
+ void setLayerHostingMode(LayerHostingMode) override;
void pluginFocusOrWindowFocusChanged();
void setComplexTextInputEnabled(bool);
@@ -237,40 +251,31 @@ private:
void updatePluginLayer();
#endif
- virtual void contentsScaleFactorChanged(float);
- virtual void storageBlockingStateChanged(bool);
- virtual void privateBrowsingStateChanged(bool);
- virtual bool getFormValue(String& formValue);
- virtual bool handleScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity);
- virtual WebCore::Scrollbar* horizontalScrollbar();
- virtual WebCore::Scrollbar* verticalScrollbar();
+ void contentsScaleFactorChanged(float) override;
+ void storageBlockingStateChanged(bool) override;
+ void privateBrowsingStateChanged(bool) override;
+ bool getFormValue(String& formValue) override;
+ bool handleScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity) override;
+ WebCore::Scrollbar* horizontalScrollbar() override;
+ WebCore::Scrollbar* verticalScrollbar() override;
- virtual bool supportsSnapshotting() const;
-
- // Convert the given point from plug-in coordinates to root view coordinates.
- virtual WebCore::IntPoint convertToRootView(const WebCore::IntPoint&) const override;
+ bool supportsSnapshotting() const override;
// Convert the given point from root view coordinates to plug-in coordinates. Returns false if the point can't be
// converted (if the transformation matrix isn't invertible).
bool convertFromRootView(const WebCore::IntPoint& pointInRootViewCoordinates, WebCore::IntPoint& pointInPluginCoordinates);
- virtual PassRefPtr<WebCore::SharedBuffer> liveResourceData() const override;
-
- virtual bool performDictionaryLookupAtLocation(const WebCore::FloatPoint&) override { return false; }
+ RefPtr<WebCore::SharedBuffer> liveResourceData() const override;
- virtual String getSelectionString() const override { return String(); }
+ bool performDictionaryLookupAtLocation(const WebCore::FloatPoint&) override { return false; }
- void updateNPNPrivateMode();
+ String getSelectionString() const override { return String(); }
+ String getSelectionForWordAtPoint(const WebCore::FloatPoint&) const override { return String(); }
+ bool existingSelectionContainsPoint(const WebCore::FloatPoint&) const override { return false; }
-#if PLUGIN_ARCHITECTURE(WIN)
- static BOOL WINAPI hookedTrackPopupMenu(HMENU, UINT uFlags, int x, int y, int nReserved, HWND, const RECT*);
- void scheduleWindowedGeometryUpdate();
-#endif
+ void mutedStateChanged(bool) override;
-#if PLUGIN_ARCHITECTURE(X11)
- bool platformPostInitializeWindowed(bool needsXEmbed, uint64_t windowID);
- bool platformPostInitializeWindowless();
-#endif
+ void updateNPNPrivateMode();
uint64_t m_nextRequestID;
@@ -279,6 +284,7 @@ private:
typedef HashMap<uint64_t, RefPtr<NetscapePluginStream>> StreamsMap;
StreamsMap m_streams;
+ HashMap<void*, std::pair<RefPtr<NetscapePluginStream>, String>> m_redirects;
RefPtr<NetscapePluginModule> m_pluginModule;
NPP_t m_npp;
@@ -292,8 +298,9 @@ private:
// A transform that can be used to convert from root view coordinates to plug-in coordinates.
WebCore::AffineTransform m_pluginToRootViewTransform;
- // FIXME: Get rid of these.
+#if PLUGIN_ARCHITECTURE(X11)
WebCore::IntRect m_frameRectInWindowCoordinates;
+#endif
CString m_userAgent;
@@ -365,14 +372,12 @@ private:
// if we can tell the plug-in that we support the updated Cocoa text input specification.
bool m_hasHandledAKeyDownEvent;
- // The number of NPCocoaEventKeyUp events that should be ignored.
+ // The number of NPCocoaEventKeyUp events that should be ignored.
unsigned m_ignoreNextKeyUpEventCounter;
WebCore::IntRect m_windowFrameInScreenCoordinates;
WebCore::IntRect m_viewFrameInWindowCoordinates;
- RetainPtr<WKNPAPIPlugInContainer> m_plugInContainer;
-
#ifndef NP_NO_CARBON
void nullEventTimerFired();
@@ -381,23 +386,15 @@ private:
RunLoop::Timer<NetscapePlugin> m_nullEventTimer;
NP_CGContext m_npCGContext;
#endif
-#elif PLUGIN_ARCHITECTURE(WIN)
- HWND m_window;
- HWND m_contextMenuOwnerWindow;
#elif PLUGIN_ARCHITECTURE(X11)
- Pixmap m_drawable;
- Display* m_pluginDisplay;
-#if PLATFORM(GTK)
- GtkWidget* m_platformPluginWidget;
-#endif
-
-public: // Need to call it in the NPN_GetValue browser callback.
- static Display* x11HostDisplay();
+ std::unique_ptr<NetscapePluginUnix> m_impl;
#endif
};
} // namespace WebKit
+SPECIALIZE_TYPE_TRAITS_PLUGIN(NetscapePlugin, NetscapePluginType)
+
#endif // ENABLE(NETSCAPE_PLUGIN_API)
#endif // NetscapePlugin_h