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 ***** */
41 * This file is part of the Java-vendor-neutral implementation of LiveConnect
43 * It contains the class definition to implement nsILiveconnect XP-COM interface.
48 #ifndef nsCLiveconnect_h___
49 #define nsCLiveconnect_h___
51 #include "nsILiveconnect.h"
56 * nsCLiveconnect implements nsILiveconnect interface for navigator.
57 * This is used by a JVM to implement netscape.javascript.JSObject functionality.
59 class nsCLiveconnect
:public nsILiveconnect
{
61 ////////////////////////////////////////////////////////////////////////////
62 // from nsISupports and AggregatedQueryInterface:
66 ////////////////////////////////////////////////////////////////////////////
67 // from nsILiveconnect:
70 * get member of a Native JSObject for a given name.
72 * @param obj - A Native JS Object.
73 * @param name - Name of a member.
74 * @param pjobj - return parameter as a java object representing
75 * the member. If it is a basic data type it is converted to
76 * a corresponding java type. If it is a NJSObject, then it is
77 * wrapped up as java wrapper netscape.javascript.JSObject.
80 GetMember(JNIEnv
*jEnv
, lcjsobject obj
, const jchar
*name
, jsize length
, void* principalsArray
[],
81 int numPrincipals
, nsISupports
*securitySupports
, jobject
*pjobj
);
84 * get member of a Native JSObject for a given index.
86 * @param obj - A Native JS Object.
87 * @param index - Index of a member.
88 * @param pjobj - return parameter as a java object representing
92 GetSlot(JNIEnv
*jEnv
, lcjsobject obj
, jint slot
, void* principalsArray
[],
93 int numPrincipals
, nsISupports
*securitySupports
, jobject
*pjobj
);
96 * set member of a Native JSObject for a given name.
98 * @param obj - A Native JS Object.
99 * @param name - Name of a member.
100 * @param jobj - Value to set. If this is a basic data type, it is converted
101 * using standard JNI calls but if it is a wrapper to a JSObject
102 * then a internal mapping is consulted to convert to a NJSObject.
105 SetMember(JNIEnv
*jEnv
, lcjsobject obj
, const jchar
*name
, jsize length
, jobject jobj
, void* principalsArray
[],
106 int numPrincipals
, nsISupports
*securitySupports
);
109 * set member of a Native JSObject for a given index.
111 * @param obj - A Native JS Object.
112 * @param index - Index of a member.
113 * @param jobj - Value to set. If this is a basic data type, it is converted
114 * using standard JNI calls but if it is a wrapper to a JSObject
115 * then a internal mapping is consulted to convert to a NJSObject.
118 SetSlot(JNIEnv
*jEnv
, lcjsobject obj
, jint slot
, jobject jobj
, void* principalsArray
[],
119 int numPrincipals
, nsISupports
*securitySupports
);
122 * remove member of a Native JSObject for a given name.
124 * @param obj - A Native JS Object.
125 * @param name - Name of a member.
128 RemoveMember(JNIEnv
*jEnv
, lcjsobject obj
, const jchar
*name
, jsize length
, void* principalsArray
[],
129 int numPrincipals
, nsISupports
*securitySupports
);
132 * call a method of Native JSObject.
134 * @param obj - A Native JS Object.
135 * @param name - Name of a method.
136 * @param jobjArr - Array of jobjects representing parameters of method being caled.
137 * @param pjobj - return value.
140 Call(JNIEnv
*jEnv
, lcjsobject obj
, const jchar
*name
, jsize length
, jobjectArray jobjArr
, void* principalsArray
[],
141 int numPrincipals
, nsISupports
*securitySupports
, jobject
*pjobj
);
144 * Evaluate a script with a Native JS Object representing scope.
146 * @param obj - A Native JS Object.
147 * @param pNSIPrincipaArray - Array of principals to be used to compare privileges.
148 * @param numPrincipals - Number of principals being passed.
149 * @param script - Script to be executed.
150 * @param pjobj - return value.
153 Eval(JNIEnv
*jEnv
, lcjsobject obj
, const jchar
*script
, jsize length
, void* principalsArray
[],
154 int numPrincipals
, nsISupports
*securitySupports
, jobject
*pjobj
);
157 * Get the window object for a plugin instance.
159 * @param pJavaObject - Either a jobject or a pointer to a plugin instance
160 * representing the java object.
161 * @param pjobj - return value. This is a native js object
162 * representing the window object of a frame
163 * in which a applet/bean resides.
166 GetWindow(JNIEnv
*jEnv
, void *pJavaObject
, void* principalsArray
[],
167 int numPrincipals
, nsISupports
*securitySupports
, lcjsobject
*pobj
);
170 * Get the window object for a plugin instance.
172 * @param jEnv - JNIEnv on which the call is being made.
173 * @param obj - A Native JS Object.
176 FinalizeJSObject(JNIEnv
*jEnv
, lcjsobject obj
);
179 * Get the window object for a plugin instance.
181 * @param jEnv - JNIEnv on which the call is being made.
182 * @param obj - A Native JS Object.
183 * @param jstring - Return value as a jstring representing a JS object.
186 ToString(JNIEnv
*jEnv
, lcjsobject obj
, jstring
*pjstring
);
187 ////////////////////////////////////////////////////////////////////////////
188 // from nsCLiveconnect:
190 nsCLiveconnect(nsISupports
*aOuter
);
191 virtual ~nsCLiveconnect(void);
197 #endif // nsCLiveconnect_h___