1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
16 * The Original Code is Mozilla Plugin App.
18 * The Initial Developer of the Original Code is
19 * Chris Jones <jones.chris.g@gmail.com>
20 * Portions created by the Initial Developer are Copyright (C) 2009
21 * the Initial Developer. All Rights Reserved.
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #ifndef dom_plugins_PluginInstanceParent_h
40 #define dom_plugins_PluginInstanceParent_h 1
42 #include "mozilla/plugins/PPluginInstanceParent.h"
43 #include "mozilla/plugins/PluginScriptableObjectParent.h"
45 #include "mozilla/gfx/SharedDIBWin.h"
48 #include "npfunctions.h"
49 #include "nsAutoPtr.h"
54 #define _MOZ_LOG(s) printf("[PluginInstanceParent] %s\n", s)
59 class PBrowserStreamParent
;
60 class BrowserStreamParent
;
61 class PluginModuleParent
;
63 class PluginInstanceParent
: public PPluginInstanceParent
65 friend class PluginModuleParent
;
66 friend class BrowserStreamParent
;
67 friend class PluginStreamParent
;
70 PluginInstanceParent(PluginModuleParent
* parent
,
72 const NPNetscapeFuncs
* npniface
);
74 virtual ~PluginInstanceParent();
78 virtual PPluginScriptableObjectParent
*
79 AllocPPluginScriptableObject();
82 AnswerPPluginScriptableObjectConstructor(PPluginScriptableObjectParent
* aActor
);
85 DeallocPPluginScriptableObject(PPluginScriptableObjectParent
* aObject
);
86 virtual PBrowserStreamParent
*
87 AllocPBrowserStream(const nsCString
& url
,
88 const uint32_t& length
,
89 const uint32_t& lastmodified
,
90 PStreamNotifyParent
* notifyData
,
91 const nsCString
& headers
,
92 const nsCString
& mimeType
,
98 AnswerPBrowserStreamDestructor(PBrowserStreamParent
* stream
,
99 const NPError
& reason
,
100 const bool& artificial
);
103 DeallocPBrowserStream(PBrowserStreamParent
* stream
,
104 const NPError
& reason
,
105 const bool& artificial
);
107 virtual PPluginStreamParent
*
108 AllocPPluginStream(const nsCString
& mimeType
,
109 const nsCString
& target
,
113 DeallocPPluginStream(PPluginStreamParent
* stream
,
114 const NPError
& reason
,
115 const bool& artificial
);
118 AnswerNPN_GetValue_NPNVjavascriptEnabledBool(bool* value
, NPError
* result
);
120 AnswerNPN_GetValue_NPNVisOfflineBool(bool* value
, NPError
* result
);
122 AnswerNPN_GetValue_NPNVWindowNPObject(
123 PPluginScriptableObjectParent
** value
,
126 AnswerNPN_GetValue_NPNVPluginElementNPObject(
127 PPluginScriptableObjectParent
** value
,
130 AnswerNPN_GetValue_NPNVprivateModeBool(bool* value
, NPError
* result
);
133 AnswerNPN_SetValue_NPPVpluginWindow(const bool& windowed
, NPError
* result
);
135 AnswerNPN_SetValue_NPPVpluginTransparent(const bool& transparent
,
139 AnswerNPN_GetURL(const nsCString
& url
, const nsCString
& target
,
143 AnswerNPN_PostURL(const nsCString
& url
, const nsCString
& target
,
144 const nsCString
& buffer
, const bool& file
,
147 virtual PStreamNotifyParent
*
148 AllocPStreamNotify(const nsCString
& url
, const nsCString
& target
,
149 const bool& post
, const nsCString
& buffer
,
153 NS_OVERRIDE
virtual bool
154 AnswerPStreamNotifyConstructor(PStreamNotifyParent
* actor
,
155 const nsCString
& url
,
156 const nsCString
& target
,
157 const bool& post
, const nsCString
& buffer
,
162 DeallocPStreamNotify(PStreamNotifyParent
* notifyData
,
163 const NPReason
& reason
);
166 RecvNPN_InvalidateRect(const NPRect
& rect
);
169 AnswerNPN_PushPopupsEnabledState(const bool& aState
,
173 AnswerNPN_PopPopupsEnabledState(bool* aSuccess
);
175 NPError
NPP_SetWindow(const NPWindow
* aWindow
);
177 NPError
NPP_GetValue(NPPVariable variable
, void *ret_value
);
178 NPError
NPP_SetValue(NPNVariable variable
, void *value
)
180 _MOZ_LOG(__FUNCTION__
);
184 NPError
NPP_NewStream(NPMIMEType type
, NPStream
* stream
,
185 NPBool seekable
, uint16_t* stype
);
186 NPError
NPP_DestroyStream(NPStream
* stream
, NPReason reason
);
188 void NPP_Print(NPPrint
* platformPrint
)
190 _MOZ_LOG(__FUNCTION__
);
193 int16_t NPP_HandleEvent(void* event
);
195 void NPP_URLNotify(const char* url
, NPReason reason
, void* notifyData
);
197 PluginModuleParent
* Module()
202 const NPNetscapeFuncs
* GetNPNIface()
207 PluginScriptableObjectParent
*
208 GetActorForNPObject(NPObject
* aObject
);
217 bool InternalGetValueForNPObject(NPNVariable aVariable
,
218 PPluginScriptableObjectParent
** aValue
,
222 PluginModuleParent
* mParent
;
224 const NPNetscapeFuncs
* mNPNIface
;
225 NPWindowType mWindowType
;
227 nsTArray
<nsAutoPtr
<PluginScriptableObjectParent
> > mScriptableObjects
;
231 // Used in rendering windowless plugins in other processes.
232 bool SharedSurfaceSetWindow(const NPWindow
* aWindow
, NPRemoteWindow
& aRemoteWindow
);
233 bool SharedSurfaceBeforePaint(RECT
&rect
, NPRemoteEvent
& npremoteevent
);
234 void SharedSurfaceAfterPaint(NPEvent
* npevent
);
235 void SharedSurfaceRelease();
238 gfx::SharedDIBWin mSharedSurfaceDib
;
239 nsIntRect mPluginPort
;
240 nsIntRect mSharedSize
;
241 PRUint32 mDoublePassEvent
;
242 bool mLocalCopyRender
;
243 #endif // defined(XP_WIN)
247 } // namespace plugins
248 } // namespace mozilla
250 #endif // ifndef dom_plugins_PluginInstanceParent_h