Bug 651192 - Part 2: Update interface and stub implementors which don't have support. r=roc

This commit is contained in:
Bas Schouten 2012-02-16 04:08:41 +01:00
parent 542de64292
commit f9c0967db9
8 changed files with 105 additions and 1 deletions

View File

@ -467,6 +467,13 @@ public:
NPBool ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
double *destX, double *destY, NPCoordinateSpace destSpace);
void SendIdleEvent();
NPError InitAsyncSurface(NPSize *size, NPImageFormat format,
void *initData, NPAsyncSurface *surface)
{ return NPERR_GENERIC_ERROR; }
NPError FinalizeAsyncSurface(NPAsyncSurface *surface) { return NPERR_GENERIC_ERROR; }
void SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed) { return; }
NS_DECL_CYCLE_COLLECTION_CLASS(nsDummyJavaPluginOwner)

View File

@ -130,6 +130,10 @@ interface nsIPluginInstanceOwner : nsISupports
virtual NPError ShowNativeContextMenu(NPMenu* menu, void* event) = 0;
virtual NPBool ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
double *destX, double *destY, NPCoordinateSpace destSpace) = 0;
virtual NPError InitAsyncSurface(NPSize *size, NPImageFormat format,
void *initData, NPAsyncSurface *surface) = 0;
virtual NPError FinalizeAsyncSurface(NPAsyncSurface *surface) = 0;
virtual void SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed) = 0;
%}
void setEventModel(in PRInt32 eventModel);

View File

@ -200,7 +200,10 @@ static NPNetscapeFuncs sBrowserFuncs = {
_convertpoint,
NULL, // handleevent, unimplemented
NULL, // unfocusinstance, unimplemented
_urlredirectresponse
_urlredirectresponse,
_initasyncsurface,
_finalizeasyncsurface,
_setcurrentasyncsurface
};
static Mutex *sPluginThreadAsyncCallLock = nsnull;
@ -2883,6 +2886,36 @@ _popupcontextmenu(NPP instance, NPMenu* menu)
return inst->PopUpContextMenu(menu);
}
NPError NP_CALLBACK
_initasyncsurface(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface)
{
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
if (!inst)
return NPERR_GENERIC_ERROR;
return inst->InitAsyncSurface(size, format, initData, surface);
}
NPError NP_CALLBACK
_finalizeasyncsurface(NPP instance, NPAsyncSurface *surface)
{
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
if (!inst)
return NPERR_GENERIC_ERROR;
return inst->FinalizeAsyncSurface(surface);
}
void NP_CALLBACK
_setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed)
{
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
if (!inst)
return;
inst->SetCurrentAsyncSurface(surface, changed);
}
NPBool NP_CALLBACK
_convertpoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace)
{

View File

@ -297,6 +297,15 @@ _unscheduletimer(NPP instance, uint32_t timerID);
NPError NP_CALLBACK
_popupcontextmenu(NPP instance, NPMenu* menu);
NPError NP_CALLBACK
_initasyncsurface(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface);
NPError NP_CALLBACK
_finalizeasyncsurface(NPP instance, NPAsyncSurface *surface);
void NP_CALLBACK
_setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed);
NPBool NP_CALLBACK
_convertpoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);

View File

@ -1482,6 +1482,32 @@ nsNPAPIPluginInstance::URLRedirectResponse(void* notifyData, NPBool allow)
}
}
NPError
nsNPAPIPluginInstance::InitAsyncSurface(NPSize *size, NPImageFormat format,
void *initData, NPAsyncSurface *surface)
{
if (mOwner)
return mOwner->InitAsyncSurface(size, format, initData, surface);
return NS_ERROR_FAILURE;
}
NPError
nsNPAPIPluginInstance::FinalizeAsyncSurface(NPAsyncSurface *surface)
{
if (mOwner)
return mOwner->FinalizeAsyncSurface(surface);
return NS_ERROR_FAILURE;
}
void
nsNPAPIPluginInstance::SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed)
{
if (mOwner)
mOwner->SetCurrentAsyncSurface(surface, changed);
}
class CarbonEventModelFailureEvent : public nsRunnable {
public:
nsCOMPtr<nsIContent> mContent;

View File

@ -214,6 +214,11 @@ public:
void URLRedirectResponse(void* notifyData, NPBool allow);
NPError InitAsyncSurface(NPSize *size, NPImageFormat format,
void *initData, NPAsyncSurface *surface);
NPError FinalizeAsyncSurface(NPAsyncSurface *surface);
void SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed);
// Called when the instance fails to instantiate beceause the Carbon
// event model is not supported.
void CarbonNPAPIFailure();

View File

@ -791,6 +791,21 @@ NPBool nsPluginInstanceOwner::ConvertPoint(double sourceX, double sourceY, NPCoo
#endif
}
NPError nsPluginInstanceOwner::InitAsyncSurface(NPSize *size, NPImageFormat format,
void *initData, NPAsyncSurface *surface)
{
return NPERR_GENERIC_ERROR;
}
NPError nsPluginInstanceOwner::FinalizeAsyncSurface(NPAsyncSurface *)
{
return NPERR_GENERIC_ERROR;
}
void nsPluginInstanceOwner::SetCurrentAsyncSurface(NPAsyncSurface *, NPRect*)
{
}
NS_IMETHODIMP nsPluginInstanceOwner::GetTagType(nsPluginTagType *result)
{
NS_ENSURE_ARG_POINTER(result);

View File

@ -128,6 +128,11 @@ public:
NPBool ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
double *destX, double *destY, NPCoordinateSpace destSpace);
virtual NPError InitAsyncSurface(NPSize *size, NPImageFormat format,
void *initData, NPAsyncSurface *surface);
virtual NPError FinalizeAsyncSurface(NPAsyncSurface *surface);
virtual void SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed);
//nsIPluginTagInfo interface
NS_DECL_NSIPLUGINTAGINFO