summaryrefslogtreecommitdiff
path: root/dom/plugins/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'dom/plugins/ipc')
-rw-r--r--dom/plugins/ipc/NPEventOSX.h193
-rw-r--r--dom/plugins/ipc/PluginInstanceChild.cpp385
-rw-r--r--dom/plugins/ipc/PluginInstanceChild.h15
-rw-r--r--dom/plugins/ipc/PluginInstanceParent.cpp256
-rw-r--r--dom/plugins/ipc/PluginInstanceParent.h5
-rw-r--r--dom/plugins/ipc/PluginInterposeOSX.h137
-rw-r--r--dom/plugins/ipc/PluginInterposeOSX.mm1158
-rw-r--r--dom/plugins/ipc/PluginLibrary.h9
-rw-r--r--dom/plugins/ipc/PluginMessageUtils.cpp5
-rw-r--r--dom/plugins/ipc/PluginMessageUtils.h204
-rw-r--r--dom/plugins/ipc/PluginModuleChild.cpp14
-rwxr-xr-xdom/plugins/ipc/PluginModuleParent.cpp108
-rw-r--r--dom/plugins/ipc/PluginModuleParent.h15
-rw-r--r--dom/plugins/ipc/PluginProcessChild.cpp55
-rw-r--r--dom/plugins/ipc/PluginProcessParent.cpp7
-rw-r--r--dom/plugins/ipc/PluginQuirks.cpp10
-rw-r--r--dom/plugins/ipc/PluginUtilsOSX.h92
-rw-r--r--dom/plugins/ipc/PluginUtilsOSX.mm462
-rw-r--r--dom/plugins/ipc/interpose/moz.build12
-rw-r--r--dom/plugins/ipc/interpose/plugin_child_interpose.mm134
-rw-r--r--dom/plugins/ipc/moz.build16
21 files changed, 59 insertions, 3233 deletions
diff --git a/dom/plugins/ipc/NPEventOSX.h b/dom/plugins/ipc/NPEventOSX.h
deleted file mode 100644
index efb6845d04..0000000000
--- a/dom/plugins/ipc/NPEventOSX.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_plugins_NPEventOSX_h
-#define mozilla_dom_plugins_NPEventOSX_h 1
-
-
-#include "npapi.h"
-
-namespace mozilla {
-
-namespace plugins {
-
-struct NPRemoteEvent {
- NPCocoaEvent event;
- double contentsScaleFactor;
-};
-
-} // namespace plugins
-
-} // namespace mozilla
-
-namespace IPC {
-
-template <>
-struct ParamTraits<mozilla::plugins::NPRemoteEvent>
-{
- typedef mozilla::plugins::NPRemoteEvent paramType;
-
- static void Write(Message* aMsg, const paramType& aParam)
- {
- aMsg->WriteInt(aParam.event.type);
- aMsg->WriteUInt32(aParam.event.version);
- switch (aParam.event.type) {
- case NPCocoaEventMouseDown:
- case NPCocoaEventMouseUp:
- case NPCocoaEventMouseMoved:
- case NPCocoaEventMouseEntered:
- case NPCocoaEventMouseExited:
- case NPCocoaEventMouseDragged:
- case NPCocoaEventScrollWheel:
- aMsg->WriteUInt32(aParam.event.data.mouse.modifierFlags);
- aMsg->WriteDouble(aParam.event.data.mouse.pluginX);
- aMsg->WriteDouble(aParam.event.data.mouse.pluginY);
- aMsg->WriteInt32(aParam.event.data.mouse.buttonNumber);
- aMsg->WriteInt32(aParam.event.data.mouse.clickCount);
- aMsg->WriteDouble(aParam.event.data.mouse.deltaX);
- aMsg->WriteDouble(aParam.event.data.mouse.deltaY);
- aMsg->WriteDouble(aParam.event.data.mouse.deltaZ);
- break;
- case NPCocoaEventKeyDown:
- case NPCocoaEventKeyUp:
- case NPCocoaEventFlagsChanged:
- aMsg->WriteUInt32(aParam.event.data.key.modifierFlags);
- WriteParam(aMsg, aParam.event.data.key.characters);
- WriteParam(aMsg, aParam.event.data.key.charactersIgnoringModifiers);
- aMsg->WriteUnsignedChar(aParam.event.data.key.isARepeat);
- aMsg->WriteUInt16(aParam.event.data.key.keyCode);
- break;
- case NPCocoaEventFocusChanged:
- case NPCocoaEventWindowFocusChanged:
- aMsg->WriteUnsignedChar(aParam.event.data.focus.hasFocus);
- break;
- case NPCocoaEventDrawRect:
- // We don't write out the context pointer, it would always be
- // nullptr and is just filled in as such on the read.
- aMsg->WriteDouble(aParam.event.data.draw.x);
- aMsg->WriteDouble(aParam.event.data.draw.y);
- aMsg->WriteDouble(aParam.event.data.draw.width);
- aMsg->WriteDouble(aParam.event.data.draw.height);
- break;
- case NPCocoaEventTextInput:
- WriteParam(aMsg, aParam.event.data.text.text);
- break;
- default:
- NS_NOTREACHED("Attempted to serialize unknown event type.");
- return;
- }
- aMsg->WriteDouble(aParam.contentsScaleFactor);
- }
-
- static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
- {
- int type = 0;
- if (!aMsg->ReadInt(aIter, &type)) {
- return false;
- }
- aResult->event.type = static_cast<NPCocoaEventType>(type);
-
- if (!aMsg->ReadUInt32(aIter, &aResult->event.version)) {
- return false;
- }
-
- switch (aResult->event.type) {
- case NPCocoaEventMouseDown:
- case NPCocoaEventMouseUp:
- case NPCocoaEventMouseMoved:
- case NPCocoaEventMouseEntered:
- case NPCocoaEventMouseExited:
- case NPCocoaEventMouseDragged:
- case NPCocoaEventScrollWheel:
- if (!aMsg->ReadUInt32(aIter, &aResult->event.data.mouse.modifierFlags)) {
- return false;
- }
- if (!aMsg->ReadDouble(aIter, &aResult->event.data.mouse.pluginX)) {
- return false;
- }
- if (!aMsg->ReadDouble(aIter, &aResult->event.data.mouse.pluginY)) {
- return false;
- }
- if (!aMsg->ReadInt32(aIter, &aResult->event.data.mouse.buttonNumber)) {
- return false;
- }
- if (!aMsg->ReadInt32(aIter, &aResult->event.data.mouse.clickCount)) {
- return false;
- }
- if (!aMsg->ReadDouble(aIter, &aResult->event.data.mouse.deltaX)) {
- return false;
- }
- if (!aMsg->ReadDouble(aIter, &aResult->event.data.mouse.deltaY)) {
- return false;
- }
- if (!aMsg->ReadDouble(aIter, &aResult->event.data.mouse.deltaZ)) {
- return false;
- }
- break;
- case NPCocoaEventKeyDown:
- case NPCocoaEventKeyUp:
- case NPCocoaEventFlagsChanged:
- if (!aMsg->ReadUInt32(aIter, &aResult->event.data.key.modifierFlags)) {
- return false;
- }
- if (!ReadParam(aMsg, aIter, &aResult->event.data.key.characters)) {
- return false;
- }
- if (!ReadParam(aMsg, aIter, &aResult->event.data.key.charactersIgnoringModifiers)) {
- return false;
- }
- if (!aMsg->ReadUnsignedChar(aIter, &aResult->event.data.key.isARepeat)) {
- return false;
- }
- if (!aMsg->ReadUInt16(aIter, &aResult->event.data.key.keyCode)) {
- return false;
- }
- break;
- case NPCocoaEventFocusChanged:
- case NPCocoaEventWindowFocusChanged:
- if (!aMsg->ReadUnsignedChar(aIter, &aResult->event.data.focus.hasFocus)) {
- return false;
- }
- break;
- case NPCocoaEventDrawRect:
- aResult->event.data.draw.context = nullptr;
- if (!aMsg->ReadDouble(aIter, &aResult->event.data.draw.x)) {
- return false;
- }
- if (!aMsg->ReadDouble(aIter, &aResult->event.data.draw.y)) {
- return false;
- }
- if (!aMsg->ReadDouble(aIter, &aResult->event.data.draw.width)) {
- return false;
- }
- if (!aMsg->ReadDouble(aIter, &aResult->event.data.draw.height)) {
- return false;
- }
- break;
- case NPCocoaEventTextInput:
- if (!ReadParam(aMsg, aIter, &aResult->event.data.text.text)) {
- return false;
- }
- break;
- default:
- NS_NOTREACHED("Attempted to de-serialize unknown event type.");
- return false;
- }
- if (!aMsg->ReadDouble(aIter, &aResult->contentsScaleFactor)) {
- return false;
- }
-
- return true;
- }
-
- static void Log(const paramType& aParam, std::wstring* aLog)
- {
- aLog->append(L"(NPCocoaEvent)");
- }
-};
-
-} // namespace IPC
-
-#endif // ifndef mozilla_dom_plugins_NPEventOSX_h
diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp
index a4f6b6b517..e96ebb1473 100644
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -103,11 +103,7 @@ using mozilla::gfx::SharedDIB;
const int kFlashWMUSERMessageThrottleDelayMs = 5;
static const TCHAR kPluginIgnoreSubclassProperty[] = TEXT("PluginIgnoreSubclassProperty");
-
-#elif defined(XP_MACOSX)
-#include <ApplicationServices/ApplicationServices.h>
-#include "PluginUtilsOSX.h"
-#endif // defined(XP_MACOSX)
+#endif
/**
* We can't use gfxPlatform::CreateDrawTargetForSurface() because calling
@@ -198,7 +194,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
mWindow.type = NPWindowTypeWindow;
mData.ndata = (void*) this;
mData.pdata = nullptr;
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(MOZ_X11) && defined(XP_UNIX)
mWindow.ws_info = &mWsInfo;
memset(&mWsInfo, 0, sizeof(mWsInfo));
#ifdef MOZ_WIDGET_GTK
@@ -207,7 +203,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
#else
mWsInfo.display = DefaultXDisplay();
#endif
-#endif // MOZ_X11 && XP_UNIX && !XP_MACOSX
+#endif // MOZ_X11 && XP_UNIX
#if defined(OS_WIN)
InitPopupMenuHook();
if (GetQuirks() & QUIRK_UNITY_FIXUP_MOUSE_CAPTURE) {
@@ -274,23 +270,6 @@ PluginInstanceChild::DoNPP_New()
Initialize();
-#if defined(XP_MACOSX) && defined(__i386__)
- // If an i386 Mac OS X plugin has selected the Carbon event model then
- // we have to fail. We do not support putting Carbon event model plugins
- // out of process. Note that Carbon is the default model so out of process
- // plugins need to actively negotiate something else in order to work
- // out of process.
- if (EventModel() == NPEventModelCarbon) {
- // Send notification that a plugin tried to negotiate Carbon NPAPI so that
- // users can be notified that restarting the browser in i386 mode may allow
- // them to use the plugin.
- SendNegotiatedCarbon();
-
- // Fail to instantiate.
- rv = NPERR_MODULE_LOAD_FAILED_ERROR;
- }
-#endif
-
return rv;
}
@@ -498,58 +477,12 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
}
#endif
-#ifdef XP_MACOSX
- case NPNVsupportsCoreGraphicsBool: {
- *((NPBool*)aValue) = true;
- return NPERR_NO_ERROR;
- }
-
- case NPNVsupportsCoreAnimationBool: {
- *((NPBool*)aValue) = true;
- return NPERR_NO_ERROR;
- }
-
- case NPNVsupportsInvalidatingCoreAnimationBool: {
- *((NPBool*)aValue) = true;
- return NPERR_NO_ERROR;
- }
-
- case NPNVsupportsCompositingCoreAnimationPluginsBool: {
- *((NPBool*)aValue) = true;
- return NPERR_NO_ERROR;
- }
-
- case NPNVsupportsCocoaBool: {
- *((NPBool*)aValue) = true;
- return NPERR_NO_ERROR;
- }
-
-#ifndef NP_NO_CARBON
- case NPNVsupportsCarbonBool: {
- *((NPBool*)aValue) = false;
- return NPERR_NO_ERROR;
- }
-#endif
-
- case NPNVsupportsUpdatedCocoaTextInputBool: {
- *static_cast<NPBool*>(aValue) = true;
- return NPERR_NO_ERROR;
- }
-
-#ifndef NP_NO_QUICKDRAW
- case NPNVsupportsQuickDrawBool: {
- *((NPBool*)aValue) = false;
- return NPERR_NO_ERROR;
- }
-#endif /* NP_NO_QUICKDRAW */
-#endif /* XP_MACOSX */
-
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
case NPNVcontentsScaleFactor: {
*static_cast<double*>(aValue) = mContentsScaleFactor;
return NPERR_NO_ERROR;
}
-#endif /* defined(XP_MACOSX) || defined(XP_WIN) */
+#endif /* defined(XP_WIN) */
case NPNVCSSZoomFactor: {
*static_cast<double*>(aValue) = mCSSZoomFactor;
@@ -654,36 +587,12 @@ PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue)
mDrawingModel = drawingModel;
-#ifdef XP_MACOSX
- if (drawingModel == NPDrawingModelCoreAnimation) {
- mCARefreshTimer = ScheduleTimer(DEFAULT_REFRESH_MS, true, CAUpdate);
- }
-#endif
-
PLUGIN_LOG_DEBUG((" Plugin requested drawing model id #%i\n",
mDrawingModel));
return rv;
}
-#ifdef XP_MACOSX
- case NPPVpluginEventModel: {
- NPError rv;
- int eventModel = (int16_t) (intptr_t) aValue;
-
- if (!CallNPN_SetValue_NPPVpluginEventModel(eventModel, &rv))
- return NPERR_GENERIC_ERROR;
-#if defined(__i386__)
- mEventModel = static_cast<NPEventModel>(eventModel);
-#endif
-
- PLUGIN_LOG_DEBUG((" Plugin requested event model id # %i\n",
- eventModel));
-
- return rv;
- }
-#endif
-
case NPPVpluginIsPlayingAudio: {
NPError rv = NPERR_GENERIC_ERROR;
if (!CallNPN_SetValue_NPPVpluginIsPlayingAudio((NPBool)(intptr_t)aValue, &rv)) {
@@ -907,21 +816,10 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event,
event.event.xgraphicsexpose.drawable));
#endif
-#ifdef XP_MACOSX
- // Mac OS X does not define an NPEvent structure. It defines more specific types.
- NPCocoaEvent evcopy = event.event;
-
- // Make sure we reset mCurrentEvent in case of an exception
- AutoRestore<const NPCocoaEvent*> savePreviousEvent(mCurrentEvent);
-
- // Track the current event for NPN_PopUpContextMenu.
- mCurrentEvent = &event.event;
-#else
// Make a copy since we may modify values.
NPEvent evcopy = event.event;
-#endif
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
// event.contentsScaleFactor <= 0 is a signal we shouldn't use it,
// for example when AnswerNPP_HandleEvent() is called from elsewhere
// in the child process (not via rpc code from the parent process).
@@ -947,18 +845,6 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event,
else
*handled = mPluginIface->event(&mData, reinterpret_cast<void*>(&evcopy));
-#ifdef XP_MACOSX
- // Release any reference counted objects created in the child process.
- if (evcopy.type == NPCocoaEventKeyDown ||
- evcopy.type == NPCocoaEventKeyUp) {
- ::CFRelease((CFStringRef)evcopy.data.key.characters);
- ::CFRelease((CFStringRef)evcopy.data.key.charactersIgnoringModifiers);
- }
- else if (evcopy.type == NPCocoaEventTextInput) {
- ::CFRelease((CFStringRef)evcopy.data.text.text);
- }
-#endif
-
#ifdef MOZ_X11
if (GraphicsExpose == event.event.type) {
// Make sure the X server completes the drawing before the parent
@@ -975,73 +861,6 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event,
return true;
}
-#ifdef XP_MACOSX
-
-bool
-PluginInstanceChild::AnswerNPP_HandleEvent_Shmem(const NPRemoteEvent& event,
- Shmem&& mem,
- int16_t* handled,
- Shmem* rtnmem)
-{
- PLUGIN_LOG_DEBUG_FUNCTION;
- AssertPluginThread();
- AutoStackHelper guard(this);
-
- PaintTracker pt;
-
- NPCocoaEvent evcopy = event.event;
- mContentsScaleFactor = event.contentsScaleFactor;
-
- if (evcopy.type == NPCocoaEventDrawRect) {
- int scaleFactor = ceil(mContentsScaleFactor);
- if (!mShColorSpace) {
- mShColorSpace = CreateSystemColorSpace();
- if (!mShColorSpace) {
- PLUGIN_LOG_DEBUG(("Could not allocate ColorSpace."));
- *handled = false;
- *rtnmem = mem;
- return true;
- }
- }
- if (!mShContext) {
- void* cgContextByte = mem.get<char>();
- mShContext = ::CGBitmapContextCreate(cgContextByte,
- mWindow.width * scaleFactor,
- mWindow.height * scaleFactor, 8,
- mWindow.width * 4 * scaleFactor, mShColorSpace,
- kCGImageAlphaPremultipliedFirst |
- kCGBitmapByteOrder32Host);
-
- if (!mShContext) {
- PLUGIN_LOG_DEBUG(("Could not allocate CGBitmapContext."));
- *handled = false;
- *rtnmem = mem;
- return true;
- }
- }
- CGRect clearRect = ::CGRectMake(0, 0, mWindow.width, mWindow.height);
- ::CGContextClearRect(mShContext, clearRect);
- evcopy.data.draw.context = mShContext;
- } else {
- PLUGIN_LOG_DEBUG(("Invalid event type for AnswerNNP_HandleEvent_Shmem."));
- *handled = false;
- *rtnmem = mem;
- return true;
- }
-
- if (!mPluginIface->event) {
- *handled = false;
- } else {
- ::CGContextSaveGState(evcopy.data.draw.context);
- *handled = mPluginIface->event(&mData, reinterpret_cast<void*>(&evcopy));
- ::CGContextRestoreGState(evcopy.data.draw.context);
- }
-
- *rtnmem = mem;
- return true;
-}
-
-#else
bool
PluginInstanceChild::AnswerNPP_HandleEvent_Shmem(const NPRemoteEvent& event,
Shmem&& mem,
@@ -1052,110 +871,15 @@ PluginInstanceChild::AnswerNPP_HandleEvent_Shmem(const NPRemoteEvent& event,
*rtnmem = mem;
return true;
}
-#endif
-
-#ifdef XP_MACOSX
-
-void CallCGDraw(CGContextRef ref, void* aPluginInstance, nsIntRect aUpdateRect) {
- PluginInstanceChild* pluginInstance = (PluginInstanceChild*)aPluginInstance;
-
- pluginInstance->CGDraw(ref, aUpdateRect);
-}
-
-bool
-PluginInstanceChild::CGDraw(CGContextRef ref, nsIntRect aUpdateRect) {
-
- NPCocoaEvent drawEvent;
- drawEvent.type = NPCocoaEventDrawRect;
- drawEvent.version = 0;
- drawEvent.data.draw.x = aUpdateRect.x;
- drawEvent.data.draw.y = aUpdateRect.y;
- drawEvent.data.draw.width = aUpdateRect.width;
- drawEvent.data.draw.height = aUpdateRect.height;
- drawEvent.data.draw.context = ref;
-
- NPRemoteEvent remoteDrawEvent = {drawEvent};
- // Signal to AnswerNPP_HandleEvent() not to use this value
- remoteDrawEvent.contentsScaleFactor = -1.0;
-
- int16_t handled;
- AnswerNPP_HandleEvent(remoteDrawEvent, &handled);
- return handled == true;
-}
bool
PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event,
const uint32_t &surfaceid,
int16_t* handled)
{
- PLUGIN_LOG_DEBUG_FUNCTION;
- AssertPluginThread();
- AutoStackHelper guard(this);
-
- PaintTracker pt;
-
- NPCocoaEvent evcopy = event.event;
- mContentsScaleFactor = event.contentsScaleFactor;
- RefPtr<MacIOSurface> surf = MacIOSurface::LookupSurface(surfaceid,
- mContentsScaleFactor);
- if (!surf) {
- NS_ERROR("Invalid IOSurface.");
- *handled = false;
- return false;
- }
-
- if (!mCARenderer) {
- mCARenderer = new nsCARenderer();
- }
-
- if (evcopy.type == NPCocoaEventDrawRect) {
- mCARenderer->AttachIOSurface(surf);
- if (!mCARenderer->isInit()) {
- void *caLayer = nullptr;
- NPError result = mPluginIface->getvalue(GetNPP(),
- NPPVpluginCoreAnimationLayer,
- &caLayer);
-
- if (result != NPERR_NO_ERROR || !caLayer) {
- PLUGIN_LOG_DEBUG(("Plugin requested CoreAnimation but did not "
- "provide CALayer."));
- *handled = false;
- return false;
- }
-
- mCARenderer->SetupRenderer(caLayer, mWindow.width, mWindow.height,
- mContentsScaleFactor,
- GetQuirks() & QUIRK_ALLOW_OFFLINE_RENDERER ?
- ALLOW_OFFLINE_RENDERER : DISALLOW_OFFLINE_RENDERER);
-
- // Flash needs to have the window set again after this step
- if (mPluginIface->setwindow)
- (void) mPluginIface->setwindow(&mData, &mWindow);
- }
- } else {
- PLUGIN_LOG_DEBUG(("Invalid event type for "
- "AnswerNNP_HandleEvent_IOSurface."));
- *handled = false;
- return false;
- }
-
- mCARenderer->Render(mWindow.width, mWindow.height,
- mContentsScaleFactor, nullptr);
-
- return true;
-
-}
-
-#else
-bool
-PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event,
- const uint32_t &surfaceid,
- int16_t* handled)
-{
NS_RUNTIMEABORT("NPP_HandleEvent_IOSurface is a OSX-only message");
return false;
}
-#endif
bool
PluginInstanceChild::RecvWindowPosChanged(const NPRemoteEvent& event)
@@ -1175,24 +899,16 @@ PluginInstanceChild::RecvWindowPosChanged(const NPRemoteEvent& event)
bool
PluginInstanceChild::RecvContentsScaleFactorChanged(const double& aContentsScaleFactor)
{
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
mContentsScaleFactor = aContentsScaleFactor;
-#if defined(XP_MACOSX)
- if (mShContext) {
- // Release the shared context so that it is reallocated
- // with the new size.
- ::CGContextRelease(mShContext);
- mShContext = nullptr;
- }
-#endif
return true;
#else
- NS_RUNTIMEABORT("ContentsScaleFactorChanged is an Windows or OSX only message");
+ NS_RUNTIMEABORT("ContentsScaleFactorChanged is a Windows-only message");
return false;
#endif
}
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(MOZ_X11) && defined(XP_UNIX)
// Create a new window from NPWindow
bool PluginInstanceChild::CreateWindow(const NPRemoteWindow& aWindow)
{
@@ -1290,7 +1006,7 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
AssertPluginThread();
AutoStackHelper guard(this);
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(MOZ_X11) && defined(XP_UNIX)
NS_ASSERTION(mWsInfo.display, "We should have a valid display!");
// The minimum info is sent over IPC to allow this
@@ -1407,26 +1123,6 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
break;
}
-#elif defined(XP_MACOSX)
-
- mWindow.x = aWindow.x;
- mWindow.y = aWindow.y;
- mWindow.width = aWindow.width;
- mWindow.height = aWindow.height;
- mWindow.clipRect = aWindow.clipRect;
- mWindow.type = aWindow.type;
- mContentsScaleFactor = aWindow.contentsScaleFactor;
-
- if (mShContext) {
- // Release the shared context so that it is reallocated
- // with the new size.
- ::CGContextRelease(mShContext);
- mShContext = nullptr;
- }
-
- if (mPluginIface->setwindow)
- (void) mPluginIface->setwindow(&mData, &mWindow);
-
#elif defined(MOZ_WIDGET_UIKIT)
// Don't care
#else
@@ -3372,7 +3068,7 @@ PluginInstanceChild::DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
mWindow.height = aWindow.height;
mWindow.clipRect = aWindow.clipRect;
mWindow.type = aWindow.type;
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
mContentsScaleFactor = aWindow.contentsScaleFactor;
#endif
@@ -3564,60 +3260,6 @@ PluginInstanceChild::EnsureCurrentBuffer(void)
NS_ERROR("Cannot create helper surface");
return false;
}
-
- return true;
-#elif defined(XP_MACOSX)
-
- if (!mDoubleBufferCARenderer.HasCALayer()) {
- void *caLayer = nullptr;
- if (mDrawingModel == NPDrawingModelCoreGraphics) {
- if (!mCGLayer) {
- caLayer = mozilla::plugins::PluginUtilsOSX::GetCGLayer(CallCGDraw,
- this,
- mContentsScaleFactor);
-
- if (!caLayer) {
- PLUGIN_LOG_DEBUG(("GetCGLayer failed."));
- return false;
- }
- }
- mCGLayer = caLayer;
- } else {
- NPError result = mPluginIface->getvalue(GetNPP(),
- NPPVpluginCoreAnimationLayer,
- &caLayer);
- if (result != NPERR_NO_ERROR || !caLayer) {
- PLUGIN_LOG_DEBUG(("Plugin requested CoreAnimation but did not "
- "provide CALayer."));
- return false;
- }
- }
- mDoubleBufferCARenderer.SetCALayer(caLayer);
- }
-
- if (mDoubleBufferCARenderer.HasFrontSurface() &&
- (mDoubleBufferCARenderer.GetFrontSurfaceWidth() != mWindow.width ||
- mDoubleBufferCARenderer.GetFrontSurfaceHeight() != mWindow.height ||
- mDoubleBufferCARenderer.GetContentsScaleFactor() != mContentsScaleFactor)) {
- mDoubleBufferCARenderer.ClearFrontSurface();
- }
-
- if (!mDoubleBufferCARenderer.HasFrontSurface()) {
- bool allocSurface = mDoubleBufferCARenderer.InitFrontSurface(
- mWindow.width, mWindow.height, mContentsScaleFactor,
- GetQuirks() & QUIRK_ALLOW_OFFLINE_RENDERER ?
- ALLOW_OFFLINE_RENDERER : DISALLOW_OFFLINE_RENDERER);
- if (!allocSurface) {
- PLUGIN_LOG_DEBUG(("Fail to allocate front IOSurface"));
- return false;
- }
-
- if (mPluginIface->setwindow)
- (void) mPluginIface->setwindow(&mData, &mWindow);
-
- nsIntRect toInvalidate(0, 0, mWindow.width, mWindow.height);
- mAccumulatedInvalidRect.UnionRect(mAccumulatedInvalidRect, toInvalidate);
- }
#endif
return true;
}
@@ -3662,8 +3304,6 @@ PluginInstanceChild::UpdateWindowAttributes(bool aForceSetWindow)
return;
}
-#ifndef XP_MACOSX
- // Adjusting the window isn't needed for OSX
#ifndef XP_WIN
// On Windows, we translate the device context, in order for the window
// origin to be correct.
@@ -3684,7 +3324,6 @@ PluginInstanceChild::UpdateWindowAttributes(bool aForceSetWindow)
mWindow.clipRect.right = clipRect.XMost();
mWindow.clipRect.bottom = clipRect.YMost();
}
-#endif // XP_MACOSX
#ifdef XP_WIN
// Windowless plugins on Windows need a WM_WINDOWPOSCHANGED event to update
@@ -4655,7 +4294,7 @@ PluginInstanceChild::Destroy()
xt_client_xloop_destroy();
}
#endif
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(MOZ_X11) && defined(XP_UNIX)
DeleteWindow();
#endif
}
diff --git a/dom/plugins/ipc/PluginInstanceChild.h b/dom/plugins/ipc/PluginInstanceChild.h
index 0ad6e145d7..e07431c52a 100644
--- a/dom/plugins/ipc/PluginInstanceChild.h
+++ b/dom/plugins/ipc/PluginInstanceChild.h
@@ -206,7 +206,7 @@ protected:
virtual bool
RecvNPP_DidComposite() override;
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(MOZ_X11) && defined(XP_UNIX)
bool CreateWindow(const NPRemoteWindow& aWindow);
void DeleteWindow();
#endif
@@ -456,7 +456,7 @@ private:
PluginScriptableObjectChild* mCachedWindowActor;
PluginScriptableObjectChild* mCachedElementActor;
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(MOZ_X11) && defined(XP_UNIX)
NPSetWindowCallbackStruct mWsInfo;
#ifdef MOZ_WIDGET_GTK
bool mXEmbed;
@@ -520,15 +520,10 @@ private:
bool CanPaintOnBackground();
bool IsVisible() {
-#ifdef XP_MACOSX
- return mWindow.clipRect.top != mWindow.clipRect.bottom &&
- mWindow.clipRect.left != mWindow.clipRect.right;
-#else
return mWindow.clipRect.top != 0 ||
mWindow.clipRect.left != 0 ||
mWindow.clipRect.bottom != 0 ||
mWindow.clipRect.right != 0;
-#endif
}
// ShowPluginFrame - in general does four things:
@@ -609,12 +604,6 @@ private:
// surface which is on ParentProcess side
RefPtr<gfxASurface> mBackSurface;
-#ifdef XP_MACOSX
- // Current IOSurface available for rendering
- // We can't use thebes gfxASurface like other platforms.
- PluginUtilsOSX::nsDoubleBufferCARenderer mDoubleBufferCARenderer;
-#endif
-
// (Not to be confused with mBackSurface). This is a recent copy
// of the opaque pixels under our object frame, if
// |mIsTransparent|. We ask the plugin render directly onto a
diff --git a/dom/plugins/ipc/PluginInstanceParent.cpp b/dom/plugins/ipc/PluginInstanceParent.cpp
index 523dc5c803..2e29f8e6bc 100644
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -50,10 +50,6 @@
# include "mozilla/layers/TextureD3D11.h"
#endif
-#ifdef XP_MACOSX
-#include "MacIOSurfaceImage.h"
-#endif
-
#if defined(OS_WIN)
#include <windowsx.h>
#include "gfxWindowsPlatform.h"
@@ -67,9 +63,7 @@ extern const wchar_t* kFlashFullscreenClass;
#elif defined(MOZ_WIDGET_GTK)
#include "mozilla/dom/ContentChild.h"
#include <gdk/gdk.h>
-#elif defined(XP_MACOSX)
-#include <ApplicationServices/ApplicationServices.h>
-#endif // defined(XP_MACOSX)
+#endif
using namespace mozilla;
using namespace mozilla::plugins;
@@ -134,11 +128,6 @@ PluginInstanceParent::PluginInstanceParent(PluginModuleParent* parent,
, mPluginWndProc(nullptr)
, mNestedEventState(false)
#endif // defined(XP_WIN)
-#if defined(XP_MACOSX)
- , mShWidth(0)
- , mShHeight(0)
- , mShColorSpace(nullptr)
-#endif
{
#if defined(OS_WIN)
if (!sPluginInstanceList) {
@@ -458,14 +447,7 @@ PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginDrawingModel(
bool allowed = false;
switch (drawingModel) {
-#if defined(XP_MACOSX)
- case NPDrawingModelCoreAnimation:
- case NPDrawingModelInvalidatingCoreAnimation:
- case NPDrawingModelOpenGL:
- case NPDrawingModelCoreGraphics:
- allowed = true;
- break;
-#elif defined(XP_WIN)
+#if defined(XP_WIN)
case NPDrawingModelSyncWin:
allowed = true;
break;
@@ -494,16 +476,6 @@ PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginDrawingModel(
int requestModel = drawingModel;
-#ifdef XP_MACOSX
- if (drawingModel == NPDrawingModelCoreAnimation ||
- drawingModel == NPDrawingModelInvalidatingCoreAnimation) {
- // We need to request CoreGraphics otherwise
- // the nsPluginFrame will try to draw a CALayer
- // that can not be shared across process.
- requestModel = NPDrawingModelCoreGraphics;
- }
-#endif
-
*result = mNPNIface->setvalue(mNPP, NPPVpluginDrawingModel,
(void*)(intptr_t)requestModel);
@@ -514,14 +486,8 @@ bool
PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginEventModel(
const int& eventModel, NPError* result)
{
-#ifdef XP_MACOSX
- *result = mNPNIface->setvalue(mNPP, NPPVpluginEventModel,
- (void*)(intptr_t)eventModel);
- return true;
-#else
*result = NPERR_GENERIC_ERROR;
return true;
-#endif
}
bool
@@ -877,35 +843,6 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect,
}
surface = gfxSharedImageSurface::Open(newSurface.get_Shmem());
}
-#ifdef XP_MACOSX
- else if (newSurface.type() == SurfaceDescriptor::TIOSurfaceDescriptor) {
- IOSurfaceDescriptor iodesc = newSurface.get_IOSurfaceDescriptor();
-
- RefPtr<MacIOSurface> newIOSurface =
- MacIOSurface::LookupSurface(iodesc.surfaceId(),
- iodesc.contentsScaleFactor());
-
- if (!newIOSurface) {
- NS_WARNING("Got bad IOSurfaceDescriptor in RecvShow");
- return false;
- }
-
- if (mFrontIOSurface)
- *prevSurface = IOSurfaceDescriptor(mFrontIOSurface->GetIOSurfaceID(),
- mFrontIOSurface->GetContentsScaleFactor());
- else
- *prevSurface = null_t();
-
- mFrontIOSurface = newIOSurface;
-
- RecvNPN_InvalidateRect(updatedRect);
-
- PLUGIN_LOG_DEBUG((" (RecvShow invalidated for surface %p)",
- mFrontSurface.get()));
-
- return true;
- }
-#endif
#ifdef MOZ_X11
else if (newSurface.type() == SurfaceDescriptor::TSurfaceDescriptorX11) {
surface = newSurface.get_SurfaceDescriptorX11().OpenForeign();
@@ -988,7 +925,7 @@ PluginInstanceParent::AsyncSetWindow(NPWindow* aWindow)
window.height = aWindow->height;
window.clipRect = aWindow->clipRect;
window.type = aWindow->type;
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
double scaleFactor = 1.0;
mNPNIface->getvalue(mNPP, NPNVcontentsScaleFactor, &scaleFactor);
window.contentsScaleFactor = scaleFactor;
@@ -1018,19 +955,7 @@ PluginInstanceParent::GetImageContainer(ImageContainer** aContainer)
return NS_OK;
}
-#ifdef XP_MACOSX
- MacIOSurface* ioSurface = nullptr;
-
- if (mFrontIOSurface) {
- ioSurface = mFrontIOSurface;
- } else if (mIOSurface) {
- ioSurface = mIOSurface;
- }
-
- if (!mFrontSurface && !ioSurface)
-#else
if (!mFrontSurface)
-#endif
return NS_ERROR_NOT_AVAILABLE;
ImageContainer *container = GetImageContainer();
@@ -1039,17 +964,6 @@ PluginInstanceParent::GetImageContainer(ImageContainer** aContainer)
return NS_ERROR_FAILURE;
}
-#ifdef XP_MACOSX
- if (ioSurface) {
- RefPtr<Image> image = new MacIOSurfaceImage(ioSurface);
- container->SetCurrentImageInTransaction(image);
-
- NS_IF_ADDREF(container);
- *aContainer = container;
- return NS_OK;
- }
-#endif
-
NS_IF_ADDREF(container);
*aContainer = container;
return NS_OK;
@@ -1072,16 +986,6 @@ PluginInstanceParent::GetImageSize(nsIntSize* aSize)
return NS_OK;
}
-#ifdef XP_MACOSX
- if (mFrontIOSurface) {
- *aSize = nsIntSize(mFrontIOSurface->GetWidth(), mFrontIOSurface->GetHeight());
- return NS_OK;
- } else if (mIOSurface) {
- *aSize = nsIntSize(mIOSurface->GetWidth(), mIOSurface->GetHeight());
- return NS_OK;
- }
-#endif
-
return NS_ERROR_NOT_AVAILABLE;
}
@@ -1094,23 +998,14 @@ PluginInstanceParent::DidComposite()
Unused << SendNPP_DidComposite();
}
-#ifdef XP_MACOSX
-nsresult
-PluginInstanceParent::IsRemoteDrawingCoreAnimation(bool *aDrawing)
-{
- *aDrawing = (NPDrawingModelCoreAnimation == (NPDrawingModel)mDrawingModel ||
- NPDrawingModelInvalidatingCoreAnimation == (NPDrawingModel)mDrawingModel);
- return NS_OK;
-}
-#endif
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
nsresult
PluginInstanceParent::ContentsScaleFactorChanged(double aContentsScaleFactor)
{
bool rv = SendContentsScaleFactorChanged(aContentsScaleFactor);
return rv ? NS_OK : NS_ERROR_FAILURE;
}
-#endif // #ifdef XP_MACOSX
+#endif // #ifdef XP_WIN
nsresult
PluginInstanceParent::SetBackgroundUnknown()
@@ -1362,40 +1257,14 @@ PluginInstanceParent::NPP_SetWindow(const NPWindow* aWindow)
window.type = aWindow->type;
#endif
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
double floatScaleFactor = 1.0;
mNPNIface->getvalue(mNPP, NPNVcontentsScaleFactor, &floatScaleFactor);
int scaleFactor = ceil(floatScaleFactor);
window.contentsScaleFactor = floatScaleFactor;
#endif
-#if defined(XP_MACOSX)
- if (mShWidth != window.width * scaleFactor || mShHeight != window.height * scaleFactor) {
- if (mDrawingModel == NPDrawingModelCoreAnimation ||
- mDrawingModel == NPDrawingModelInvalidatingCoreAnimation) {
- mIOSurface = MacIOSurface::CreateIOSurface(window.width, window.height,
- floatScaleFactor);
- } else if (uint32_t(mShWidth * mShHeight) !=
- window.width * scaleFactor * window.height * scaleFactor) {
- if (mShWidth != 0 && mShHeight != 0) {
- DeallocShmem(mShSurface);
- mShWidth = 0;
- mShHeight = 0;
- }
-
- if (window.width != 0 && window.height != 0) {
- if (!AllocShmem(window.width * scaleFactor * window.height*4 * scaleFactor,
- SharedMemory::TYPE_BASIC, &mShSurface)) {
- PLUGIN_LOG_DEBUG(("Shared memory could not be allocated."));
- return NPERR_GENERIC_ERROR;
- }
- }
- }
- mShWidth = window.width * scaleFactor;
- mShHeight = window.height * scaleFactor;
- }
-#endif
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(MOZ_X11) && defined(XP_UNIX)
const NPSetWindowCallbackStruct* ws_info =
static_cast<NPSetWindowCallbackStruct*>(aWindow->ws_info);
window.visualID = ws_info->visual ? ws_info->visual->visualid : 0;
@@ -1556,14 +1425,10 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
{
PLUGIN_LOG_DEBUG_FUNCTION;
-#if defined(XP_MACOSX)
- NPCocoaEvent* npevent = reinterpret_cast<NPCocoaEvent*>(event);
-#else
NPEvent* npevent = reinterpret_cast<NPEvent*>(event);
-#endif
NPRemoteEvent npremoteevent;
npremoteevent.event = *npevent;
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
double scaleFactor = 1.0;
mNPNIface->getvalue(mNPP, NPNVcontentsScaleFactor, &scaleFactor);
npremoteevent.contentsScaleFactor = scaleFactor;
@@ -1653,111 +1518,6 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
}
#endif
-#ifdef XP_MACOSX
- if (npevent->type == NPCocoaEventDrawRect) {
- if (mDrawingModel == NPDrawingModelCoreAnimation ||
- mDrawingModel == NPDrawingModelInvalidatingCoreAnimation) {
- if (!mIOSurface) {
- NS_ERROR("No IOSurface allocated.");
- return false;
- }
- if (!CallNPP_HandleEvent_IOSurface(npremoteevent,
- mIOSurface->GetIOSurfaceID(),
- &handled))
- return false; // no good way to handle errors here...
-
- CGContextRef cgContext = npevent->data.draw.context;
- if (!mShColorSpace) {
- mShColorSpace = CreateSystemColorSpace();
- }
- if (!mShColorSpace) {
- PLUGIN_LOG_DEBUG(("Could not allocate ColorSpace."));
- return false;
- }
- if (cgContext) {
- nsCARenderer::DrawSurfaceToCGContext(cgContext, mIOSurface,
- mShColorSpace,
- npevent->data.draw.x,
- npevent->data.draw.y,
- npevent->data.draw.width,
- npevent->data.draw.height);
- }
- return true;
- } else if (mFrontIOSurface) {
- CGContextRef cgContext = npevent->data.draw.context;
- if (!mShColorSpace) {
- mShColorSpace = CreateSystemColorSpace();
- }
- if (!mShColorSpace) {
- PLUGIN_LOG_DEBUG(("Could not allocate ColorSpace."));
- return false;
- }
- if (cgContext) {
- nsCARenderer::DrawSurfaceToCGContext(cgContext, mFrontIOSurface,
- mShColorSpace,
- npevent->data.draw.x,
- npevent->data.draw.y,
- npevent->data.draw.width,
- npevent->data.draw.height);
- }
- return true;
- } else {
- if (mShWidth == 0 && mShHeight == 0) {
- PLUGIN_LOG_DEBUG(("NPCocoaEventDrawRect on window of size 0."));
- return false;
- }
- if (!mShSurface.IsReadable()) {
- PLUGIN_LOG_DEBUG(("Shmem is not readable."));
- return false;
- }
-
- if (!CallNPP_HandleEvent_Shmem(npremoteevent, mShSurface,
- &handled, &mShSurface))
- return false; // no good way to handle errors here...
-
- if (!mShSurface.IsReadable()) {
- PLUGIN_LOG_DEBUG(("Shmem not returned. Either the plugin crashed "
- "or we have a bug."));
- return false;
- }
-
- char* shContextByte = mShSurface.get<char>();
-
- if (!mShColorSpace) {
- mShColorSpace = CreateSystemColorSpace();
- }
- if (!mShColorSpace) {
- PLUGIN_LOG_DEBUG(("Could not allocate ColorSpace."));
- return false;
- }
- CGContextRef shContext = ::CGBitmapContextCreate(shContextByte,
- mShWidth, mShHeight, 8,
- mShWidth*4, mShColorSpace,
- kCGImageAlphaPremultipliedFirst |
- kCGBitmapByteOrder32Host);
- if (!shContext) {
- PLUGIN_LOG_DEBUG(("Could not allocate CGBitmapContext."));
- return false;
- }
-
- CGImageRef shImage = ::CGBitmapContextCreateImage(shContext);
- if (shImage) {
- CGContextRef cgContext = npevent->data.draw.context;
-
- ::CGContextDrawImage(cgContext,
- CGRectMake(0,0,mShWidth,mShHeight),
- shImage);
- ::CGImageRelease(shImage);
- } else {
- ::CGContextRelease(shContext);
- return false;
- }
- ::CGContextRelease(shContext);
- return true;
- }
- }
-#endif
-
if (!CallNPP_HandleEvent(npremoteevent, &handled))
return 0; // no good way to handle errors here...
diff --git a/dom/plugins/ipc/PluginInstanceParent.h b/dom/plugins/ipc/PluginInstanceParent.h
index b2feafacc6..80d04242ca 100644
--- a/dom/plugins/ipc/PluginInstanceParent.h
+++ b/dom/plugins/ipc/PluginInstanceParent.h
@@ -322,10 +322,7 @@ public:
nsresult AsyncSetWindow(NPWindow* window);
nsresult GetImageContainer(mozilla::layers::ImageContainer** aContainer);
nsresult GetImageSize(nsIntSize* aSize);
-#ifdef XP_MACOSX
- nsresult IsRemoteDrawingCoreAnimation(bool *aDrawing);
-#endif
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
nsresult ContentsScaleFactorChanged(double aContentsScaleFactor);
#endif
nsresult SetBackgroundUnknown();
diff --git a/dom/plugins/ipc/PluginInterposeOSX.h b/dom/plugins/ipc/PluginInterposeOSX.h
deleted file mode 100644
index 2a742b8aa2..0000000000
--- a/dom/plugins/ipc/PluginInterposeOSX.h
+++ /dev/null
@@ -1,137 +0,0 @@
-// vim:set ts=2 sts=2 sw=2 et cin:
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef DOM_PLUGINS_IPC_PLUGININTERPOSEOSX_H
-#define DOM_PLUGINS_IPC_PLUGININTERPOSEOSX_H
-
-#include "base/basictypes.h"
-#include "nsPoint.h"
-#include "npapi.h"
-
-// Make this includable from non-Objective-C code.
-#ifndef __OBJC__
-class NSCursor;
-#else
-#import <Cocoa/Cocoa.h>
-#endif
-
-// The header file QuickdrawAPI.h is missing on OS X 10.7 and up (though the
-// QuickDraw APIs defined in it are still present) -- so we need to supply the
-// relevant parts of its contents here. It's likely that Apple will eventually
-// remove the APIs themselves (probably in OS X 10.8), so we need to make them
-// weak imports, and test for their presence before using them.
-#if !defined(__QUICKDRAWAPI__)
-
-typedef short Bits16[16];
-struct Cursor {
- Bits16 data;
- Bits16 mask;
- Point hotSpot;
-};
-typedef struct Cursor Cursor;
-
-#endif /* __QUICKDRAWAPI__ */
-
-namespace mac_plugin_interposing {
-
-// Class used to serialize NSCursor objects over IPC between processes.
-class NSCursorInfo {
-public:
- enum Type {
- TypeCustom,
- TypeArrow,
- TypeClosedHand,
- TypeContextualMenu, // Only supported on OS X 10.6 and up
- TypeCrosshair,
- TypeDisappearingItem,
- TypeDragCopy, // Only supported on OS X 10.6 and up
- TypeDragLink, // Only supported on OS X 10.6 and up
- TypeIBeam,
- TypeNotAllowed, // Only supported on OS X 10.6 and up
- TypeOpenHand,
- TypePointingHand,
- TypeResizeDown,
- TypeResizeLeft,
- TypeResizeLeftRight,
- TypeResizeRight,
- TypeResizeUp,
- TypeResizeUpDown,
- TypeTransparent // Special type
- };
-
- NSCursorInfo();
- explicit NSCursorInfo(NSCursor* aCursor);
- explicit NSCursorInfo(const Cursor* aCursor);
- ~NSCursorInfo();
-
- NSCursor* GetNSCursor() const;
- Type GetType() const;
- const char* GetTypeName() const;
- nsPoint GetHotSpot() const;
- uint8_t* GetCustomImageData() const;
- uint32_t GetCustomImageDataLength() const;
-
- void SetType(Type aType);
- void SetHotSpot(nsPoint aHotSpot);
- void SetCustomImageData(uint8_t* aData, uint32_t aDataLength);
-
- static bool GetNativeCursorsSupported();
-
-private:
- NSCursor* GetTransparentCursor() const;
-
- Type mType;
- // The hot spot's coordinate system is the cursor's coordinate system, and
- // has an upper-left origin (in both Cocoa and pre-Cocoa systems).
- nsPoint mHotSpot;
- uint8_t* mCustomImageData;
- uint32_t mCustomImageDataLength;
- static int32_t mNativeCursorsSupported;
-};
-
-namespace parent {
-
-void OnPluginShowWindow(uint32_t window_id, CGRect window_bounds, bool modal);
-void OnPluginHideWindow(uint32_t window_id, pid_t aPluginPid);
-void OnSetCursor(const NSCursorInfo& cursorInfo);
-void OnShowCursor(bool show);
-void OnPushCursor(const NSCursorInfo& cursorInfo);
-void OnPopCursor();
-
-} // namespace parent
-
-namespace child {
-
-void SetUpCocoaInterposing();
-
-} // namespace child
-
-} // namespace mac_plugin_interposing
-
-#endif /* DOM_PLUGINS_IPC_PLUGININTERPOSEOSX_H */
diff --git a/dom/plugins/ipc/PluginInterposeOSX.mm b/dom/plugins/ipc/PluginInterposeOSX.mm
deleted file mode 100644
index bf24d2b0d8..0000000000
--- a/dom/plugins/ipc/PluginInterposeOSX.mm
+++ /dev/null
@@ -1,1158 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-// vim:set ts=2 sts=2 sw=2 et cin:
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "base/basictypes.h"
-#include "nsCocoaUtils.h"
-#include "PluginModuleChild.h"
-#include "nsDebug.h"
-#include "PluginInterposeOSX.h"
-#include <set>
-#import <AppKit/AppKit.h>
-#import <objc/runtime.h>
-#import <Carbon/Carbon.h>
-
-using namespace mozilla::plugins;
-
-namespace mac_plugin_interposing {
-
-int32_t NSCursorInfo::mNativeCursorsSupported = -1;
-
-// This constructor may be called from the browser process or the plugin
-// process.
-NSCursorInfo::NSCursorInfo()
- : mType(TypeArrow)
- , mHotSpot(nsPoint(0, 0))
- , mCustomImageData(NULL)
- , mCustomImageDataLength(0)
-{
-}
-
-NSCursorInfo::NSCursorInfo(NSCursor* aCursor)
- : mType(TypeArrow)
- , mHotSpot(nsPoint(0, 0))
- , mCustomImageData(NULL)
- , mCustomImageDataLength(0)
-{
- // This constructor is only ever called from the plugin process, so the
- // following is safe.
- if (!GetNativeCursorsSupported()) {
- return;
- }
-
- NSPoint hotSpotCocoa = [aCursor hotSpot];
- mHotSpot = nsPoint(hotSpotCocoa.x, hotSpotCocoa.y);
-
- Class nsCursorClass = [NSCursor class];
- if ([aCursor isEqual:[NSCursor arrowCursor]]) {
- mType = TypeArrow;
- } else if ([aCursor isEqual:[NSCursor closedHandCursor]]) {
- mType = TypeClosedHand;
- } else if ([aCursor isEqual:[NSCursor crosshairCursor]]) {
- mType = TypeCrosshair;
- } else if ([aCursor isEqual:[NSCursor disappearingItemCursor]]) {
- mType = TypeDisappearingItem;
- } else if ([aCursor isEqual:[NSCursor IBeamCursor]]) {
- mType = TypeIBeam;
- } else if ([aCursor isEqual:[NSCursor openHandCursor]]) {
- mType = TypeOpenHand;
- } else if ([aCursor isEqual:[NSCursor pointingHandCursor]]) {
- mType = TypePointingHand;
- } else if ([aCursor isEqual:[NSCursor resizeDownCursor]]) {
- mType = TypeResizeDown;
- } else if ([aCursor isEqual:[NSCursor resizeLeftCursor]]) {
- mType = TypeResizeLeft;
- } else if ([aCursor isEqual:[NSCursor resizeLeftRightCursor]]) {
- mType = TypeResizeLeftRight;
- } else if ([aCursor isEqual:[NSCursor resizeRightCursor]]) {
- mType = TypeResizeRight;
- } else if ([aCursor isEqual:[NSCursor resizeUpCursor]]) {
- mType = TypeResizeUp;
- } else if ([aCursor isEqual:[NSCursor resizeUpDownCursor]]) {
- mType = TypeResizeUpDown;
- // The following cursor types are only supported on OS X 10.6 and up.
- } else if ([nsCursorClass respondsToSelector:@selector(contextualMenuCursor)] &&
- [aCursor isEqual:[nsCursorClass performSelector:@selector(contextualMenuCursor)]]) {
- mType = TypeContextualMenu;
- } else if ([nsCursorClass respondsToSelector:@selector(dragCopyCursor)] &&
- [aCursor isEqual:[nsCursorClass performSelector:@selector(dragCopyCursor)]]) {
- mType = TypeDragCopy;
- } else if ([nsCursorClass respondsToSelector:@selector(dragLinkCursor)] &&
- [aCursor isEqual:[nsCursorClass performSelector:@selector(dragLinkCursor)]]) {
- mType = TypeDragLink;
- } else if ([nsCursorClass respondsToSelector:@selector(operationNotAllowedCursor)] &&
- [aCursor isEqual:[nsCursorClass performSelector:@selector(operationNotAllowedCursor)]]) {
- mType = TypeNotAllowed;
- } else {
- NSImage* image = [aCursor image];
- NSArray* reps = image ? [image representations] : nil;
- NSUInteger repsCount = reps ? [reps count] : 0;
- if (!repsCount) {
- // If we have a custom cursor with no image representations, assume we
- // need a transparent cursor.
- mType = TypeTransparent;
- } else {
- CGImageRef cgImage = nil;
- // XXX We don't know how to deal with a cursor that doesn't have a
- // bitmap image representation. For now we fall back to an arrow
- // cursor.
- for (NSUInteger i = 0; i < repsCount; ++i) {
- id rep = [reps objectAtIndex:i];
- if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
- cgImage = [(NSBitmapImageRep*)rep CGImage];
- break;
- }
- }
- if (cgImage) {
- CFMutableDataRef data = ::CFDataCreateMutable(kCFAllocatorDefault, 0);
- if (data) {
- CGImageDestinationRef dest = ::CGImageDestinationCreateWithData(data,
- kUTTypePNG,
- 1,
- NULL);
- if (dest) {
- ::CGImageDestinationAddImage(dest, cgImage, NULL);
- if (::CGImageDestinationFinalize(dest)) {
- uint32_t dataLength = (uint32_t) ::CFDataGetLength(data);
- mCustomImageData = (uint8_t*) moz_xmalloc(dataLength);
- ::CFDataGetBytes(data, ::CFRangeMake(0, dataLength), mCustomImageData);
- mCustomImageDataLength = dataLength;
- mType = TypeCustom;
- }
- ::CFRelease(dest);
- }
- ::CFRelease(data);
- }
- }
- if (!mCustomImageData) {
- mType = TypeArrow;
- }
- }
- }
-}
-
-NSCursorInfo::NSCursorInfo(const Cursor* aCursor)
- : mType(TypeArrow)
- , mHotSpot(nsPoint(0, 0))
- , mCustomImageData(NULL)
- , mCustomImageDataLength(0)
-{
- // This constructor is only ever called from the plugin process, so the
- // following is safe.
- if (!GetNativeCursorsSupported()) {
- return;
- }
-
- mHotSpot = nsPoint(aCursor->hotSpot.h, aCursor->hotSpot.v);
-
- int width = 16, height = 16;
- int bytesPerPixel = 4;
- int rowBytes = width * bytesPerPixel;
- int bitmapSize = height * rowBytes;
-
- bool isTransparent = true;
-
- uint8_t* bitmap = (uint8_t*) moz_xmalloc(bitmapSize);
- // The way we create 'bitmap' is largely "borrowed" from Chrome's
- // WebCursor::InitFromCursor().
- for (int y = 0; y < height; ++y) {
- unsigned short data = aCursor->data[y];
- unsigned short mask = aCursor->mask[y];
- // Change 'data' and 'mask' from big-endian to little-endian, but output
- // big-endian data below.
- data = ((data << 8) & 0xFF00) | ((data >> 8) & 0x00FF);
- mask = ((mask << 8) & 0xFF00) | ((mask >> 8) & 0x00FF);
- // It'd be nice to use a gray-scale bitmap. But
- // CGBitmapContextCreateImage() (used below) won't work with one that also
- // has alpha values.
- for (int x = 0; x < width; ++x) {
- int offset = (y * rowBytes) + (x * bytesPerPixel);
- // Color value
- if (data & 0x8000) {
- bitmap[offset] = 0x0;
- bitmap[offset + 1] = 0x0;
- bitmap[offset + 2] = 0x0;
- } else {
- bitmap[offset] = 0xFF;
- bitmap[offset + 1] = 0xFF;
- bitmap[offset + 2] = 0xFF;
- }
- // Mask value
- if (mask & 0x8000) {
- bitmap[offset + 3] = 0xFF;
- isTransparent = false;
- } else {
- bitmap[offset + 3] = 0x0;
- }
- data <<= 1;
- mask <<= 1;
- }
- }
-
- if (isTransparent) {
- // If aCursor is transparent, we don't need to serialize custom cursor
- // data over IPC.
- mType = TypeTransparent;
- } else {
- CGColorSpaceRef color = ::CGColorSpaceCreateDeviceRGB();
- if (color) {
- CGContextRef context =
- ::CGBitmapContextCreate(bitmap,
- width,
- height,
- 8,
- rowBytes,
- color,
- kCGImageAlphaPremultipliedLast |
- kCGBitmapByteOrder32Big);
- if (context) {
- CGImageRef image = ::CGBitmapContextCreateImage(context);
- if (image) {
- ::CFMutableDataRef data = ::CFDataCreateMutable(kCFAllocatorDefault, 0);
- if (data) {
- CGImageDestinationRef dest =
- ::CGImageDestinationCreateWithData(data,
- kUTTypePNG,
- 1,
- NULL);
- if (dest) {
- ::CGImageDestinationAddImage(dest, image, NULL);
- if (::CGImageDestinationFinalize(dest)) {
- uint32_t dataLength = (uint32_t) ::CFDataGetLength(data);
- mCustomImageData = (uint8_t*) moz_xmalloc(dataLength);
- ::CFDataGetBytes(data,
- ::CFRangeMake(0, dataLength),
- mCustomImageData);
- mCustomImageDataLength = dataLength;
- mType = TypeCustom;
- }
- ::CFRelease(dest);
- }
- ::CFRelease(data);
- }
- ::CGImageRelease(image);
- }
- ::CGContextRelease(context);
- }
- ::CGColorSpaceRelease(color);
- }
- }
-
- free(bitmap);
-}
-
-NSCursorInfo::~NSCursorInfo()
-{
- if (mCustomImageData) {
- free(mCustomImageData);
- }
-}
-
-NSCursor* NSCursorInfo::GetNSCursor() const
-{
- NSCursor* retval = nil;
-
- Class nsCursorClass = [NSCursor class];
- switch(mType) {
- case TypeArrow:
- retval = [NSCursor arrowCursor];
- break;
- case TypeClosedHand:
- retval = [NSCursor closedHandCursor];
- break;
- case TypeCrosshair:
- retval = [NSCursor crosshairCursor];
- break;
- case TypeDisappearingItem:
- retval = [NSCursor disappearingItemCursor];
- break;
- case TypeIBeam:
- retval = [NSCursor IBeamCursor];
- break;
- case TypeOpenHand:
- retval = [NSCursor openHandCursor];
- break;
- case TypePointingHand:
- retval = [NSCursor pointingHandCursor];
- break;
- case TypeResizeDown:
- retval = [NSCursor resizeDownCursor];
- break;
- case TypeResizeLeft:
- retval = [NSCursor resizeLeftCursor];
- break;
- case TypeResizeLeftRight:
- retval = [NSCursor resizeLeftRightCursor];
- break;
- case TypeResizeRight:
- retval = [NSCursor resizeRightCursor];
- break;
- case TypeResizeUp:
- retval = [NSCursor resizeUpCursor];
- break;
- case TypeResizeUpDown:
- retval = [NSCursor resizeUpDownCursor];
- break;
- // The following four cursor types are only supported on OS X 10.6 and up.
- case TypeContextualMenu: {
- if ([nsCursorClass respondsToSelector:@selector(contextualMenuCursor)]) {
- retval = [nsCursorClass performSelector:@selector(contextualMenuCursor)];
- }
- break;
- }
- case TypeDragCopy: {
- if ([nsCursorClass respondsToSelector:@selector(dragCopyCursor)]) {
- retval = [nsCursorClass performSelector:@selector(dragCopyCursor)];
- }
- break;
- }
- case TypeDragLink: {
- if ([nsCursorClass respondsToSelector:@selector(dragLinkCursor)]) {
- retval = [nsCursorClass performSelector:@selector(dragLinkCursor)];
- }
- break;
- }
- case TypeNotAllowed: {
- if ([nsCursorClass respondsToSelector:@selector(operationNotAllowedCursor)]) {
- retval = [nsCursorClass performSelector:@selector(operationNotAllowedCursor)];
- }
- break;
- }
- case TypeTransparent:
- retval = GetTransparentCursor();
- break;
- default:
- break;
- }
-
- if (!retval && mCustomImageData && mCustomImageDataLength) {
- CGDataProviderRef provider = ::CGDataProviderCreateWithData(NULL,
- (const void*)mCustomImageData,
- mCustomImageDataLength,
- NULL);
- if (provider) {
- CGImageRef cgImage = ::CGImageCreateWithPNGDataProvider(provider,
- NULL,
- false,
- kCGRenderingIntentDefault);
- if (cgImage) {
- NSBitmapImageRep* rep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
- if (rep) {
- NSImage* image = [[NSImage alloc] init];
- if (image) {
- [image addRepresentation:rep];
- retval = [[[NSCursor alloc] initWithImage:image
- hotSpot:NSMakePoint(mHotSpot.x, mHotSpot.y)]
- autorelease];
- [image release];
- }
- [rep release];
- }
- ::CGImageRelease(cgImage);
- }
- ::CFRelease(provider);
- }
- }
-
- // Fall back to an arrow cursor if need be.
- if (!retval) {
- retval = [NSCursor arrowCursor];
- }
-
- return retval;
-}
-
-// Get a transparent cursor with the appropriate hot spot. We need one if
-// (for example) we have a custom cursor with no image data.
-NSCursor* NSCursorInfo::GetTransparentCursor() const
-{
- NSCursor* retval = nil;
-
- int width = 16, height = 16;
- int bytesPerPixel = 2;
- int rowBytes = width * bytesPerPixel;
- int dataSize = height * rowBytes;
-
- uint8_t* data = (uint8_t*) moz_xmalloc(dataSize);
- for (int y = 0; y < height; ++y) {
- for (int x = 0; x < width; ++x) {
- int offset = (y * rowBytes) + (x * bytesPerPixel);
- data[offset] = 0x7E; // Arbitrary gray-scale value
- data[offset + 1] = 0; // Alpha value to make us transparent
- }
- }
-
- NSBitmapImageRep* imageRep =
- [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil
- pixelsWide:width
- pixelsHigh:height
- bitsPerSample:8
- samplesPerPixel:2
- hasAlpha:YES
- isPlanar:NO
- colorSpaceName:NSCalibratedWhiteColorSpace
- bytesPerRow:rowBytes
- bitsPerPixel:16]
- autorelease];
- if (imageRep) {
- uint8_t* repDataPtr = [imageRep bitmapData];
- if (repDataPtr) {
- memcpy(repDataPtr, data, dataSize);
- NSImage *image =
- [[[NSImage alloc] initWithSize:NSMakeSize(width, height)]
- autorelease];
- if (image) {
- [image addRepresentation:imageRep];
- retval =
- [[[NSCursor alloc] initWithImage:image
- hotSpot:NSMakePoint(mHotSpot.x, mHotSpot.y)]
- autorelease];
- }
- }
- }
-
- free(data);
-
- // Fall back to an arrow cursor if (for some reason) the above code failed.
- if (!retval) {
- retval = [NSCursor arrowCursor];
- }
-
- return retval;
-}
-
-NSCursorInfo::Type NSCursorInfo::GetType() const
-{
- return mType;
-}
-
-const char* NSCursorInfo::GetTypeName() const
-{
- switch(mType) {
- case TypeCustom:
- return "TypeCustom";
- case TypeArrow:
- return "TypeArrow";
- case TypeClosedHand:
- return "TypeClosedHand";
- case TypeContextualMenu:
- return "TypeContextualMenu";
- case TypeCrosshair:
- return "TypeCrosshair";
- case TypeDisappearingItem:
- return "TypeDisappearingItem";
- case TypeDragCopy:
- return "TypeDragCopy";
- case TypeDragLink:
- return "TypeDragLink";
- case TypeIBeam:
- return "TypeIBeam";
- case TypeNotAllowed:
- return "TypeNotAllowed";
- case TypeOpenHand:
- return "TypeOpenHand";
- case TypePointingHand:
- return "TypePointingHand";
- case TypeResizeDown:
- return "TypeResizeDown";
- case TypeResizeLeft:
- return "TypeResizeLeft";
- case TypeResizeLeftRight:
- return "TypeResizeLeftRight";
- case TypeResizeRight:
- return "TypeResizeRight";
- case TypeResizeUp:
- return "TypeResizeUp";
- case TypeResizeUpDown:
- return "TypeResizeUpDown";
- case TypeTransparent:
- return "TypeTransparent";
- default:
- break;
- }
- return "TypeUnknown";
-}
-
-nsPoint NSCursorInfo::GetHotSpot() const
-{
- return mHotSpot;
-}
-
-uint8_t* NSCursorInfo::GetCustomImageData() const
-{
- return mCustomImageData;
-}
-
-uint32_t NSCursorInfo::GetCustomImageDataLength() const
-{
- return mCustomImageDataLength;
-}
-
-void NSCursorInfo::SetType(Type aType)
-{
- mType = aType;
-}
-
-void NSCursorInfo::SetHotSpot(nsPoint aHotSpot)
-{
- mHotSpot = aHotSpot;
-}
-
-void NSCursorInfo::SetCustomImageData(uint8_t* aData, uint32_t aDataLength)
-{
- if (mCustomImageData) {
- free(mCustomImageData);
- }
- if (aDataLength) {
- mCustomImageData = (uint8_t*) moz_xmalloc(aDataLength);
- memcpy(mCustomImageData, aData, aDataLength);
- } else {
- mCustomImageData = NULL;
- }
- mCustomImageDataLength = aDataLength;
-}
-
-// This should never be called from the browser process -- only from the
-// plugin process.
-bool NSCursorInfo::GetNativeCursorsSupported()
-{
- if (mNativeCursorsSupported == -1) {
- ENSURE_PLUGIN_THREAD(false);
- PluginModuleChild *pmc = PluginModuleChild::GetChrome();
- if (pmc) {
- bool result = pmc->GetNativeCursorsSupported();
- if (result) {
- mNativeCursorsSupported = 1;
- } else {
- mNativeCursorsSupported = 0;
- }
- }
- }
- return (mNativeCursorsSupported == 1);
-}
-
-} // namespace mac_plugin_interposing
-
-namespace mac_plugin_interposing {
-namespace parent {
-
-// Tracks plugin windows currently visible.
-std::set<uint32_t> plugin_visible_windows_set_;
-// Tracks full screen windows currently visible.
-std::set<uint32_t> plugin_fullscreen_windows_set_;
-// Tracks modal windows currently visible.
-std::set<uint32_t> plugin_modal_windows_set_;
-
-void OnPluginShowWindow(uint32_t window_id,
- CGRect window_bounds,
- bool modal) {
- plugin_visible_windows_set_.insert(window_id);
-
- if (modal)
- plugin_modal_windows_set_.insert(window_id);
-
- CGRect main_display_bounds = ::CGDisplayBounds(CGMainDisplayID());
-
- if (CGRectEqualToRect(window_bounds, main_display_bounds) &&
- (plugin_fullscreen_windows_set_.find(window_id) ==
- plugin_fullscreen_windows_set_.end())) {
- plugin_fullscreen_windows_set_.insert(window_id);
-
- nsCocoaUtils::HideOSChromeOnScreen(true);
- }
-}
-
-static void ActivateProcess(pid_t pid) {
- ProcessSerialNumber process;
- OSStatus status = ::GetProcessForPID(pid, &process);
-
- if (status == noErr) {
- SetFrontProcess(&process);
- } else {
- NS_WARNING("Unable to get process for pid.");
- }
-}
-
-// Must be called on the UI thread.
-// If plugin_pid is -1, the browser will be the active process on return,
-// otherwise that process will be given focus back before this function returns.
-static void ReleasePluginFullScreen(pid_t plugin_pid) {
- // Releasing full screen only works if we are the frontmost process; grab
- // focus, but give it back to the plugin process if requested.
- ActivateProcess(base::GetCurrentProcId());
-
- nsCocoaUtils::HideOSChromeOnScreen(false);
-
- if (plugin_pid != -1) {
- ActivateProcess(plugin_pid);
- }
-}
-
-void OnPluginHideWindow(uint32_t window_id, pid_t aPluginPid) {
- bool had_windows = !plugin_visible_windows_set_.empty();
- plugin_visible_windows_set_.erase(window_id);
- bool browser_needs_activation = had_windows &&
- plugin_visible_windows_set_.empty();
-
- plugin_modal_windows_set_.erase(window_id);
- if (plugin_fullscreen_windows_set_.find(window_id) !=
- plugin_fullscreen_windows_set_.end()) {
- plugin_fullscreen_windows_set_.erase(window_id);
- pid_t plugin_pid = browser_needs_activation ? -1 : aPluginPid;
- browser_needs_activation = false;
- ReleasePluginFullScreen(plugin_pid);
- }
-
- if (browser_needs_activation) {
- ActivateProcess(getpid());
- }
-}
-
-void OnSetCursor(const NSCursorInfo& cursorInfo)
-{
- NSCursor* aCursor = cursorInfo.GetNSCursor();
- if (aCursor) {
- [aCursor set];
- }
-}
-
-void OnShowCursor(bool show)
-{
- if (show) {
- [NSCursor unhide];
- } else {
- [NSCursor hide];
- }
-}
-
-void OnPushCursor(const NSCursorInfo& cursorInfo)
-{
- NSCursor* aCursor = cursorInfo.GetNSCursor();
- if (aCursor) {
- [aCursor push];
- }
-}
-
-void OnPopCursor()
-{
- [NSCursor pop];
-}
-
-} // namespace parent
-} // namespace mac_plugin_interposing
-
-namespace mac_plugin_interposing {
-namespace child {
-
-// TODO(stuartmorgan): Make this an IPC to order the plugin process above the
-// browser process only if the browser is current frontmost.
-void FocusPluginProcess() {
- ProcessSerialNumber this_process, front_process;
- if ((GetCurrentProcess(&this_process) != noErr) ||
- (GetFrontProcess(&front_process) != noErr)) {
- return;
- }
-
- Boolean matched = false;
- if ((SameProcess(&this_process, &front_process, &matched) == noErr) &&
- !matched) {
- SetFrontProcess(&this_process);
- }
-}
-
-void NotifyBrowserOfPluginShowWindow(uint32_t window_id, CGRect bounds,
- bool modal) {
- ENSURE_PLUGIN_THREAD_VOID();
-
- PluginModuleChild *pmc = PluginModuleChild::GetChrome();
- if (pmc)
- pmc->PluginShowWindow(window_id, modal, bounds);
-}
-
-void NotifyBrowserOfPluginHideWindow(uint32_t window_id, CGRect bounds) {
- ENSURE_PLUGIN_THREAD_VOID();
-
- PluginModuleChild *pmc = PluginModuleChild::GetChrome();
- if (pmc)
- pmc->PluginHideWindow(window_id);
-}
-
-void NotifyBrowserOfSetCursor(NSCursorInfo& aCursorInfo)
-{
- ENSURE_PLUGIN_THREAD_VOID();
- PluginModuleChild *pmc = PluginModuleChild::GetChrome();
- if (pmc) {
- pmc->SetCursor(aCursorInfo);
- }
-}
-
-void NotifyBrowserOfShowCursor(bool show)
-{
- ENSURE_PLUGIN_THREAD_VOID();
- PluginModuleChild *pmc = PluginModuleChild::GetChrome();
- if (pmc) {
- pmc->ShowCursor(show);
- }
-}
-
-void NotifyBrowserOfPushCursor(NSCursorInfo& aCursorInfo)
-{
- ENSURE_PLUGIN_THREAD_VOID();
- PluginModuleChild *pmc = PluginModuleChild::GetChrome();
- if (pmc) {
- pmc->PushCursor(aCursorInfo);
- }
-}
-
-void NotifyBrowserOfPopCursor()
-{
- ENSURE_PLUGIN_THREAD_VOID();
- PluginModuleChild *pmc = PluginModuleChild::GetChrome();
- if (pmc) {
- pmc->PopCursor();
- }
-}
-
-struct WindowInfo {
- uint32_t window_id;
- CGRect bounds;
- explicit WindowInfo(NSWindow* aWindow) {
- NSInteger window_num = [aWindow windowNumber];
- window_id = window_num > 0 ? window_num : 0;
- bounds = NSRectToCGRect([aWindow frame]);
- }
-};
-
-static void OnPluginWindowClosed(const WindowInfo& window_info) {
- if (window_info.window_id == 0)
- return;
- mac_plugin_interposing::child::NotifyBrowserOfPluginHideWindow(window_info.window_id,
- window_info.bounds);
-}
-
-static void OnPluginWindowShown(const WindowInfo& window_info, BOOL is_modal) {
- // The window id is 0 if it has never been shown (including while it is the
- // process of being shown for the first time); when that happens, we'll catch
- // it in _setWindowNumber instead.
- static BOOL s_pending_display_is_modal = NO;
- if (window_info.window_id == 0) {
- if (is_modal)
- s_pending_display_is_modal = YES;
- return;
- }
- if (s_pending_display_is_modal) {
- is_modal = YES;
- s_pending_display_is_modal = NO;
- }
- mac_plugin_interposing::child::NotifyBrowserOfPluginShowWindow(
- window_info.window_id, window_info.bounds, is_modal);
-}
-
-static BOOL OnSetCursor(NSCursorInfo &aInfo)
-{
- if (NSCursorInfo::GetNativeCursorsSupported()) {
- NotifyBrowserOfSetCursor(aInfo);
- return YES;
- }
- return NO;
-}
-
-static BOOL OnHideCursor()
-{
- if (NSCursorInfo::GetNativeCursorsSupported()) {
- NotifyBrowserOfShowCursor(NO);
- return YES;
- }
- return NO;
-}
-
-static BOOL OnUnhideCursor()
-{
- if (NSCursorInfo::GetNativeCursorsSupported()) {
- NotifyBrowserOfShowCursor(YES);
- return YES;
- }
- return NO;
-}
-
-static BOOL OnPushCursor(NSCursorInfo &aInfo)
-{
- if (NSCursorInfo::GetNativeCursorsSupported()) {
- NotifyBrowserOfPushCursor(aInfo);
- return YES;
- }
- return NO;
-}
-
-static BOOL OnPopCursor()
-{
- if (NSCursorInfo::GetNativeCursorsSupported()) {
- NotifyBrowserOfPopCursor();
- return YES;
- }
- return NO;
-}
-
-} // namespace child
-} // namespace mac_plugin_interposing
-
-using namespace mac_plugin_interposing::child;
-
-@interface NSWindow (PluginInterposing)
-- (void)pluginInterpose_orderOut:(id)sender;
-- (void)pluginInterpose_orderFront:(id)sender;
-- (void)pluginInterpose_makeKeyAndOrderFront:(id)sender;
-- (void)pluginInterpose_setWindowNumber:(NSInteger)num;
-@end
-
-@implementation NSWindow (PluginInterposing)
-
-- (void)pluginInterpose_orderOut:(id)sender {
- WindowInfo window_info(self);
- [self pluginInterpose_orderOut:sender];
- OnPluginWindowClosed(window_info);
-}
-
-- (void)pluginInterpose_orderFront:(id)sender {
- mac_plugin_interposing::child::FocusPluginProcess();
- [self pluginInterpose_orderFront:sender];
- OnPluginWindowShown(WindowInfo(self), NO);
-}
-
-- (void)pluginInterpose_makeKeyAndOrderFront:(id)sender {
- mac_plugin_interposing::child::FocusPluginProcess();
- [self pluginInterpose_makeKeyAndOrderFront:sender];
- OnPluginWindowShown(WindowInfo(self), NO);
-}
-
-- (void)pluginInterpose_setWindowNumber:(NSInteger)num {
- if (num > 0)
- mac_plugin_interposing::child::FocusPluginProcess();
- [self pluginInterpose_setWindowNumber:num];
- if (num > 0)
- OnPluginWindowShown(WindowInfo(self), NO);
-}
-
-@end
-
-@interface NSApplication (PluginInterposing)
-- (NSInteger)pluginInterpose_runModalForWindow:(NSWindow*)window;
-@end
-
-@implementation NSApplication (PluginInterposing)
-
-- (NSInteger)pluginInterpose_runModalForWindow:(NSWindow*)window {
- mac_plugin_interposing::child::FocusPluginProcess();
- // This is out-of-order relative to the other calls, but runModalForWindow:
- // won't return until the window closes, and the order only matters for
- // full-screen windows.
- OnPluginWindowShown(WindowInfo(window), YES);
- return [self pluginInterpose_runModalForWindow:window];
-}
-
-@end
-
-// Hook commands to manipulate the current cursor, so that they can be passed
-// from the child process to the parent process. These commands have no
-// effect unless they're performed in the parent process.
-@interface NSCursor (PluginInterposing)
-- (void)pluginInterpose_set;
-- (void)pluginInterpose_push;
-- (void)pluginInterpose_pop;
-+ (NSCursor*)pluginInterpose_currentCursor;
-+ (void)pluginInterpose_hide;
-+ (void)pluginInterpose_unhide;
-+ (void)pluginInterpose_pop;
-@end
-
-// Cache the results of [NSCursor set], [NSCursor push] and [NSCursor pop].
-// The last element is always the current cursor.
-static NSMutableArray* gCursorStack = nil;
-
-static BOOL initCursorStack()
-{
- if (!gCursorStack) {
- gCursorStack = [[NSMutableArray arrayWithCapacity:5] retain];
- }
- return (gCursorStack != NULL);
-}
-
-static NSCursor* currentCursorFromCache()
-{
- if (!initCursorStack())
- return nil;
- return (NSCursor*) [gCursorStack lastObject];
-}
-
-static void setCursorInCache(NSCursor* aCursor)
-{
- if (!initCursorStack() || !aCursor)
- return;
- NSUInteger count = [gCursorStack count];
- if (count) {
- [gCursorStack replaceObjectAtIndex:count - 1 withObject:aCursor];
- } else {
- [gCursorStack addObject:aCursor];
- }
-}
-
-static void pushCursorInCache(NSCursor* aCursor)
-{
- if (!initCursorStack() || !aCursor)
- return;
- [gCursorStack addObject:aCursor];
-}
-
-static void popCursorInCache()
-{
- if (!initCursorStack())
- return;
- // Apple's doc on the +[NSCursor pop] method says: "If the current cursor
- // is the only cursor on the stack, this method does nothing."
- if ([gCursorStack count] > 1) {
- [gCursorStack removeLastObject];
- }
-}
-
-@implementation NSCursor (PluginInterposing)
-
-- (void)pluginInterpose_set
-{
- NSCursorInfo info(self);
- OnSetCursor(info);
- setCursorInCache(self);
- [self pluginInterpose_set];
-}
-
-- (void)pluginInterpose_push
-{
- NSCursorInfo info(self);
- OnPushCursor(info);
- pushCursorInCache(self);
- [self pluginInterpose_push];
-}
-
-- (void)pluginInterpose_pop
-{
- OnPopCursor();
- popCursorInCache();
- [self pluginInterpose_pop];
-}
-
-// The currentCursor method always returns nil when running in a background
-// process. But this may confuse plugins (notably Flash, see bug 621117). So
-// if we get a nil return from the "call to super", we return a cursor that's
-// been cached by previous calls to set or push. According to Apple's docs,
-// currentCursor "only returns the cursor set by your application using
-// NSCursor methods". So we don't need to worry about changes to the cursor
-// made by other methods like SetThemeCursor().
-+ (NSCursor*)pluginInterpose_currentCursor
-{
- NSCursor* retval = [self pluginInterpose_currentCursor];
- if (!retval) {
- retval = currentCursorFromCache();
- }
- return retval;
-}
-
-+ (void)pluginInterpose_hide
-{
- OnHideCursor();
- [self pluginInterpose_hide];
-}
-
-+ (void)pluginInterpose_unhide
-{
- OnUnhideCursor();
- [self pluginInterpose_unhide];
-}
-
-+ (void)pluginInterpose_pop
-{
- OnPopCursor();
- popCursorInCache();
- [self pluginInterpose_pop];
-}
-
-@end
-
-static void ExchangeMethods(Class target_class,
- BOOL class_method,
- SEL original,
- SEL replacement) {
- Method m1;
- Method m2;
- if (class_method) {
- m1 = class_getClassMethod(target_class, original);
- m2 = class_getClassMethod(target_class, replacement);
- } else {
- m1 = class_getInstanceMethod(target_class, original);
- m2 = class_getInstanceMethod(target_class, replacement);
- }
-
- if (m1 == m2)
- return;
-
- if (m1 && m2)
- method_exchangeImplementations(m1, m2);
- else
- NS_NOTREACHED("Cocoa swizzling failed");
-}
-
-namespace mac_plugin_interposing {
-namespace child {
-
-void SetUpCocoaInterposing() {
- Class nswindow_class = [NSWindow class];
- ExchangeMethods(nswindow_class, NO, @selector(orderOut:),
- @selector(pluginInterpose_orderOut:));
- ExchangeMethods(nswindow_class, NO, @selector(orderFront:),
- @selector(pluginInterpose_orderFront:));
- ExchangeMethods(nswindow_class, NO, @selector(makeKeyAndOrderFront:),
- @selector(pluginInterpose_makeKeyAndOrderFront:));
- ExchangeMethods(nswindow_class, NO, @selector(_setWindowNumber:),
- @selector(pluginInterpose_setWindowNumber:));
-
- ExchangeMethods([NSApplication class], NO, @selector(runModalForWindow:),
- @selector(pluginInterpose_runModalForWindow:));
-
- Class nscursor_class = [NSCursor class];
- ExchangeMethods(nscursor_class, NO, @selector(set),
- @selector(pluginInterpose_set));
- ExchangeMethods(nscursor_class, NO, @selector(push),
- @selector(pluginInterpose_push));
- ExchangeMethods(nscursor_class, NO, @selector(pop),
- @selector(pluginInterpose_pop));
- ExchangeMethods(nscursor_class, YES, @selector(currentCursor),
- @selector(pluginInterpose_currentCursor));
- ExchangeMethods(nscursor_class, YES, @selector(hide),
- @selector(pluginInterpose_hide));
- ExchangeMethods(nscursor_class, YES, @selector(unhide),
- @selector(pluginInterpose_unhide));
- ExchangeMethods(nscursor_class, YES, @selector(pop),
- @selector(pluginInterpose_pop));
-}
-
-} // namespace child
-} // namespace mac_plugin_interposing
-
-// Called from plugin_child_interpose.mm, which hooks calls to
-// SetCursor() (the QuickDraw call) from the plugin child process.
-extern "C" NS_VISIBILITY_DEFAULT BOOL
-mac_plugin_interposing_child_OnSetCursor(const Cursor* cursor)
-{
- NSCursorInfo info(cursor);
- return OnSetCursor(info);
-}
-
-// Called from plugin_child_interpose.mm, which hooks calls to
-// SetThemeCursor() (the Appearance Manager call) from the plugin child
-// process.
-extern "C" NS_VISIBILITY_DEFAULT BOOL
-mac_plugin_interposing_child_OnSetThemeCursor(ThemeCursor cursor)
-{
- NSCursorInfo info;
- switch (cursor) {
- case kThemeArrowCursor:
- info.SetType(NSCursorInfo::TypeArrow);
- break;
- case kThemeCopyArrowCursor:
- info.SetType(NSCursorInfo::TypeDragCopy);
- break;
- case kThemeAliasArrowCursor:
- info.SetType(NSCursorInfo::TypeDragLink);
- break;
- case kThemeContextualMenuArrowCursor:
- info.SetType(NSCursorInfo::TypeContextualMenu);
- break;
- case kThemeIBeamCursor:
- info.SetType(NSCursorInfo::TypeIBeam);
- break;
- case kThemeCrossCursor:
- case kThemePlusCursor:
- info.SetType(NSCursorInfo::TypeCrosshair);
- break;
- case kThemeWatchCursor:
- case kThemeSpinningCursor:
- info.SetType(NSCursorInfo::TypeArrow);
- break;
- case kThemeClosedHandCursor:
- info.SetType(NSCursorInfo::TypeClosedHand);
- break;
- case kThemeOpenHandCursor:
- info.SetType(NSCursorInfo::TypeOpenHand);
- break;
- case kThemePointingHandCursor:
- case kThemeCountingUpHandCursor:
- case kThemeCountingDownHandCursor:
- case kThemeCountingUpAndDownHandCursor:
- info.SetType(NSCursorInfo::TypePointingHand);
- break;
- case kThemeResizeLeftCursor:
- info.SetType(NSCursorInfo::TypeResizeLeft);
- break;
- case kThemeResizeRightCursor:
- info.SetType(NSCursorInfo::TypeResizeRight);
- break;
- case kThemeResizeLeftRightCursor:
- info.SetType(NSCursorInfo::TypeResizeLeftRight);
- break;
- case kThemeNotAllowedCursor:
- info.SetType(NSCursorInfo::TypeNotAllowed);
- break;
- case kThemeResizeUpCursor:
- info.SetType(NSCursorInfo::TypeResizeUp);
- break;
- case kThemeResizeDownCursor:
- info.SetType(NSCursorInfo::TypeResizeDown);
- break;
- case kThemeResizeUpDownCursor:
- info.SetType(NSCursorInfo::TypeResizeUpDown);
- break;
- case kThemePoofCursor:
- info.SetType(NSCursorInfo::TypeDisappearingItem);
- break;
- default:
- info.SetType(NSCursorInfo::TypeArrow);
- break;
- }
- return OnSetCursor(info);
-}
-
-extern "C" NS_VISIBILITY_DEFAULT BOOL
-mac_plugin_interposing_child_OnHideCursor()
-{
- return OnHideCursor();
-}
-
-extern "C" NS_VISIBILITY_DEFAULT BOOL
-mac_plugin_interposing_child_OnShowCursor()
-{
- return OnUnhideCursor();
-}
diff --git a/dom/plugins/ipc/PluginLibrary.h b/dom/plugins/ipc/PluginLibrary.h
index 2f9a3f81b2..50182d0b0d 100644
--- a/dom/plugins/ipc/PluginLibrary.h
+++ b/dom/plugins/ipc/PluginLibrary.h
@@ -57,7 +57,7 @@ public:
virtual bool HasRequiredFunctions() = 0;
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(XP_UNIX)
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) = 0;
#else
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) = 0;
@@ -66,7 +66,7 @@ public:
virtual nsresult NP_GetMIMEDescription(const char** mimeDesc) = 0;
virtual nsresult NP_GetValue(void *future, NPPVariable aVariable,
void *aValue, NPError* error) = 0;
-#if defined(XP_WIN) || defined(XP_MACOSX)
+#if defined(XP_WIN)
virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) = 0;
#endif
virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance,
@@ -83,10 +83,7 @@ public:
virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize) = 0;
virtual void DidComposite(NPP instance) = 0;
virtual bool IsOOP() = 0;
-#if defined(XP_MACOSX)
- virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) = 0;
-#endif
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
virtual nsresult ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) = 0;
#endif
#if defined(XP_WIN)
diff --git a/dom/plugins/ipc/PluginMessageUtils.cpp b/dom/plugins/ipc/PluginMessageUtils.cpp
index be1b2d15a5..9b27c76d5a 100644
--- a/dom/plugins/ipc/PluginMessageUtils.cpp
+++ b/dom/plugins/ipc/PluginMessageUtils.cpp
@@ -49,13 +49,10 @@ namespace plugins {
NPRemoteWindow::NPRemoteWindow() :
window(0), x(0), y(0), width(0), height(0), type(NPWindowTypeDrawable)
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(MOZ_X11) && defined(XP_UNIX)
, visualID(0)
, colormap(0)
#endif /* XP_UNIX */
-#if defined(XP_MACOSX)
- ,contentsScaleFactor(1.0)
-#endif
{
clipRect.top = 0;
clipRect.left = 0;
diff --git a/dom/plugins/ipc/PluginMessageUtils.h b/dom/plugins/ipc/PluginMessageUtils.h
index a9cd52ae29..e04e906382 100644
--- a/dom/plugins/ipc/PluginMessageUtils.h
+++ b/dom/plugins/ipc/PluginMessageUtils.h
@@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=4 ts=4 et :
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -23,11 +22,7 @@
#include "nsTArray.h"
#include "mozilla/Logging.h"
#include "nsHashKeys.h"
-#ifdef XP_MACOSX
-#include "PluginInterposeOSX.h"
-#else
namespace mac_plugin_interposing { class NSCursorInfo { }; }
-#endif
using mac_plugin_interposing::NSCursorInfo;
namespace mozilla {
@@ -87,24 +82,24 @@ struct NPRemoteWindow
uint32_t height;
NPRect clipRect;
NPWindowType type;
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(MOZ_X11) && defined(XP_UNIX)
VisualID visualID;
Colormap colormap;
#endif /* XP_UNIX */
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
double contentsScaleFactor;
#endif
};
-// This struct is like NPAudioDeviceChangeDetails, only it uses a
-// std::wstring instead of a const wchar_t* for the defaultDevice.
-// This gives us the necessary memory-ownership semantics without
-// requiring C++ objects in npapi.h.
-struct NPAudioDeviceChangeDetailsIPC
-{
- int32_t flow;
- int32_t role;
- std::wstring defaultDevice;
+// This struct is like NPAudioDeviceChangeDetails, only it uses a
+// std::wstring instead of a const wchar_t* for the defaultDevice.
+// This gives us the necessary memory-ownership semantics without
+// requiring C++ objects in npapi.h.
+struct NPAudioDeviceChangeDetailsIPC
+{
+ int32_t flow;
+ int32_t role;
+ std::wstring defaultDevice;
};
#ifdef XP_WIN
@@ -156,11 +151,6 @@ NPPVariableToString(NPPVariable aVar)
VARSTR(NPPVpluginWantsAllNetworkStreams);
-#ifdef XP_MACOSX
- VARSTR(NPPVpluginDrawingModel);
- VARSTR(NPPVpluginEventModel);
-#endif
-
#ifdef XP_WIN
VARSTR(NPPVpluginRequiresAudioDeviceChanges);
#endif
@@ -357,11 +347,11 @@ struct ParamTraits<mozilla::plugins::NPRemoteWindow>
WriteParam(aMsg, aParam.height);
WriteParam(aMsg, aParam.clipRect);
WriteParam(aMsg, aParam.type);
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(MOZ_X11) && defined(XP_UNIX)
aMsg->WriteULong(aParam.visualID);
aMsg->WriteULong(aParam.colormap);
#endif
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
aMsg->WriteDouble(aParam.contentsScaleFactor);
#endif
}
@@ -382,7 +372,7 @@ struct ParamTraits<mozilla::plugins::NPRemoteWindow>
ReadParam(aMsg, aIter, &type)))
return false;
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(MOZ_X11) && defined(XP_UNIX)
unsigned long visualID;
unsigned long colormap;
if (!(aMsg->ReadULong(aIter, &visualID) &&
@@ -390,7 +380,7 @@ struct ParamTraits<mozilla::plugins::NPRemoteWindow>
return false;
#endif
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
double contentsScaleFactor;
if (!aMsg->ReadDouble(aIter, &contentsScaleFactor))
return false;
@@ -403,11 +393,11 @@ struct ParamTraits<mozilla::plugins::NPRemoteWindow>
aResult->height = height;
aResult->clipRect = clipRect;
aResult->type = type;
-#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(MOZ_X11) && defined(XP_UNIX)
aResult->visualID = visualID;
aResult->colormap = colormap;
#endif
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
aResult->contentsScaleFactor = contentsScaleFactor;
#endif
return true;
@@ -422,161 +412,6 @@ struct ParamTraits<mozilla::plugins::NPRemoteWindow>
}
};
-#ifdef XP_MACOSX
-template <>
-struct ParamTraits<NPNSString*>
-{
- typedef NPNSString* paramType;
-
- // Empty string writes a length of 0 and no buffer.
- // We don't write a nullptr terminating character in buffers.
- static void Write(Message* aMsg, const paramType& aParam)
- {
- CFStringRef cfString = (CFStringRef)aParam;
-
- // Write true if we have a string, false represents nullptr.
- aMsg->WriteBool(!!cfString);
- if (!cfString) {
- return;
- }
-
- long length = ::CFStringGetLength(cfString);
- WriteParam(aMsg, length);
- if (length == 0) {
- return;
- }
-
- // Attempt to get characters without any allocation/conversion.
- if (::CFStringGetCharactersPtr(cfString)) {
- aMsg->WriteBytes(::CFStringGetCharactersPtr(cfString), length * sizeof(UniChar));
- } else {
- UniChar *buffer = (UniChar*)moz_xmalloc(length * sizeof(UniChar));
- ::CFStringGetCharacters(cfString, ::CFRangeMake(0, length), buffer);
- aMsg->WriteBytes(buffer, length * sizeof(UniChar));
- free(buffer);
- }
- }
-
- static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
- {
- bool haveString = false;
- if (!aMsg->ReadBool(aIter, &haveString)) {
- return false;
- }
- if (!haveString) {
- *aResult = nullptr;
- return true;
- }
-
- long length;
- if (!ReadParam(aMsg, aIter, &length)) {
- return false;
- }
-
- // Avoid integer multiplication overflow.
- if (length > INT_MAX / static_cast<long>(sizeof(UniChar))) {
- return false;
- }
-
- auto chars = mozilla::MakeUnique<UniChar[]>(length);
- if (length != 0) {
- if (!aMsg->ReadBytesInto(aIter, chars.get(), length * sizeof(UniChar))) {
- return false;
- }
- }
-
- *aResult = (NPNSString*)::CFStringCreateWithBytes(kCFAllocatorDefault, (UInt8*)chars.get(),
- length * sizeof(UniChar),
- kCFStringEncodingUTF16, false);
- if (!*aResult) {
- return false;
- }
-
- return true;
- }
-};
-#endif
-
-#ifdef XP_MACOSX
-template <>
-struct ParamTraits<NSCursorInfo>
-{
- typedef NSCursorInfo paramType;
-
- static void Write(Message* aMsg, const paramType& aParam)
- {
- NSCursorInfo::Type type = aParam.GetType();
-
- aMsg->WriteInt(type);
-
- nsPoint hotSpot = aParam.GetHotSpot();
- WriteParam(aMsg, hotSpot.x);
- WriteParam(aMsg, hotSpot.y);
-
- uint32_t dataLength = aParam.GetCustomImageDataLength();
- WriteParam(aMsg, dataLength);
- if (dataLength == 0) {
- return;
- }
-
- uint8_t* buffer = (uint8_t*)moz_xmalloc(dataLength);
- memcpy(buffer, aParam.GetCustomImageData(), dataLength);
- aMsg->WriteBytes(buffer, dataLength);
- free(buffer);
- }
-
- static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
- {
- NSCursorInfo::Type type;
- if (!aMsg->ReadInt(aIter, (int*)&type)) {
- return false;
- }
-
- nscoord hotSpotX, hotSpotY;
- if (!ReadParam(aMsg, aIter, &hotSpotX) ||
- !ReadParam(aMsg, aIter, &hotSpotY)) {
- return false;
- }
-
- uint32_t dataLength;
- if (!ReadParam(aMsg, aIter, &dataLength)) {
- return false;
- }
-
- auto data = mozilla::MakeUnique<uint8_t[]>(dataLength);
- if (dataLength != 0) {
- if (!aMsg->ReadBytesInto(aIter, data.get(), dataLength)) {
- return false;
- }
- }
-
- aResult->SetType(type);
- aResult->SetHotSpot(nsPoint(hotSpotX, hotSpotY));
- aResult->SetCustomImageData(data.get(), dataLength);
-
- return true;
- }
-
- static void Log(const paramType& aParam, std::wstring* aLog)
- {
- const char* typeName = aParam.GetTypeName();
- nsPoint hotSpot = aParam.GetHotSpot();
- int hotSpotX, hotSpotY;
-#ifdef NS_COORD_IS_FLOAT
- hotSpotX = rint(hotSpot.x);
- hotSpotY = rint(hotSpot.y);
-#else
- hotSpotX = hotSpot.x;
- hotSpotY = hotSpot.y;
-#endif
- uint32_t dataLength = aParam.GetCustomImageDataLength();
- uint8_t* data = aParam.GetCustomImageData();
-
- aLog->append(StringPrintf(L"[%s, (%i %i), %u, %p]",
- typeName, hotSpotX, hotSpotY, dataLength, data));
- }
-};
-#else
template<>
struct ParamTraits<NSCursorInfo>
{
@@ -589,7 +424,6 @@ struct ParamTraits<NSCursorInfo>
return false;
}
};
-#endif // #ifdef XP_MACOSX
template <>
struct ParamTraits<mozilla::plugins::IPCByteRange>
@@ -732,9 +566,7 @@ struct ParamTraits<mozilla::plugins::NPAudioDeviceChangeDetailsIPC>
//
// NB: these guards are based on those where struct NPEvent is defined
// in npapi.h. They should be kept in sync.
-#if defined(XP_MACOSX)
-# include "mozilla/plugins/NPEventOSX.h"
-#elif defined(XP_WIN)
+#if defined(XP_WIN)
# include "mozilla/plugins/NPEventWindows.h"
#elif defined(XP_UNIX)
# include "mozilla/plugins/NPEventUnix.h"
diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp
index 1e65345fda..bd13b8d9a4 100644
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -132,12 +132,6 @@ PluginModuleChild::PluginModuleChild(bool aIsChrome)
MOZ_ASSERT(!gChromeInstance);
gChromeInstance = this;
}
-
-#ifdef XP_MACOSX
- if (aIsChrome) {
- mac_plugin_interposing::child::SetUpCocoaInterposing();
- }
-#endif
}
PluginModuleChild::~PluginModuleChild()
@@ -260,14 +254,8 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
AddQuirk(QUIRK_FLASH_EXPOSE_COORD_TRANSLATION);
}
#endif
-#if defined(XP_MACOSX)
- const char* namePrefix = "Plugin Content";
- char nameBuffer[80];
- SprintfLiteral(nameBuffer, "%s (%s)", namePrefix, info.fName);
- mozilla::plugins::PluginUtilsOSX::SetProcessName(nameBuffer);
-#endif
pluginFile.FreePluginInfo(info);
-#if defined(MOZ_X11) || defined(XP_MACOSX)
+#if defined(MOZ_X11)
if (!mLibrary)
#endif
{
diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp
index 6ea205ef0f..f7609bcd5e 100755
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * vim: sw=4 ts=4 et :
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -48,9 +47,6 @@
#ifdef MOZ_WIDGET_GTK
#include <glib.h>
-#elif XP_MACOSX
-#include "PluginInterposeOSX.h"
-#include "PluginUtilsOSX.h"
#endif
using base::KillProcess;
@@ -508,7 +504,7 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
if (NS_SUCCEEDED(mAsyncInitRv))
#endif
{
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(XP_UNIX)
mAsyncInitRv = NP_Initialize(mNPNIface,
mNPPIface,
&mAsyncInitError);
@@ -517,13 +513,6 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
&mAsyncInitError);
#endif
}
-
-#if defined(XP_MACOSX)
- if (NS_SUCCEEDED(mAsyncInitRv)) {
- mAsyncInitRv = NP_GetEntryPoints(mNPPIface,
- &mAsyncInitError);
- }
-#endif
}
}
@@ -1668,13 +1657,8 @@ PluginModuleParent::GetSettings(PluginSettings* aSettings)
aSettings->supportsWindowless() = GetSetting(NPNVSupportsWindowless);
aSettings->userAgent() = NullableString(mNPNIface->uagent(nullptr));
-#if defined(XP_MACOSX)
- aSettings->nativeCursorsSupported() =
- Preferences::GetBool("dom.ipc.plugins.nativeCursorSupport", false);
-#else
// Need to initialize this to satisfy IPDL.
aSettings->nativeCursorsSupported() = false;
-#endif
}
void
@@ -1692,7 +1676,7 @@ PluginModuleChromeParent::CachedSettingChanged(const char* aPref, void* aModule)
module->CachedSettingChanged();
}
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(XP_UNIX)
nsresult
PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error)
{
@@ -1830,7 +1814,7 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
return NS_OK;
}
-#if defined(XP_WIN) || defined(XP_MACOSX)
+#if defined(XP_WIN)
nsresult
PluginModuleContentParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
@@ -1853,20 +1837,10 @@ PluginModuleChromeParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
if (NS_FAILED(rv))
return rv;
-#if defined(XP_MACOSX)
- if (!mSubprocess->IsConnected()) {
- // The subprocess isn't connected yet. Defer NP_Initialize until
- // OnProcessLaunched is invoked.
- mInitOnAsyncConnect = true;
- *error = NPERR_NO_ERROR;
- return NS_OK;
- }
-#else
if (mInitOnAsyncConnect) {
*error = NPERR_NO_ERROR;
return NS_OK;
}
-#endif
PluginSettings settings;
GetSettings(&settings);
@@ -2058,7 +2032,7 @@ PluginModuleParent::NP_GetValue(void *future, NPPVariable aVariable,
return NS_OK;
}
-#if defined(XP_WIN) || defined(XP_MACOSX)
+#if defined(XP_WIN)
nsresult
PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error)
{
@@ -2067,16 +2041,7 @@ PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error)
*error = NPERR_NO_ERROR;
if (mIsStartingAsync && !IsChrome()) {
mNPPIface = pFuncs;
-#if defined(XP_MACOSX)
- if (mNPInitialized) {
- SetPluginFuncs(pFuncs);
- InitAsyncSurrogates();
- } else {
- PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs);
- }
-#else
PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs);
-#endif
} else {
SetPluginFuncs(pFuncs);
}
@@ -2087,14 +2052,6 @@ PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error)
nsresult
PluginModuleChromeParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error)
{
-#if defined(XP_MACOSX)
- if (mInitOnAsyncConnect) {
- PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs);
- mNPPIface = pFuncs;
- *error = NPERR_NO_ERROR;
- return NS_OK;
- }
-#else
if (mIsStartingAsync) {
PluginAsyncSurrogate::NP_GetEntryPoints(pFuncs);
}
@@ -2104,7 +2061,6 @@ PluginModuleChromeParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* erro
*error = NPERR_NO_ERROR;
return NS_OK;
}
-#endif
// We need to have the plugin process update its function table here by
// actually calling NP_GetEntryPoints. The parent's function table will
@@ -2325,18 +2281,7 @@ PluginModuleParent::NPP_GetSitesWithData(nsCOMPtr<nsIGetSitesWithDataCallback> c
return NS_OK;
}
-#if defined(XP_MACOSX)
-nsresult
-PluginModuleParent::IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing)
-{
- PluginInstanceParent* i = PluginInstanceParent::Cast(instance);
- if (!i)
- return NS_ERROR_FAILURE;
-
- return i->IsRemoteDrawingCoreAnimation(aDrawing);
-}
-#endif
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
nsresult
PluginModuleParent::ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor)
{
@@ -2346,17 +2291,9 @@ PluginModuleParent::ContentsScaleFactorChanged(NPP instance, double aContentsSca
return i->ContentsScaleFactorChanged(aContentsScaleFactor);
}
-#endif // #if defined(XP_MACOSX)
-
-#if defined(XP_MACOSX)
-bool
-PluginModuleParent::AnswerProcessSomeEvents()
-{
- mozilla::plugins::PluginUtilsOSX::InvokeNativeEventLoop();
- return true;
-}
+#endif // #if defined(XP_WIN)
-#elif !defined(MOZ_WIDGET_GTK)
+#if !defined(MOZ_WIDGET_GTK)
bool
PluginModuleParent::AnswerProcessSomeEvents()
{
@@ -2414,85 +2351,54 @@ PluginModuleParent::RecvPluginShowWindow(const uint32_t& aWindowId, const bool&
const size_t& aWidth, const size_t& aHeight)
{
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
-#if defined(XP_MACOSX)
- CGRect windowBound = ::CGRectMake(aX, aY, aWidth, aHeight);
- mac_plugin_interposing::parent::OnPluginShowWindow(aWindowId, windowBound, aModal);
- return true;
-#else
NS_NOTREACHED(
"PluginInstanceParent::RecvPluginShowWindow not implemented!");
return false;
-#endif
}
bool
PluginModuleParent::RecvPluginHideWindow(const uint32_t& aWindowId)
{
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
-#if defined(XP_MACOSX)
- mac_plugin_interposing::parent::OnPluginHideWindow(aWindowId, OtherPid());
- return true;
-#else
NS_NOTREACHED(
"PluginInstanceParent::RecvPluginHideWindow not implemented!");
return false;
-#endif
}
bool
PluginModuleParent::RecvSetCursor(const NSCursorInfo& aCursorInfo)
{
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
-#if defined(XP_MACOSX)
- mac_plugin_interposing::parent::OnSetCursor(aCursorInfo);
- return true;
-#else
NS_NOTREACHED(
"PluginInstanceParent::RecvSetCursor not implemented!");
return false;
-#endif
}
bool
PluginModuleParent::RecvShowCursor(const bool& aShow)
{
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
-#if defined(XP_MACOSX)
- mac_plugin_interposing::parent::OnShowCursor(aShow);
- return true;
-#else
NS_NOTREACHED(
"PluginInstanceParent::RecvShowCursor not implemented!");
return false;
-#endif
}
bool
PluginModuleParent::RecvPushCursor(const NSCursorInfo& aCursorInfo)
{
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
-#if defined(XP_MACOSX)
- mac_plugin_interposing::parent::OnPushCursor(aCursorInfo);
- return true;
-#else
NS_NOTREACHED(
"PluginInstanceParent::RecvPushCursor not implemented!");
return false;
-#endif
}
bool
PluginModuleParent::RecvPopCursor()
{
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
-#if defined(XP_MACOSX)
- mac_plugin_interposing::parent::OnPopCursor();
- return true;
-#else
NS_NOTREACHED(
"PluginInstanceParent::RecvPopCursor not implemented!");
return false;
-#endif
}
bool
diff --git a/dom/plugins/ipc/PluginModuleParent.h b/dom/plugins/ipc/PluginModuleParent.h
index 909e8fe351..11c2a47c65 100644
--- a/dom/plugins/ipc/PluginModuleParent.h
+++ b/dom/plugins/ipc/PluginModuleParent.h
@@ -247,7 +247,7 @@ protected:
const mozilla::NativeEventData& aNativeKeyData,
bool aIsConsumed) override;
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(XP_UNIX)
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) override;
#else
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) override;
@@ -257,7 +257,7 @@ protected:
virtual nsresult NP_GetMIMEDescription(const char** mimeDesc) override;
virtual nsresult NP_GetValue(void *future, NPPVariable aVariable,
void *aValue, NPError* error) override;
-#if defined(XP_WIN) || defined(XP_MACOSX)
+#if defined(XP_WIN)
virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) override;
#endif
virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance,
@@ -278,10 +278,7 @@ private:
public:
-#if defined(XP_MACOSX)
- virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) override;
-#endif
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_WIN)
virtual nsresult ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) override;
#endif
@@ -355,7 +352,7 @@ class PluginModuleContentParent : public PluginModuleParent
virtual ~PluginModuleContentParent();
-#if defined(XP_WIN) || defined(XP_MACOSX)
+#if defined(XP_WIN)
nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) override;
#endif
@@ -479,13 +476,13 @@ private:
PluginProcessParent* Process() const { return mSubprocess; }
base::ProcessHandle ChildProcessHandle() { return mSubprocess->GetChildProcessHandle(); }
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
+#if defined(XP_UNIX)
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) override;
#else
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) override;
#endif
-#if defined(XP_WIN) || defined(XP_MACOSX)
+#if defined(XP_WIN)
virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) override;
#endif
diff --git a/dom/plugins/ipc/PluginProcessChild.cpp b/dom/plugins/ipc/PluginProcessChild.cpp
index 32bf062150..9ba0926636 100644
--- a/dom/plugins/ipc/PluginProcessChild.cpp
+++ b/dom/plugins/ipc/PluginProcessChild.cpp
@@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * vim: sw=4 ts=4 et :
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -13,13 +12,6 @@
#include "base/string_util.h"
#include "nsDebugImpl.h"
-#if defined(XP_MACOSX)
-#include "nsCocoaFeatures.h"
-// An undocumented CoreGraphics framework method, present in the same form
-// since at least OS X 10.5.
-extern "C" CGError CGSSetDebugOptions(int options);
-#endif
-
#ifdef XP_WIN
bool ShouldProtectPluginCurrentDirectory(char16ptr_t pluginFilePath);
#endif
@@ -40,42 +32,6 @@ PluginProcessChild::Init()
{
nsDebugImpl::SetMultiprocessMode("NPAPI");
-#if defined(XP_MACOSX)
- // Remove the trigger for "dyld interposing" that we added in
- // GeckoChildProcessHost::PerformAsyncLaunchInternal(), in the host
- // process just before we were launched. Dyld interposing will still
- // happen in our process (the plugin child process). But we don't want
- // it to happen in any processes that the plugin might launch from our
- // process.
- nsCString interpose(PR_GetEnv("DYLD_INSERT_LIBRARIES"));
- if (!interpose.IsEmpty()) {
- // If we added the path to libplugin_child_interpose.dylib to an
- // existing DYLD_INSERT_LIBRARIES, we appended it to the end, after a
- // ":" path seperator.
- int32_t lastSeparatorPos = interpose.RFind(":");
- int32_t lastTriggerPos = interpose.RFind("libplugin_child_interpose.dylib");
- bool needsReset = false;
- if (lastTriggerPos != -1) {
- if (lastSeparatorPos == -1) {
- interpose.Truncate();
- needsReset = true;
- } else if (lastTriggerPos > lastSeparatorPos) {
- interpose.SetLength(lastSeparatorPos);
- needsReset = true;
- }
- }
- if (needsReset) {
- nsCString setInterpose("DYLD_INSERT_LIBRARIES=");
- if (!interpose.IsEmpty()) {
- setInterpose.Append(interpose);
- }
- // Values passed to PR_SetEnv() must be seperately allocated.
- char* setInterposePtr = strdup(setInterpose.get());
- PR_SetEnv(setInterposePtr);
- }
- }
-#endif
-
// Certain plugins, such as flash, steal the unhandled exception filter
// thus we never get crash reports when they fault. This call fixes it.
message_loop()->set_exception_restoration(true);
@@ -115,17 +71,6 @@ PluginProcessChild::Init()
bool retval = mPlugin.InitForChrome(pluginFilename, ParentPid(),
IOThreadChild::message_loop(),
IOThreadChild::channel());
-#if defined(XP_MACOSX)
- if (nsCocoaFeatures::OnYosemiteOrLater()) {
- // Explicitly turn off CGEvent logging. This works around bug 1092855.
- // If there are already CGEvents in the log, turning off logging also
- // causes those events to be written to disk. But at this point no
- // CGEvents have yet been processed. CGEvents are events (usually
- // input events) pulled from the WindowServer. An option of 0x80000008
- // turns on CGEvent logging.
- CGSSetDebugOptions(0x80000007);
- }
-#endif
return retval;
}
diff --git a/dom/plugins/ipc/PluginProcessParent.cpp b/dom/plugins/ipc/PluginProcessParent.cpp
index fb0e182461..b6efcdc64c 100644
--- a/dom/plugins/ipc/PluginProcessParent.cpp
+++ b/dom/plugins/ipc/PluginProcessParent.cpp
@@ -49,13 +49,6 @@ PluginProcessParent::Launch(mozilla::UniquePtr<LaunchCompleteTask> aLaunchComple
uint32_t containerArchitectures = GetSupportedArchitecturesForProcessType(GeckoProcessType_Plugin);
uint32_t pluginLibArchitectures = currentArchitecture;
-#ifdef XP_MACOSX
- nsresult rv = GetArchitecturesForBinary(mPluginFilePath.c_str(), &pluginLibArchitectures);
- if (NS_FAILED(rv)) {
- // If the call failed just assume that we want the current architecture.
- pluginLibArchitectures = currentArchitecture;
- }
-#endif
ProcessArchitecture selectedArchitecture = currentArchitecture;
if (!(pluginLibArchitectures & containerArchitectures & currentArchitecture)) {
diff --git a/dom/plugins/ipc/PluginQuirks.cpp b/dom/plugins/ipc/PluginQuirks.cpp
index c60cf88362..a8b0f62056 100644
--- a/dom/plugins/ipc/PluginQuirks.cpp
+++ b/dom/plugins/ipc/PluginQuirks.cpp
@@ -49,16 +49,6 @@ int GetQuirksFromMimeTypeAndFilename(const nsCString& aMimeType,
}
#endif
-#ifdef XP_MACOSX
- // Whitelist Flash and Quicktime to support offline renderer
- NS_NAMED_LITERAL_CSTRING(quicktime, "QuickTime Plugin.plugin");
- if (specialType == nsPluginHost::eSpecialType_Flash) {
- quirks |= QUIRK_ALLOW_OFFLINE_RENDERER;
- } else if (FindInReadable(quicktime, aPluginFilename)) {
- quirks |= QUIRK_ALLOW_OFFLINE_RENDERER;
- }
-#endif
-
#ifdef OS_WIN
if (specialType == nsPluginHost::eSpecialType_Unity) {
quirks |= QUIRK_UNITY_FIXUP_MOUSE_CAPTURE;
diff --git a/dom/plugins/ipc/PluginUtilsOSX.h b/dom/plugins/ipc/PluginUtilsOSX.h
deleted file mode 100644
index c201782c0f..0000000000
--- a/dom/plugins/ipc/PluginUtilsOSX.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-// vim:set ts=2 sts=2 sw=2 et cin:
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef dom_plugins_PluginUtilsOSX_h
-#define dom_plugins_PluginUtilsOSX_h 1
-
-#include "npapi.h"
-#include "mozilla/gfx/QuartzSupport.h"
-#include "nsRect.h"
-
-namespace mozilla {
-namespace plugins {
-namespace PluginUtilsOSX {
-
-// Need to call back into the browser's message loop to process event.
-typedef void (*RemoteProcessEvents) (void*);
-
-NPError ShowCocoaContextMenu(void* aMenu, int aX, int aY, void* pluginModule, RemoteProcessEvents remoteEvent);
-
-void InvokeNativeEventLoop();
-
-// Need to call back and send a cocoa draw event to the plugin.
-typedef void (*DrawPluginFunc) (CGContextRef, void*, nsIntRect aUpdateRect);
-
-void* GetCGLayer(DrawPluginFunc aFunc, void* aPluginInstance, double aContentsScaleFactor);
-void ReleaseCGLayer(void* cgLayer);
-void Repaint(void* cgLayer, nsIntRect aRect);
-
-bool SetProcessName(const char* aProcessName);
-
-/*
- * Provides a wrapper around nsCARenderer to manage double buffering
- * without having to unbind nsCARenderer on every surface swaps.
- *
- * The double buffer renderer begins with no initialize surfaces.
- * The buffers can be initialized and cleared individually.
- * Swapping still occurs regardless if the buffers are initialized.
- */
-class nsDoubleBufferCARenderer {
-public:
- nsDoubleBufferCARenderer() : mCALayer(nullptr), mContentsScaleFactor(1.0) {}
- // Returns width in "display pixels". A "display pixel" is the smallest
- // fully addressable part of a display. But in HiDPI modes each "display
- // pixel" corresponds to more than one device pixel. Multiply display pixels
- // by mContentsScaleFactor to get device pixels.
- size_t GetFrontSurfaceWidth();
- // Returns height in "display pixels". Multiply by
- // mContentsScaleFactor to get device pixels.
- size_t GetFrontSurfaceHeight();
- double GetFrontSurfaceContentsScaleFactor();
- // Returns width in "display pixels". Multiply by
- // mContentsScaleFactor to get device pixels.
- size_t GetBackSurfaceWidth();
- // Returns height in "display pixels". Multiply by
- // mContentsScaleFactor to get device pixels.
- size_t GetBackSurfaceHeight();
- double GetBackSurfaceContentsScaleFactor();
- IOSurfaceID GetFrontSurfaceID();
-
- bool HasBackSurface();
- bool HasFrontSurface();
- bool HasCALayer();
-
- void SetCALayer(void *aCALayer);
- // aWidth and aHeight are in "display pixels". Multiply by
- // aContentsScaleFactor to get device pixels.
- bool InitFrontSurface(size_t aWidth, size_t aHeight,
- double aContentsScaleFactor,
- AllowOfflineRendererEnum aAllowOfflineRenderer);
- void Render();
- void SwapSurfaces();
- void ClearFrontSurface();
- void ClearBackSurface();
-
- double GetContentsScaleFactor() { return mContentsScaleFactor; }
-
-private:
- void *mCALayer;
- RefPtr<nsCARenderer> mCARenderer;
- RefPtr<MacIOSurface> mFrontSurface;
- RefPtr<MacIOSurface> mBackSurface;
- double mContentsScaleFactor;
-};
-
-} // namespace PluginUtilsOSX
-} // namespace plugins
-} // namespace mozilla
-
-#endif //dom_plugins_PluginUtilsOSX_h
diff --git a/dom/plugins/ipc/PluginUtilsOSX.mm b/dom/plugins/ipc/PluginUtilsOSX.mm
deleted file mode 100644
index 2a920f7f61..0000000000
--- a/dom/plugins/ipc/PluginUtilsOSX.mm
+++ /dev/null
@@ -1,462 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-// vim:set ts=2 sts=2 sw=2 et cin:
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include <dlfcn.h>
-#import <AppKit/AppKit.h>
-#import <QuartzCore/QuartzCore.h>
-#include "PluginUtilsOSX.h"
-
-// Remove definitions for try/catch interfering with ObjCException macros.
-#include "nsObjCExceptions.h"
-#include "nsCocoaUtils.h"
-
-#include "nsDebug.h"
-
-#include "mozilla/Sprintf.h"
-
-@interface CALayer (ContentsScale)
-- (double)contentsScale;
-- (void)setContentsScale:(double)scale;
-@end
-
-using namespace mozilla::plugins::PluginUtilsOSX;
-
-@interface CGBridgeLayer : CALayer {
- DrawPluginFunc mDrawFunc;
- void* mPluginInstance;
- nsIntRect mUpdateRect;
-}
-- (void)setDrawFunc:(DrawPluginFunc)aFunc
- pluginInstance:(void*)aPluginInstance;
-- (void)updateRect:(nsIntRect)aRect;
-
-@end
-
-// CGBitmapContextSetData() is an undocumented function present (with
-// the same signature) since at least OS X 10.5. As the name suggests,
-// it's used to replace the "data" in a bitmap context that was
-// originally specified in a call to CGBitmapContextCreate() or
-// CGBitmapContextCreateWithData().
-typedef void (*CGBitmapContextSetDataFunc) (CGContextRef c,
- size_t x,
- size_t y,
- size_t width,
- size_t height,
- void* data,
- size_t bitsPerComponent,
- size_t bitsPerPixel,
- size_t bytesPerRow);
-CGBitmapContextSetDataFunc CGBitmapContextSetDataPtr = NULL;
-
-@implementation CGBridgeLayer
-- (void) updateRect:(nsIntRect)aRect
-{
- mUpdateRect.UnionRect(mUpdateRect, aRect);
-}
-
-- (void) setDrawFunc:(DrawPluginFunc)aFunc
- pluginInstance:(void*)aPluginInstance
-{
- mDrawFunc = aFunc;
- mPluginInstance = aPluginInstance;
-}
-
-- (void)drawInContext:(CGContextRef)aCGContext
-{
- ::CGContextSaveGState(aCGContext);
- ::CGContextTranslateCTM(aCGContext, 0, self.bounds.size.height);
- ::CGContextScaleCTM(aCGContext, (CGFloat) 1, (CGFloat) -1);
-
- mUpdateRect = nsIntRect::Truncate(0, 0, self.bounds.size.width, self.bounds.size.height);
-
- mDrawFunc(aCGContext, mPluginInstance, mUpdateRect);
-
- ::CGContextRestoreGState(aCGContext);
-
- mUpdateRect.SetEmpty();
-}
-
-@end
-
-void* mozilla::plugins::PluginUtilsOSX::GetCGLayer(DrawPluginFunc aFunc,
- void* aPluginInstance,
- double aContentsScaleFactor) {
- CGBridgeLayer *bridgeLayer = [[CGBridgeLayer alloc] init];
-
- // We need to make bridgeLayer behave properly when its superlayer changes
- // size (in nsCARenderer::SetBounds()).
- bridgeLayer.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable;
- bridgeLayer.needsDisplayOnBoundsChange = YES;
- NSNull *nullValue = [NSNull null];
- NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys:
- nullValue, @"bounds",
- nullValue, @"contents",
- nullValue, @"contentsRect",
- nullValue, @"position",
- nil];
- [bridgeLayer setStyle:[NSDictionary dictionaryWithObject:actions forKey:@"actions"]];
-
- // For reasons that aren't clear (perhaps one or more OS bugs), we can only
- // use full HiDPI resolution here if the tree is built with the 10.7 SDK or
- // up. If we build with the 10.6 SDK, changing the contentsScale property
- // of bridgeLayer (even to the same value) causes it to stop working (go
- // blank). This doesn't happen with objects that are members of the CALayer
- // class (as opposed to one of its subclasses).
-#if defined(MAC_OS_X_VERSION_10_7) && \
- MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
- if ([bridgeLayer respondsToSelector:@selector(setContentsScale:)]) {
- bridgeLayer.contentsScale = aContentsScaleFactor;
- }
-#endif
-
- [bridgeLayer setDrawFunc:aFunc
- pluginInstance:aPluginInstance];
- return bridgeLayer;
-}
-
-void mozilla::plugins::PluginUtilsOSX::ReleaseCGLayer(void *cgLayer) {
- CGBridgeLayer *bridgeLayer = (CGBridgeLayer*)cgLayer;
- [bridgeLayer release];
-}
-
-void mozilla::plugins::PluginUtilsOSX::Repaint(void *caLayer, nsIntRect aRect) {
- CGBridgeLayer *bridgeLayer = (CGBridgeLayer*)caLayer;
- [CATransaction begin];
- [bridgeLayer updateRect:aRect];
- [bridgeLayer setNeedsDisplay];
- [bridgeLayer displayIfNeeded];
- [CATransaction commit];
-}
-
-@interface EventProcessor : NSObject {
- RemoteProcessEvents aRemoteEvents;
- void *aPluginModule;
-}
-- (void)setRemoteEvents:(RemoteProcessEvents) remoteEvents pluginModule:(void*) pluginModule;
-- (void)onTick;
-@end
-
-@implementation EventProcessor
-- (void) onTick
-{
- aRemoteEvents(aPluginModule);
-}
-
-- (void)setRemoteEvents:(RemoteProcessEvents) remoteEvents pluginModule:(void*) pluginModule
-{
- aRemoteEvents = remoteEvents;
- aPluginModule = pluginModule;
-}
-@end
-
-#define EVENT_PROCESS_DELAY 0.05 // 50 ms
-
-NPError mozilla::plugins::PluginUtilsOSX::ShowCocoaContextMenu(void* aMenu, int aX, int aY, void* pluginModule, RemoteProcessEvents remoteEvent)
-{
- NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
-
- // Set the native cursor to the OS default (an arrow) before displaying the
- // context menu. Otherwise (if the plugin has changed the cursor) it may
- // stay as the plugin has set it -- which means it may be invisible. We
- // need to do this because we display the context menu without making the
- // plugin process the foreground process. If we did, the cursor would
- // change to an arrow cursor automatically -- as it does in Chrome.
- [[NSCursor arrowCursor] set];
-
- EventProcessor* eventProcessor = nullptr;
- NSTimer *eventTimer = nullptr;
- if (pluginModule) {
- // Create a timer to process browser events while waiting
- // on the menu. This prevents the browser from hanging
- // during the lifetime of the menu.
- eventProcessor = [[EventProcessor alloc] init];
- [eventProcessor setRemoteEvents:remoteEvent pluginModule:pluginModule];
- eventTimer = [NSTimer timerWithTimeInterval:EVENT_PROCESS_DELAY
- target:eventProcessor selector:@selector(onTick)
- userInfo:nil repeats:TRUE];
- // Use NSEventTrackingRunLoopMode otherwise the timer will
- // not fire during the right click menu.
- [[NSRunLoop currentRunLoop] addTimer:eventTimer
- forMode:NSEventTrackingRunLoopMode];
- }
-
- NSMenu* nsmenu = reinterpret_cast<NSMenu*>(aMenu);
- NSPoint screen_point = ::NSMakePoint(aX, aY);
-
- [nsmenu popUpMenuPositioningItem:nil atLocation:screen_point inView:nil];
-
- if (pluginModule) {
- [eventTimer invalidate];
- [eventProcessor release];
- }
-
- return NPERR_NO_ERROR;
-
- NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NPERR_GENERIC_ERROR);
-}
-
-void mozilla::plugins::PluginUtilsOSX::InvokeNativeEventLoop()
-{
- NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
- ::CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.0, true);
- NS_OBJC_END_TRY_ABORT_BLOCK;
-}
-
-
-#define UNDOCUMENTED_SESSION_CONSTANT ((int)-2)
-namespace mozilla {
-namespace plugins {
-namespace PluginUtilsOSX {
- static void *sApplicationASN = NULL;
- static void *sApplicationInfoItem = NULL;
-} // namespace PluginUtilsOSX
-} // namespace plugins
-} // namespace mozilla
-
-bool mozilla::plugins::PluginUtilsOSX::SetProcessName(const char* aProcessName) {
- NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
- nsAutoreleasePool localPool;
-
- if (!aProcessName || strcmp(aProcessName, "") == 0) {
- return false;
- }
-
- NSString *currentName = [[[NSBundle mainBundle] localizedInfoDictionary]
- objectForKey:(NSString *)kCFBundleNameKey];
-
- char formattedName[1024];
- SprintfLiteral(formattedName, "%s %s", [currentName UTF8String], aProcessName);
-
- aProcessName = formattedName;
-
- // This function is based on Chrome/Webkit's and relies on potentially dangerous SPI.
- typedef CFTypeRef (*LSGetASNType)();
- typedef OSStatus (*LSSetInformationItemType)(int, CFTypeRef,
- CFStringRef,
- CFStringRef,
- CFDictionaryRef*);
-
- CFBundleRef launchServices = ::CFBundleGetBundleWithIdentifier(
- CFSTR("com.apple.LaunchServices"));
- if (!launchServices) {
- NS_WARNING("Failed to set process name: Could not open LaunchServices bundle");
- return false;
- }
-
- if (!sApplicationASN) {
- sApplicationASN = ::CFBundleGetFunctionPointerForName(launchServices,
- CFSTR("_LSGetCurrentApplicationASN"));
- }
-
- LSGetASNType getASNFunc = reinterpret_cast<LSGetASNType>
- (sApplicationASN);
-
- if (!sApplicationInfoItem) {
- sApplicationInfoItem = ::CFBundleGetFunctionPointerForName(launchServices,
- CFSTR("_LSSetApplicationInformationItem"));
- }
-
- LSSetInformationItemType setInformationItemFunc
- = reinterpret_cast<LSSetInformationItemType>
- (sApplicationInfoItem);
-
- void * displayNameKeyAddr = ::CFBundleGetDataPointerForName(launchServices,
- CFSTR("_kLSDisplayNameKey"));
-
- CFStringRef displayNameKey = nil;
- if (displayNameKeyAddr) {
- displayNameKey = reinterpret_cast<CFStringRef>(*(CFStringRef*)displayNameKeyAddr);
- }
-
- // Rename will fail without this
- ProcessSerialNumber psn;
- if (::GetCurrentProcess(&psn) != noErr) {
- return false;
- }
-
- CFTypeRef currentAsn = getASNFunc();
-
- if (!getASNFunc || !setInformationItemFunc ||
- !displayNameKey || !currentAsn) {
- NS_WARNING("Failed to set process name: Accessing launchServices failed");
- return false;
- }
-
- CFStringRef processName = ::CFStringCreateWithCString(nil,
- aProcessName,
- kCFStringEncodingASCII);
- if (!processName) {
- NS_WARNING("Failed to set process name: Could not create CFStringRef");
- return false;
- }
-
- OSErr err = setInformationItemFunc(UNDOCUMENTED_SESSION_CONSTANT, currentAsn,
- displayNameKey, processName,
- nil); // Optional out param
- ::CFRelease(processName);
- if (err != noErr) {
- NS_WARNING("Failed to set process name: LSSetInformationItemType err");
- return false;
- }
-
- return true;
- NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
-}
-
-namespace mozilla {
-namespace plugins {
-namespace PluginUtilsOSX {
-
-size_t nsDoubleBufferCARenderer::GetFrontSurfaceWidth() {
- if (!HasFrontSurface()) {
- return 0;
- }
-
- return mFrontSurface->GetWidth();
-}
-
-size_t nsDoubleBufferCARenderer::GetFrontSurfaceHeight() {
- if (!HasFrontSurface()) {
- return 0;
- }
-
- return mFrontSurface->GetHeight();
-}
-
-double nsDoubleBufferCARenderer::GetFrontSurfaceContentsScaleFactor() {
- if (!HasFrontSurface()) {
- return 1.0;
- }
-
- return mFrontSurface->GetContentsScaleFactor();
-}
-
-size_t nsDoubleBufferCARenderer::GetBackSurfaceWidth() {
- if (!HasBackSurface()) {
- return 0;
- }
-
- return mBackSurface->GetWidth();
-}
-
-size_t nsDoubleBufferCARenderer::GetBackSurfaceHeight() {
- if (!HasBackSurface()) {
- return 0;
- }
-
- return mBackSurface->GetHeight();
-}
-
-double nsDoubleBufferCARenderer::GetBackSurfaceContentsScaleFactor() {
- if (!HasBackSurface()) {
- return 1.0;
- }
-
- return mBackSurface->GetContentsScaleFactor();
-}
-
-IOSurfaceID nsDoubleBufferCARenderer::GetFrontSurfaceID() {
- if (!HasFrontSurface()) {
- return 0;
- }
-
- return mFrontSurface->GetIOSurfaceID();
-}
-
-bool nsDoubleBufferCARenderer::HasBackSurface() {
- return !!mBackSurface;
-}
-
-bool nsDoubleBufferCARenderer::HasFrontSurface() {
- return !!mFrontSurface;
-}
-
-bool nsDoubleBufferCARenderer::HasCALayer() {
- return !!mCALayer;
-}
-
-void nsDoubleBufferCARenderer::SetCALayer(void *aCALayer) {
- mCALayer = aCALayer;
-}
-
-bool nsDoubleBufferCARenderer::InitFrontSurface(size_t aWidth, size_t aHeight,
- double aContentsScaleFactor,
- AllowOfflineRendererEnum aAllowOfflineRenderer) {
- if (!mCALayer) {
- return false;
- }
-
- mContentsScaleFactor = aContentsScaleFactor;
- mFrontSurface = MacIOSurface::CreateIOSurface(aWidth, aHeight, mContentsScaleFactor);
- if (!mFrontSurface) {
- mCARenderer = nullptr;
- return false;
- }
-
- if (!mCARenderer) {
- mCARenderer = new nsCARenderer();
- if (!mCARenderer) {
- mFrontSurface = nullptr;
- return false;
- }
-
- mCARenderer->AttachIOSurface(mFrontSurface);
-
- nsresult result = mCARenderer->SetupRenderer(mCALayer,
- mFrontSurface->GetWidth(),
- mFrontSurface->GetHeight(),
- mContentsScaleFactor,
- aAllowOfflineRenderer);
-
- if (result != NS_OK) {
- mCARenderer = nullptr;
- mFrontSurface = nullptr;
- return false;
- }
- } else {
- mCARenderer->AttachIOSurface(mFrontSurface);
- }
-
- return true;
-}
-
-void nsDoubleBufferCARenderer::Render() {
- if (!HasFrontSurface() || !mCARenderer) {
- return;
- }
-
- mCARenderer->Render(GetFrontSurfaceWidth(), GetFrontSurfaceHeight(),
- mContentsScaleFactor, nullptr);
-}
-
-void nsDoubleBufferCARenderer::SwapSurfaces() {
- RefPtr<MacIOSurface> prevFrontSurface = mFrontSurface;
- mFrontSurface = mBackSurface;
- mBackSurface = prevFrontSurface;
-
- if (mFrontSurface) {
- mCARenderer->AttachIOSurface(mFrontSurface);
- }
-}
-
-void nsDoubleBufferCARenderer::ClearFrontSurface() {
- mFrontSurface = nullptr;
- if (!mFrontSurface && !mBackSurface) {
- mCARenderer = nullptr;
- }
-}
-
-void nsDoubleBufferCARenderer::ClearBackSurface() {
- mBackSurface = nullptr;
- if (!mFrontSurface && !mBackSurface) {
- mCARenderer = nullptr;
- }
-}
-
-} // namespace PluginUtilsOSX
-} // namespace plugins
-} // namespace mozilla
-
diff --git a/dom/plugins/ipc/interpose/moz.build b/dom/plugins/ipc/interpose/moz.build
deleted file mode 100644
index 319c325a70..0000000000
--- a/dom/plugins/ipc/interpose/moz.build
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-SharedLibrary('plugin_child_interpose')
-
-SOURCES += [ "%s.mm" % (LIBRARY_NAME) ]
-
-OS_LIBS += ['-framework Carbon']
-
-DIST_INSTALL = True
diff --git a/dom/plugins/ipc/interpose/plugin_child_interpose.mm b/dom/plugins/ipc/interpose/plugin_child_interpose.mm
deleted file mode 100644
index 58c39b0a1c..0000000000
--- a/dom/plugins/ipc/interpose/plugin_child_interpose.mm
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Use "dyld interposing" to hook methods imported from other libraries in the
-// plugin child process. The basic technique is described at
-// http://books.google.com/books?id=K8vUkpOXhN4C&pg=PA73&lpg=PA73&dq=__interpose&source=bl&ots=OJnnXZYpZC&sig=o7I3lXvoduUi13SrPfOON7o3do4&hl=en&ei=AoehS9brCYGQNrvsmeUM&sa=X&oi=book_result&ct=result&resnum=6&ved=0CBsQ6AEwBQ#v=onepage&q=__interpose&f=false.
-// The idea of doing it for the plugin child process comes from Chromium code,
-// particularly from plugin_carbon_interpose_mac.cc
-// (http://codesearch.google.com/codesearch/p?hl=en#OAMlx_jo-ck/src/chrome/browser/plugin_carbon_interpose_mac.cc&q=nscursor&exact_package=chromium&d=1&l=168)
-// and from PluginProcessHost::Init() in plugin_process_host.cc
-// (http://codesearch.google.com/codesearch/p?hl=en#OAMlx_jo-ck/src/content/browser/plugin_process_host.cc&q=nscursor&exact_package=chromium&d=1&l=222).
-
-// These hooks are needed to make certain OS calls work from the child process
-// (a background process) that would normally only work when called in the
-// parent process (the foreground process). They allow us to serialize
-// information from the child process to the parent process, so that the same
-// (or equivalent) calls can be made from the parent process.
-
-// This file lives in a seperate module (libplugin_child_interpose.dylib),
-// which will get loaded by the OS before any other modules when the plugin
-// child process is launched (from GeckoChildProcessHost::
-// PerformAsyncLaunchInternal()). For this reason it shouldn't link in other
-// browser modules when loaded. Instead it should use dlsym() to load
-// pointers to the methods it wants to call in other modules.
-
-#if !defined(__LP64__)
-
-#include <dlfcn.h>
-#import <Carbon/Carbon.h>
-
-// The header file QuickdrawAPI.h is missing on OS X 10.7 and up (though the
-// QuickDraw APIs defined in it are still present) -- so we need to supply the
-// relevant parts of its contents here. It's likely that Apple will eventually
-// remove the APIs themselves (probably in OS X 10.8), so we need to make them
-// weak imports, and test for their presence before using them.
-#if !defined(__QUICKDRAWAPI__)
-
-struct Cursor;
-extern "C" void SetCursor(const Cursor * crsr) __attribute__((weak_import));
-
-#endif /* __QUICKDRAWAPI__ */
-
-BOOL (*OnSetThemeCursorPtr) (ThemeCursor) = NULL;
-BOOL (*OnSetCursorPtr) (const Cursor*) = NULL;
-BOOL (*OnHideCursorPtr) () = NULL;
-BOOL (*OnShowCursorPtr) () = NULL;
-
-static BOOL loadXULPtrs()
-{
- if (!OnSetThemeCursorPtr) {
- // mac_plugin_interposing_child_OnSetThemeCursor(ThemeCursor cursor) is in
- // PluginInterposeOSX.mm
- OnSetThemeCursorPtr = (BOOL(*)(ThemeCursor))
- dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnSetThemeCursor");
- }
- if (!OnSetCursorPtr) {
- // mac_plugin_interposing_child_OnSetCursor(const Cursor* cursor) is in
- // PluginInterposeOSX.mm
- OnSetCursorPtr = (BOOL(*)(const Cursor*))
- dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnSetCursor");
- }
- if (!OnHideCursorPtr) {
- // mac_plugin_interposing_child_OnHideCursor() is in PluginInterposeOSX.mm
- OnHideCursorPtr = (BOOL(*)())
- dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnHideCursor");
- }
- if (!OnShowCursorPtr) {
- // mac_plugin_interposing_child_OnShowCursor() is in PluginInterposeOSX.mm
- OnShowCursorPtr = (BOOL(*)())
- dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnShowCursor");
- }
- return (OnSetCursorPtr && OnSetThemeCursorPtr && OnHideCursorPtr && OnShowCursorPtr);
-}
-
-static OSStatus MacPluginChildSetThemeCursor(ThemeCursor cursor)
-{
- if (loadXULPtrs()) {
- OnSetThemeCursorPtr(cursor);
- }
- return ::SetThemeCursor(cursor);
-}
-
-static void MacPluginChildSetCursor(const Cursor* cursor)
-{
- if (::SetCursor) {
- if (loadXULPtrs()) {
- OnSetCursorPtr(cursor);
- }
- ::SetCursor(cursor);
- }
-}
-
-static CGError MacPluginChildCGDisplayHideCursor(CGDirectDisplayID display)
-{
- if (loadXULPtrs()) {
- OnHideCursorPtr();
- }
- return ::CGDisplayHideCursor(display);
-}
-
-static CGError MacPluginChildCGDisplayShowCursor(CGDirectDisplayID display)
-{
- if (loadXULPtrs()) {
- OnShowCursorPtr();
- }
- return ::CGDisplayShowCursor(display);
-}
-
-#pragma mark -
-
-struct interpose_substitution {
- const void* replacement;
- const void* original;
-};
-
-#define INTERPOSE_FUNCTION(function) \
- { reinterpret_cast<const void*>(MacPluginChild##function), \
- reinterpret_cast<const void*>(function) }
-
-__attribute__((used)) static const interpose_substitution substitutions[]
- __attribute__((section("__DATA, __interpose"))) = {
- INTERPOSE_FUNCTION(SetThemeCursor),
- INTERPOSE_FUNCTION(CGDisplayHideCursor),
- INTERPOSE_FUNCTION(CGDisplayShowCursor),
- // SetCursor() and other QuickDraw APIs will probably be removed in OS X
- // 10.8. But this will make 'SetCursor' NULL, which will just stop the OS
- // from interposing it (tested using an INTERPOSE_FUNCTION_BROKEN macro
- // that just sets the second address of each tuple to NULL).
- INTERPOSE_FUNCTION(SetCursor),
-};
-
-#endif // !__LP64__
diff --git a/dom/plugins/ipc/moz.build b/dom/plugins/ipc/moz.build
index 9190d19272..00f9a47128 100644
--- a/dom/plugins/ipc/moz.build
+++ b/dom/plugins/ipc/moz.build
@@ -3,9 +3,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
- DIRS += ['interpose']
-
EXPORTS.mozilla += [
'PluginLibrary.h',
]
@@ -16,7 +13,6 @@ EXPORTS.mozilla.plugins += [
'BrowserStreamParent.h',
'ChildAsyncCall.h',
'ChildTimer.h',
- 'NPEventOSX.h',
'NPEventUnix.h',
'NPEventWindows.h',
'PluginAsyncSurrogate.h',
@@ -36,7 +32,6 @@ EXPORTS.mozilla.plugins += [
'PluginScriptableObjectUtils.h',
'PluginStreamChild.h',
'PluginStreamParent.h',
- 'PluginUtilsOSX.h',
'PluginWidgetChild.h',
'PluginWidgetParent.h',
'StreamNotifyChild.h',
@@ -58,11 +53,6 @@ if CONFIG['OS_ARCH'] == 'WINNT':
'hangui',
]
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
- EXPORTS.mozilla.plugins += [
- 'PluginInterposeOSX.h',
- ]
-
SOURCES += [
'BrowserStreamChild.cpp',
'BrowserStreamParent.cpp',
@@ -86,12 +76,6 @@ SOURCES += [
'PluginWidgetParent.cpp',
]
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
- SOURCES += [
- 'PluginInterposeOSX.mm',
- 'PluginUtilsOSX.mm',
- ]
-
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
SOURCES += [
'D3D11SurfaceHolder.cpp',