2009-06-30 22:51:05 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
* vim: sw=4 ts=4 et :
|
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Plugin App.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Chris Jones <jones.chris.g@gmail.com>
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2009
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
2009-09-09 10:31:35 +04:00
|
|
|
#ifndef dom_plugins_PluginInstanceParent_h
|
|
|
|
#define dom_plugins_PluginInstanceParent_h 1
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2009-09-10 02:59:06 +04:00
|
|
|
#include "mozilla/plugins/PPluginInstanceParent.h"
|
2009-09-09 10:31:35 +04:00
|
|
|
#include "mozilla/plugins/PluginScriptableObjectParent.h"
|
2009-12-02 00:05:26 +03:00
|
|
|
#if defined(OS_WIN)
|
|
|
|
#include "mozilla/gfx/SharedDIBWin.h"
|
2010-04-20 18:52:19 +04:00
|
|
|
#elif defined(OS_MACOSX)
|
|
|
|
#include "nsCoreAnimationSupport.h"
|
2009-12-02 00:05:26 +03:00
|
|
|
#endif
|
2009-06-30 22:51:05 +04:00
|
|
|
|
|
|
|
#include "npfunctions.h"
|
2009-09-23 11:12:52 +04:00
|
|
|
#include "nsAutoPtr.h"
|
2010-01-15 23:35:57 +03:00
|
|
|
#include "nsDataHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
2009-12-02 00:05:26 +03:00
|
|
|
#include "nsRect.h"
|
2010-09-15 20:02:49 +04:00
|
|
|
#include "gfxASurface.h"
|
|
|
|
#ifdef MOZ_X11
|
|
|
|
class gfxXlibSurface;
|
|
|
|
#endif
|
2009-06-30 22:51:05 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace plugins {
|
|
|
|
|
2009-09-10 02:59:06 +04:00
|
|
|
class PBrowserStreamParent;
|
2009-09-23 11:48:28 +04:00
|
|
|
class PluginModuleParent;
|
2009-08-19 00:20:03 +04:00
|
|
|
|
2009-09-10 02:59:06 +04:00
|
|
|
class PluginInstanceParent : public PPluginInstanceParent
|
2009-06-30 22:51:05 +04:00
|
|
|
{
|
2009-09-09 10:31:35 +04:00
|
|
|
friend class PluginModuleParent;
|
2009-09-09 18:04:09 +04:00
|
|
|
friend class BrowserStreamParent;
|
2009-09-21 18:51:35 +04:00
|
|
|
friend class PluginStreamParent;
|
2011-01-05 22:44:21 +03:00
|
|
|
friend class StreamNotifyParent;
|
2009-08-19 00:20:03 +04:00
|
|
|
|
2009-06-30 22:51:05 +04:00
|
|
|
public:
|
2009-09-23 11:12:52 +04:00
|
|
|
PluginInstanceParent(PluginModuleParent* parent,
|
|
|
|
NPP npp,
|
2010-04-20 18:52:19 +04:00
|
|
|
const nsCString& mimeType,
|
2009-09-23 11:12:52 +04:00
|
|
|
const NPNetscapeFuncs* npniface);
|
|
|
|
|
|
|
|
virtual ~PluginInstanceParent();
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2010-01-15 23:35:57 +03:00
|
|
|
bool Init();
|
|
|
|
NPError Destroy();
|
2009-10-08 03:50:48 +04:00
|
|
|
|
2010-01-28 03:01:44 +03:00
|
|
|
NS_OVERRIDE virtual void ActorDestroy(ActorDestroyReason why);
|
|
|
|
|
2009-09-10 02:59:06 +04:00
|
|
|
virtual PPluginScriptableObjectParent*
|
2009-09-22 21:31:11 +04:00
|
|
|
AllocPPluginScriptableObject();
|
2009-08-11 03:28:22 +04:00
|
|
|
|
2010-03-05 00:20:14 +03:00
|
|
|
NS_OVERRIDE virtual bool
|
|
|
|
RecvPPluginScriptableObjectConstructor(PPluginScriptableObjectParent* aActor);
|
2009-09-09 10:31:35 +04:00
|
|
|
|
2009-09-23 11:12:52 +04:00
|
|
|
virtual bool
|
|
|
|
DeallocPPluginScriptableObject(PPluginScriptableObjectParent* aObject);
|
2009-09-10 02:59:06 +04:00
|
|
|
virtual PBrowserStreamParent*
|
2009-09-22 21:31:11 +04:00
|
|
|
AllocPBrowserStream(const nsCString& url,
|
|
|
|
const uint32_t& length,
|
|
|
|
const uint32_t& lastmodified,
|
2009-10-17 03:31:53 +04:00
|
|
|
PStreamNotifyParent* notifyData,
|
2009-09-22 21:31:11 +04:00
|
|
|
const nsCString& headers,
|
|
|
|
const nsCString& mimeType,
|
|
|
|
const bool& seekable,
|
|
|
|
NPError* rv,
|
|
|
|
uint16_t *stype);
|
2009-09-18 03:09:20 +04:00
|
|
|
virtual bool
|
2009-12-03 11:16:14 +03:00
|
|
|
DeallocPBrowserStream(PBrowserStreamParent* stream);
|
2009-08-19 00:20:03 +04:00
|
|
|
|
2009-09-21 18:51:35 +04:00
|
|
|
virtual PPluginStreamParent*
|
2009-09-22 21:31:11 +04:00
|
|
|
AllocPPluginStream(const nsCString& mimeType,
|
|
|
|
const nsCString& target,
|
|
|
|
NPError* result);
|
2009-09-21 18:51:35 +04:00
|
|
|
virtual bool
|
2009-12-03 11:16:14 +03:00
|
|
|
DeallocPPluginStream(PPluginStreamParent* stream);
|
2009-09-21 18:51:35 +04:00
|
|
|
|
2009-09-18 03:09:20 +04:00
|
|
|
virtual bool
|
2009-09-16 00:33:24 +04:00
|
|
|
AnswerNPN_GetValue_NPNVjavascriptEnabledBool(bool* value, NPError* result);
|
2009-09-18 03:09:20 +04:00
|
|
|
virtual bool
|
2009-09-16 00:33:24 +04:00
|
|
|
AnswerNPN_GetValue_NPNVisOfflineBool(bool* value, NPError* result);
|
2009-09-18 03:09:20 +04:00
|
|
|
virtual bool
|
2010-01-14 18:18:34 +03:00
|
|
|
AnswerNPN_GetValue_NPNVnetscapeWindow(NativeWindowHandle* value,
|
|
|
|
NPError* result);
|
2010-01-14 04:47:38 +03:00
|
|
|
virtual bool
|
2009-09-16 00:33:24 +04:00
|
|
|
AnswerNPN_GetValue_NPNVWindowNPObject(
|
|
|
|
PPluginScriptableObjectParent** value,
|
|
|
|
NPError* result);
|
2009-09-18 03:09:20 +04:00
|
|
|
virtual bool
|
2009-09-16 00:33:24 +04:00
|
|
|
AnswerNPN_GetValue_NPNVPluginElementNPObject(
|
|
|
|
PPluginScriptableObjectParent** value,
|
|
|
|
NPError* result);
|
2009-09-18 03:09:20 +04:00
|
|
|
virtual bool
|
2009-09-16 00:33:24 +04:00
|
|
|
AnswerNPN_GetValue_NPNVprivateModeBool(bool* value, NPError* result);
|
|
|
|
|
2009-09-25 06:03:59 +04:00
|
|
|
virtual bool
|
|
|
|
AnswerNPN_SetValue_NPPVpluginWindow(const bool& windowed, NPError* result);
|
|
|
|
virtual bool
|
|
|
|
AnswerNPN_SetValue_NPPVpluginTransparent(const bool& transparent,
|
|
|
|
NPError* result);
|
2010-03-26 23:07:37 +03:00
|
|
|
virtual bool
|
|
|
|
AnswerNPN_SetValue_NPPVpluginDrawingModel(const int& drawingModel,
|
|
|
|
NPError* result);
|
|
|
|
virtual bool
|
|
|
|
AnswerNPN_SetValue_NPPVpluginEventModel(const int& eventModel,
|
|
|
|
NPError* result);
|
2009-09-25 06:03:59 +04:00
|
|
|
|
2009-09-18 03:09:20 +04:00
|
|
|
virtual bool
|
2009-09-09 01:22:50 +04:00
|
|
|
AnswerNPN_GetURL(const nsCString& url, const nsCString& target,
|
|
|
|
NPError *result);
|
|
|
|
|
2009-09-18 03:09:20 +04:00
|
|
|
virtual bool
|
2009-09-09 01:22:50 +04:00
|
|
|
AnswerNPN_PostURL(const nsCString& url, const nsCString& target,
|
|
|
|
const nsCString& buffer, const bool& file,
|
|
|
|
NPError* result);
|
|
|
|
|
|
|
|
virtual PStreamNotifyParent*
|
2009-09-22 21:31:11 +04:00
|
|
|
AllocPStreamNotify(const nsCString& url, const nsCString& target,
|
|
|
|
const bool& post, const nsCString& buffer,
|
|
|
|
const bool& file,
|
|
|
|
NPError* result);
|
2009-09-09 01:22:50 +04:00
|
|
|
|
2009-11-25 17:26:01 +03:00
|
|
|
NS_OVERRIDE virtual bool
|
|
|
|
AnswerPStreamNotifyConstructor(PStreamNotifyParent* actor,
|
|
|
|
const nsCString& url,
|
|
|
|
const nsCString& target,
|
|
|
|
const bool& post, const nsCString& buffer,
|
|
|
|
const bool& file,
|
|
|
|
NPError* result);
|
|
|
|
|
2009-09-18 03:09:20 +04:00
|
|
|
virtual bool
|
2009-12-03 11:16:14 +03:00
|
|
|
DeallocPStreamNotify(PStreamNotifyParent* notifyData);
|
2009-09-09 01:22:50 +04:00
|
|
|
|
2009-10-01 08:09:21 +04:00
|
|
|
virtual bool
|
|
|
|
RecvNPN_InvalidateRect(const NPRect& rect);
|
|
|
|
|
2010-09-15 20:02:44 +04:00
|
|
|
// Async rendering
|
|
|
|
virtual bool
|
|
|
|
RecvShow(const NPRect& updatedRect,
|
|
|
|
const SurfaceDescriptor& newSurface,
|
|
|
|
SurfaceDescriptor* prevSurface);
|
|
|
|
|
2009-10-13 21:54:41 +04:00
|
|
|
virtual bool
|
2010-03-26 02:45:33 +03:00
|
|
|
AnswerNPN_PushPopupsEnabledState(const bool& aState);
|
2009-10-13 21:54:41 +04:00
|
|
|
|
|
|
|
virtual bool
|
2010-03-26 02:45:33 +03:00
|
|
|
AnswerNPN_PopPopupsEnabledState();
|
2009-10-13 21:54:41 +04:00
|
|
|
|
2010-01-15 19:26:46 +03:00
|
|
|
NS_OVERRIDE virtual bool
|
|
|
|
AnswerNPN_GetValueForURL(const NPNURLVariable& variable,
|
|
|
|
const nsCString& url,
|
|
|
|
nsCString* value, NPError* result);
|
|
|
|
|
|
|
|
NS_OVERRIDE virtual bool
|
|
|
|
AnswerNPN_SetValueForURL(const NPNURLVariable& variable,
|
|
|
|
const nsCString& url,
|
|
|
|
const nsCString& value, NPError* result);
|
|
|
|
|
|
|
|
NS_OVERRIDE virtual bool
|
|
|
|
AnswerNPN_GetAuthenticationInfo(const nsCString& protocol,
|
|
|
|
const nsCString& host,
|
|
|
|
const int32_t& port,
|
|
|
|
const nsCString& scheme,
|
|
|
|
const nsCString& realm,
|
|
|
|
nsCString* username,
|
|
|
|
nsCString* password,
|
|
|
|
NPError* result);
|
|
|
|
|
2010-03-26 23:55:56 +03:00
|
|
|
NS_OVERRIDE virtual bool
|
|
|
|
AnswerNPN_ConvertPoint(const double& sourceX,
|
2010-05-20 23:22:54 +04:00
|
|
|
const bool& ignoreDestX,
|
2010-03-26 23:55:56 +03:00
|
|
|
const double& sourceY,
|
2010-05-20 23:22:54 +04:00
|
|
|
const bool& ignoreDestY,
|
2010-03-26 23:55:56 +03:00
|
|
|
const NPCoordinateSpace& sourceSpace,
|
|
|
|
const NPCoordinateSpace& destSpace,
|
|
|
|
double *destX,
|
|
|
|
double *destY,
|
|
|
|
bool *result);
|
|
|
|
|
2009-10-01 01:36:14 +04:00
|
|
|
NPError NPP_SetWindow(const NPWindow* aWindow);
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2010-01-20 06:23:35 +03:00
|
|
|
NPError NPP_GetValue(NPPVariable variable, void* retval);
|
|
|
|
NPError NPP_SetValue(NPNVariable variable, void* value);
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2011-01-05 22:44:21 +03:00
|
|
|
void NPP_URLRedirectNotify(const char* url, int32_t status,
|
|
|
|
void* notifyData);
|
|
|
|
|
2009-06-30 22:51:05 +04:00
|
|
|
NPError NPP_NewStream(NPMIMEType type, NPStream* stream,
|
2009-08-19 00:20:03 +04:00
|
|
|
NPBool seekable, uint16_t* stype);
|
|
|
|
NPError NPP_DestroyStream(NPStream* stream, NPReason reason);
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2010-01-20 06:23:35 +03:00
|
|
|
void NPP_Print(NPPrint* platformPrint);
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2009-09-19 05:19:11 +04:00
|
|
|
int16_t NPP_HandleEvent(void* event);
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2009-09-23 01:06:00 +04:00
|
|
|
void NPP_URLNotify(const char* url, NPReason reason, void* notifyData);
|
2009-06-30 22:51:05 +04:00
|
|
|
|
2009-10-27 22:51:12 +03:00
|
|
|
PluginModuleParent* Module()
|
2009-09-23 11:12:52 +04:00
|
|
|
{
|
|
|
|
return mParent;
|
|
|
|
}
|
|
|
|
|
2009-10-08 03:50:48 +04:00
|
|
|
const NPNetscapeFuncs* GetNPNIface()
|
|
|
|
{
|
|
|
|
return mNPNIface;
|
|
|
|
}
|
|
|
|
|
2010-01-15 23:35:57 +03:00
|
|
|
bool
|
|
|
|
RegisterNPObjectForActor(NPObject* aObject,
|
|
|
|
PluginScriptableObjectParent* aActor);
|
|
|
|
|
|
|
|
void
|
|
|
|
UnregisterNPObject(NPObject* aObject);
|
|
|
|
|
2009-10-08 03:50:48 +04:00
|
|
|
PluginScriptableObjectParent*
|
|
|
|
GetActorForNPObject(NPObject* aObject);
|
|
|
|
|
|
|
|
NPP
|
|
|
|
GetNPP()
|
|
|
|
{
|
|
|
|
return mNPP;
|
|
|
|
}
|
|
|
|
|
2010-01-27 00:40:15 +03:00
|
|
|
virtual bool
|
2010-06-23 21:08:56 +04:00
|
|
|
AnswerPluginFocusChange(const bool& gotFocus);
|
2010-01-27 00:40:15 +03:00
|
|
|
|
2010-04-20 18:52:19 +04:00
|
|
|
#if defined(OS_MACOSX)
|
|
|
|
void Invalidate();
|
|
|
|
#endif // definied(OS_MACOSX)
|
|
|
|
|
2010-09-10 22:28:52 +04:00
|
|
|
nsresult AsyncSetWindow(NPWindow* window);
|
|
|
|
nsresult GetSurface(gfxASurface** aSurface);
|
|
|
|
|
2009-10-08 03:50:48 +04:00
|
|
|
private:
|
2010-04-20 18:52:19 +04:00
|
|
|
// Quirks mode support for various plugin mime types
|
|
|
|
enum PluginQuirks {
|
|
|
|
// OSX: Don't use the refresh timer for plug-ins
|
|
|
|
// using this quirk. These plug-in most have another
|
|
|
|
// way to refresh the window.
|
|
|
|
COREANIMATION_REFRESH_TIMER = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
void InitQuirksModes(const nsCString& aMimeType);
|
|
|
|
|
2009-10-08 03:50:48 +04:00
|
|
|
bool InternalGetValueForNPObject(NPNVariable aVariable,
|
|
|
|
PPluginScriptableObjectParent** aValue,
|
|
|
|
NPError* aResult);
|
|
|
|
|
2009-06-30 22:51:05 +04:00
|
|
|
private:
|
2009-09-23 11:12:52 +04:00
|
|
|
PluginModuleParent* mParent;
|
2009-08-19 00:20:03 +04:00
|
|
|
NPP mNPP;
|
2009-06-30 22:51:05 +04:00
|
|
|
const NPNetscapeFuncs* mNPNIface;
|
2009-12-02 00:05:26 +03:00
|
|
|
NPWindowType mWindowType;
|
2010-04-20 18:52:19 +04:00
|
|
|
int mQuirks;
|
2009-09-23 11:12:52 +04:00
|
|
|
|
2010-01-15 23:35:57 +03:00
|
|
|
nsDataHashtable<nsVoidPtrHashKey, PluginScriptableObjectParent*> mScriptableObjects;
|
2009-12-02 00:05:26 +03:00
|
|
|
|
|
|
|
#if defined(OS_WIN)
|
|
|
|
private:
|
|
|
|
// Used in rendering windowless plugins in other processes.
|
|
|
|
bool SharedSurfaceSetWindow(const NPWindow* aWindow, NPRemoteWindow& aRemoteWindow);
|
2009-12-15 03:27:25 +03:00
|
|
|
void SharedSurfaceBeforePaint(RECT &rect, NPRemoteEvent& npremoteevent);
|
2009-12-02 00:05:26 +03:00
|
|
|
void SharedSurfaceAfterPaint(NPEvent* npevent);
|
|
|
|
void SharedSurfaceRelease();
|
2010-01-27 00:40:15 +03:00
|
|
|
// Used in handling parent/child forwarding of events.
|
|
|
|
static LRESULT CALLBACK PluginWindowHookProc(HWND hWnd, UINT message,
|
|
|
|
WPARAM wParam, LPARAM lParam);
|
|
|
|
void SubclassPluginWindow(HWND aWnd);
|
|
|
|
void UnsubclassPluginWindow();
|
2009-12-02 00:05:26 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
gfx::SharedDIBWin mSharedSurfaceDib;
|
|
|
|
nsIntRect mPluginPort;
|
|
|
|
nsIntRect mSharedSize;
|
2010-01-27 00:40:15 +03:00
|
|
|
HWND mPluginHWND;
|
|
|
|
WNDPROC mPluginWndProc;
|
2010-02-10 01:34:38 +03:00
|
|
|
bool mNestedEventState;
|
2009-12-02 00:05:26 +03:00
|
|
|
#endif // defined(XP_WIN)
|
2010-03-26 23:07:37 +03:00
|
|
|
#if defined(OS_MACOSX)
|
|
|
|
private:
|
2010-04-20 18:52:19 +04:00
|
|
|
Shmem mShSurface;
|
|
|
|
size_t mShWidth;
|
|
|
|
size_t mShHeight;
|
|
|
|
CGColorSpaceRef mShColorSpace;
|
|
|
|
int16_t mDrawingModel;
|
|
|
|
nsIOSurface *mIOSurface;
|
2010-03-26 23:07:37 +03:00
|
|
|
#endif // definied(OS_MACOSX)
|
2010-09-15 20:02:49 +04:00
|
|
|
|
|
|
|
// ObjectFrame layer wrapper
|
|
|
|
nsRefPtr<gfxASurface> mFrontSurface;
|
2009-06-30 22:51:05 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace plugins
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2009-09-09 10:31:35 +04:00
|
|
|
#endif // ifndef dom_plugins_PluginInstanceParent_h
|