/[gcjwebplugin]/gcjwebplugin/src/GCJPluginInstance.cc
ViewVC logotype

Diff of /gcjwebplugin/src/GCJPluginInstance.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by mkoch, Wed Jul 16 05:20:16 2003 UTC revision 1.11 by fitzsim, Sun Jul 27 19:03:22 2003 UTC
# Line 40  exception statement from your version. * Line 40  exception statement from your version. *
40  #include <nsIJVMPluginTagInfo.h>  #include <nsIJVMPluginTagInfo.h>
41  #include <nsIPluginInstancePeer.h>  #include <nsIPluginInstancePeer.h>
42  #include <nsIPluginTagInfo2.h>  #include <nsIPluginTagInfo2.h>
43    #include <plugin/npapi.h>
44    
45  #include "GCJPluginInstance.h"  #include "GCJPluginInstance.h"
46  #include "jniHelp.h"  #include "jniHelp.h"
# Line 54  GCJPluginInstance::GCJPluginInstance (GC Line 55  GCJPluginInstance::GCJPluginInstance (GC
55    : m_peer (NULL)    : m_peer (NULL)
56    , m_jniEnv (jniEnv)    , m_jniEnv (jniEnv)
57    , m_applet (NULL)    , m_applet (NULL)
58      , m_appletLoader (NULL)
59    , m_embeddedWindow (NULL)    , m_embeddedWindow (NULL)
60  {  {
61    PLUGIN_DEBUG ("GCJPluginInstance::GCJPluginInstance\n");    PLUGIN_DEBUG ("GCJPluginInstance::GCJPluginInstance\n");
# Line 77  GCJPluginInstance::Initialize (nsIPlugin Line 79  GCJPluginInstance::Initialize (nsIPlugin
79    jstring documentBase;    jstring documentBase;
80    jstring archive;    jstring archive;
81        
   jobject appletLoader;  
   
82    nsresult result;    nsresult result;
83    nsIJVMPluginTagInfo* pluginTagInfo;    nsIJVMPluginTagInfo* pluginTagInfo;
84    nsIPluginTagInfo2* pluginTagInfo2;    nsIPluginTagInfo2* pluginTagInfo2;
# Line 147  GCJPluginInstance::Initialize (nsIPlugin Line 147  GCJPluginInstance::Initialize (nsIPlugin
147        // Load applet        // Load applet
148        //        //
149        PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.<init>\n");        PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.<init>\n");
150        jobject appletLoader = m_jniEnv->NewObject (appletLoader_cl, appletLoader_init);        m_appletLoader = m_jniEnv->NewObject (appletLoader_cl, appletLoader_init);
151        assert (appletLoader != NULL);        assert (m_appletLoader != NULL);
152        CHECK_EXCEPTIONS;        CHECK_EXCEPTIONS;
153    
154        if (tmp_code != NULL)        if (tmp_code != NULL)
155          {          {
156            PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.setCode\n");            PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.setCode\n");
157            m_jniEnv->CallVoidMethod (appletLoader, appletLoader_setCode, code);            m_jniEnv->CallVoidMethod (m_appletLoader, appletLoader_setCode, code);
158            CHECK_EXCEPTIONS;            CHECK_EXCEPTIONS;
159          }          }
160    
161        if (tmp_codeBase != NULL)        if (tmp_codeBase != NULL)
162          {          {
163            PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.setCodeBase\n");            PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.setCodeBase\n");
164            m_jniEnv->CallVoidMethod (appletLoader, appletLoader_setCodeBase, codeBase);            m_jniEnv->CallVoidMethod (m_appletLoader, appletLoader_setCodeBase, codeBase);
165            CHECK_EXCEPTIONS;            CHECK_EXCEPTIONS;
166          }          }
167    
168        if (tmp_documentBase != NULL)        if (tmp_documentBase != NULL)
169          {          {
170            PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.setDocumentBase\n");            PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.setDocumentBase\n");
171            m_jniEnv->CallVoidMethod (appletLoader, appletLoader_setDocumentBase, documentBase);            m_jniEnv->CallVoidMethod (m_appletLoader, appletLoader_setDocumentBase, documentBase);
172            CHECK_EXCEPTIONS;            CHECK_EXCEPTIONS;
173          }          }
174    
175        if (tmp_archive != NULL)        if (tmp_archive != NULL)
176          {          {
177            PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.setArchive\n");            PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.setArchive\n");
178            m_jniEnv->CallVoidMethod (appletLoader, appletLoader_setArchive, archive);            m_jniEnv->CallVoidMethod (m_appletLoader, appletLoader_setArchive, archive);
179            CHECK_EXCEPTIONS;            CHECK_EXCEPTIONS;
180          }          }
181    
182        for (int count = 0; count < numParams; count++)        for (int count = 0; count < numParams; count++)
183          {          {
184            PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.addParameter\n");            PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.addParameter\n");
185            m_jniEnv->CallVoidMethod (appletLoader, appletLoader_addParameter,            m_jniEnv->CallVoidMethod (m_appletLoader, appletLoader_addParameter,
186                                      m_jniEnv->NewStringUTF (tmp_paramNames [count]),                                      m_jniEnv->NewStringUTF (tmp_paramNames [count]),
187                                      m_jniEnv->NewStringUTF (tmp_paramValues [count]));                                      m_jniEnv->NewStringUTF (tmp_paramValues [count]));
188            CHECK_EXCEPTIONS;            CHECK_EXCEPTIONS;
189          }          }
190    
191        PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.loadApplet\n");        PLUGIN_DEBUG ("GCJPluginInstance::Initialize: AppletLoader.loadApplet\n");
192        m_applet = m_jniEnv->CallObjectMethod (appletLoader, appletLoader_loadApplet);        m_applet = m_jniEnv->CallObjectMethod (m_appletLoader, appletLoader_loadApplet);
193        CHECK_EXCEPTIONS;        CHECK_EXCEPTIONS;
194      }      }
195    
# Line 291  GCJPluginInstance::SetWindow (nsPluginWi Line 291  GCJPluginInstance::SetWindow (nsPluginWi
291    
292    if (m_applet != NULL)    if (m_applet != NULL)
293      {      {
294          // First, create an embedded window.
295          PLUGIN_DEBUG (" Finding EmbeddedWindow methods...\n");
296    
297        jclass embeddedWindow_cl = m_jniEnv->FindClass (        jclass embeddedWindow_cl = m_jniEnv->FindClass (
298                                     "gnu/java/awt/EmbeddedWindow");                                     "gnu/java/awt/EmbeddedWindow");
299        assert (embeddedWindow_cl);        assert (embeddedWindow_cl);
300    
301        jmethodID embeddedWindow_create = m_jniEnv->GetMethodID (        jmethodID embeddedWindow_init = m_jniEnv->GetMethodID (
302                                            embeddedWindow_cl, "create", "(III)V");                                                       embeddedWindow_cl,
303        assert (embeddedWindow_create);                                                       "<init>", "(I)V");
304          assert (embeddedWindow_init);
305        m_embeddedWindow = m_jniEnv->CallStaticObjectMethod (  
306                             embeddedWindow_cl, embeddedWindow_create,        jmethodID embeddedWindow_setSize = m_jniEnv->GetMethodID (
307                             (jint) window->window, (jint) window->width,                                                          embeddedWindow_cl,
308                             (jint) window->height);                                                          "setSize", "(II)V");
309        assert (m_embeddedWindow != NULL);        assert (embeddedWindow_setSize);
310    
311          PLUGIN_DEBUG2 (" Initializing EmbeddedWindow: %d...\n", (unsigned long) window->window);
312    
313          m_embeddedWindow = m_jniEnv->NewObject (embeddedWindow_cl, embeddedWindow_init,
314                                                  (jint) window->window);
315          assert (m_embeddedWindow);
316    
317          PLUGIN_DEBUG2 (" Setting EmbeddedWindow size: width  %d...\n", (unsigned long) window->width);
318          PLUGIN_DEBUG2 (" Setting EmbeddedWindow size: height %d...\n", (unsigned long) window->height);
319    
320          m_jniEnv->CallVoidMethod (m_embeddedWindow, embeddedWindow_setSize,
321                                    (jint) (window->width), (jint) (window->height));
322    
323          PLUGIN_DEBUG (" Finding AppletLoader...\n");
324    
325          /* Now add the applet to this window. */
326          jclass appletLoader_cl = m_jniEnv->FindClass ("gnu/applet/AppletLoader");
327          assert (appletLoader_cl != NULL);
328    
329          PLUGIN_DEBUG (" Finding setEmbeddedWindow...\n");
330    
331          jmethodID appletLoader_setEmbeddedWindow = m_jniEnv->GetMethodID (
332                                                       appletLoader_cl,
333                                                       "setEmbeddedWindow", "(Lgnu.java.awt.EmbeddedWindow;)V");
334          assert (appletLoader_setEmbeddedWindow != NULL);
335    
336          PLUGIN_DEBUG (" Calling setEmbeddedWindow...\n");
337    
338          if (!m_appletLoader)
339            PLUGIN_DEBUG (" no m_appletLoader!...\n");
340    
341          if (!m_embeddedWindow)
342            PLUGIN_DEBUG (" no m_embeddedWindow!...\n");
343    
344          m_jniEnv->CallVoidMethod (m_appletLoader, appletLoader_setEmbeddedWindow, m_embeddedWindow);
345    
346        CHECK_EXCEPTIONS;        CHECK_EXCEPTIONS;
347      }      }
348    
# Line 349  GCJPluginInstance::GetValue (nsPluginIns Line 388  GCJPluginInstance::GetValue (nsPluginIns
388          *(PRBool*) value = PR_FALSE;          *(PRBool*) value = PR_FALSE;
389          break;          break;
390    
391          case (nsPluginInstanceVariable)NPPVpluginNeedsXEmbed:
392            *(PRBool*) value = PR_TRUE;
393            break;
394    
395        default:        default:
396          PLUGIN_DEBUG ("GCJPluginInstance::GetValue: Requested unknown value\n");          PLUGIN_DEBUG ("GCJPluginInstance::GetValue: Requested unknown value\n");
397          return NS_ERROR_NOT_IMPLEMENTED;          return NS_ERROR_NOT_IMPLEMENTED;

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26