/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * 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 The Waterfall Java Plugin Module * * The Initial Developer of the Original Code is Sun Microsystems Inc * Portions created by Sun Microsystems Inc are Copyright (C) 2001 * All Rights Reserved. * * $Id: nsIPluggableJVM.idl,v 1.1.1.1 2001-05-10 18:12:41 edburns%acm.org Exp $ * * * Contributor(s): * * Nikolay N. Igotti */ #include "nsoji2.idl" #include "nsIBrowserJavaSupport.idl" interface nsIJavaHTMLObject; /** this is generic JVM inside browser. You can have * more control on this then using nsIJVMPlugin interface. * This stuff SHOULD NOT depend on particular JNI/JVM. * XXX: now it does :), but only in nsoji2.idl and generated .h files. */ /** One more important issue: maybe it has sense to divide functionality * onto threading, drawing, scripting, startup/shutdown parts, * but I'd like to avoid scattering functionality, so everything * is in one place. But interface users should expect that some interface * method aren't implemented, especially LiveConnect related. */ %{C++ #define NS_PLUGGABLEJVM_CID \ { /* 43abebc6-a9b1-419f-acbe-677474edead1 */ \ 0x43abebc6, \ 0xa9b1, \ 0x419f, \ {0xac, 0xbe, 0x67, 0x74, 0x74, 0xed, 0xea, 0xd1} \ } %} [uuid(931c3870-c12d-4bff-8e80-005dd29fee01)] interface nsIPluggableJVM : nsISupports { /**********************************************************/ // Here drawing context stuff /** * This method registers native window handle rwin * as Java frame, returns Java object and integer ID * of this window. Until UnregisterWindow() is called * it is valid handle. Generally only one thread should * work with registration/unregistration of one window. * Also when native peer is destroyed unregister window should be called * before - otherwise JVM may crash. */ void RegisterWindow(in nsNativeWindow rwin, out jp_jint ID); /** * Unregister window and remove Java peer. Call carefully. */ void UnregisterWindow(in jp_jint ID); /**********************************************************/ // Here threading stuff /** * Create Java monitor assotiated with given native monitor */ void RegisterMonitor(in nsNativeMonitor rmon, out jp_jint ID); /** * Unregister monitor. Call carefully. */ void UnregisterMonitor(in jp_jint ID); /**********************************************************/ // Here scripting stuff (javascript based) /** * Get JavaScript Java object used for LiveConnect. */ void GetJavaWrapper(in jp_jint jsobj, out jp_jobject jobj); /** * Get native JS object from Java object **/ void UnwrapJavaWrapper(in jp_jobject jobj, out jp_jint jsobj); /** * Returns JNIEnv of current context. Required due current way * of LiveConnect implementation. */ void GetJNIEnv(out jp_JNIEnv env); /**********************************************************/ // Here JVM control stuff /** * Run JVM with given classpath. * Status depends on success of this operation. */ void StartupJVM(in string classPath, out nsJVMStatus status, in jp_jlong support); /** * Shutdown JVM. */ void ShutdownJVM(in PRBool fullShutdown, out nsJVMStatus status); /**********************************************************/ // generic object management void CreateJavaPeer(in nsIJavaHTMLObject obj, in string cid, out jp_jint id); void PostEventToJavaPeer(in jp_jint obj_id, in jp_jint evt_id, in jp_jlong evt_data); void SendEventToJavaPeer(in jp_jint obj_id, in jp_jint evt_id, in jp_jlong evt_data, out jp_jint result); void JavaPeerCall(in jp_jint obj_id, in jp_jint data1, in jp_jlong data2); void DestroyJavaPeer(in jp_jint id); void ExtensionCall(in jp_jint arg1, in jp_jlong arg2); /*********************************************************/ // utility stuff, like console handling void SetConsoleVisibility(in boolean visibility); void GetConsoleVisibility(out boolean visibility); void PrintToConsole(in string msg, in string encoding); };