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 Communicator client code, released
19 * The Initial Developer of the Original Code is
20 * Netscape Communications Corporation.
21 * Portions created by the Initial Developer are Copyright (C) 1998
22 * the Initial Developer. All Rights Reserved.
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 * This file is part of the Java-vendor-neutral implementation of LiveConnect
42 * It contains the public XP-COM based interface for java to javascript communication.
46 #ifndef nsILiveconnect_h___
47 #define nsILiveconnect_h___
49 #include "nsISupports.h"
50 #include "nsIFactory.h"
52 #include "jsjava.h" // For lcjsobject
54 #define NS_ILIVECONNECT_IID \
55 { /* 68190910-3318-11d2-97f0-00805f8a28d0 */ \
59 {0x97, 0xf0, 0x00, 0x80, 0x5f, 0x8a, 0x28, 0xd0} \
62 #define NS_CLIVECONNECT_CID \
63 { /* b8f0cef0-3931-11d2-97f0-00805f8a28d0 */ \
67 {0x97, 0xf0, 0x00, 0x80, 0x5f, 0x8a, 0x28, 0xd0} \
70 class nsILiveconnect
: public nsISupports
{
72 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILIVECONNECT_IID
)
73 NS_DEFINE_STATIC_CID_ACCESSOR(NS_CLIVECONNECT_CID
)
76 * get member of a Native JSObject for a given name.
78 * @param obj - A Native JS Object.
79 * @param name - Name of a member.
80 * @param pjobj - return parameter as a java object representing
81 * the member. If it is a basic data type it is converted to
82 * a corresponding java type. If it is a NJSObject, then it is
83 * wrapped up as java wrapper netscape.javascript.JSObject.
86 GetMember(JNIEnv
*jEnv
, lcjsobject jsobj
, const jchar
*name
, jsize length
, void* principalsArray
[],
87 int numPrincipals
, nsISupports
*securitySupports
, jobject
*pjobj
) = 0;
90 * get member of a Native JSObject for a given index.
92 * @param obj - A Native JS Object.
93 * @param slot - Index of a member.
94 * @param pjobj - return parameter as a java object representing
98 GetSlot(JNIEnv
*jEnv
, lcjsobject jsobj
, jint slot
, void* principalsArray
[],
99 int numPrincipals
, nsISupports
*securitySupports
, jobject
*pjobj
) = 0;
102 * set member of a Native JSObject for a given name.
104 * @param obj - A Native JS Object.
105 * @param name - Name of a member.
106 * @param jobj - Value to set. If this is a basic data type, it is converted
107 * using standard JNI calls but if it is a wrapper to a JSObject
108 * then a internal mapping is consulted to convert to a NJSObject.
111 SetMember(JNIEnv
*jEnv
, lcjsobject jsobj
, const jchar
* name
, jsize length
, jobject jobj
, void* principalsArray
[],
112 int numPrincipals
, nsISupports
*securitySupports
) = 0;
115 * set member of a Native JSObject for a given index.
117 * @param obj - A Native JS Object.
118 * @param index - Index of a member.
119 * @param jobj - Value to set. If this is a basic data type, it is converted
120 * using standard JNI calls but if it is a wrapper to a JSObject
121 * then a internal mapping is consulted to convert to a NJSObject.
124 SetSlot(JNIEnv
*jEnv
, lcjsobject jsobj
, jint slot
, jobject jobj
, void* principalsArray
[],
125 int numPrincipals
, nsISupports
*securitySupports
) = 0;
128 * remove member of a Native JSObject for a given name.
130 * @param obj - A Native JS Object.
131 * @param name - Name of a member.
134 RemoveMember(JNIEnv
*jEnv
, lcjsobject jsobj
, const jchar
* name
, jsize length
, void* principalsArray
[],
135 int numPrincipals
, nsISupports
*securitySupports
) = 0;
138 * call a method of Native JSObject.
140 * @param obj - A Native JS Object.
141 * @param name - Name of a method.
142 * @param jobjArr - Array of jobjects representing parameters of method being caled.
143 * @param pjobj - return value.
146 Call(JNIEnv
*jEnv
, lcjsobject jsobj
, const jchar
* name
, jsize length
, jobjectArray jobjArr
, void* principalsArray
[],
147 int numPrincipals
, nsISupports
*securitySupports
, jobject
*pjobj
) = 0;
150 * Evaluate a script with a Native JS Object representing scope.
152 * @param obj - A Native JS Object.
153 * @param principalsArray - Array of principals to be used to compare privileges.
154 * @param numPrincipals - Number of principals being passed.
155 * @param script - Script to be executed.
156 * @param pjobj - return value.
159 Eval(JNIEnv
*jEnv
, lcjsobject obj
, const jchar
*script
, jsize length
, void* principalsArray
[],
160 int numPrincipals
, nsISupports
*securitySupports
, jobject
*pjobj
) = 0;
163 * Get the window object for a plugin instance.
165 * @param pJavaObject - Either a jobject or a pointer to a plugin instance
166 * representing the java object.
167 * @param pjobj - return value. This is a native js object
168 * representing the window object of a frame
169 * in which a applet/bean resides.
172 GetWindow(JNIEnv
*jEnv
, void *pJavaObject
, void* principalsArray
[],
173 int numPrincipals
, nsISupports
*securitySupports
, lcjsobject
*pobj
) = 0;
176 * Get the window object for a plugin instance.
178 * @param jEnv - JNIEnv on which the call is being made.
179 * @param obj - A Native JS Object.
182 FinalizeJSObject(JNIEnv
*jEnv
, lcjsobject jsobj
) = 0;
185 * Get the window object for a plugin instance.
187 * @param jEnv - JNIEnv on which the call is being made.
188 * @param obj - A Native JS Object.
189 * @param jstring - Return value as a jstring representing a JS object.
192 ToString(JNIEnv
*jEnv
, lcjsobject obj
, jstring
*pjstring
) = 0;
195 NS_DEFINE_STATIC_IID_ACCESSOR(nsILiveconnect
, NS_ILIVECONNECT_IID
)
197 #endif // nsILiveconnect_h___