checkpoint_basic_scriptability

This commit is contained in:
edburns%acm.org 2007-12-21 20:19:57 +00:00
Родитель cfba0941cb
Коммит 77a8a5aa3a
11 изменённых файлов: 106 добавлений и 16 удалений

16
java/plugins/dist/build.xml поставляемый
Просмотреть файл

@ -275,7 +275,12 @@
file="${objdir}/java/plugins/jni/${so.prefix}plugletjni.${so.extension}" />
<copy todir="${dist.home}/bin/${platform}/bin/plugins"
file="${objdir}/java/plugins/mozilla/${so.prefix}nppluglet.${so.extension}" />
<copy todir="${dist.home}/bin/xp/bin/components">
<fileset dir="${objdir}/java/plugins/mozilla/_xpidlgen">
<include name="*.xpt" />
</fileset>
</copy>
</target>
<target name="copy.test.src" depends="prepare">
@ -372,6 +377,15 @@
<classpath location="${dist.jar}"/>
</javadoc>
</target>
<target name="deploy">
<copy todir="C:\\Projects\\chaff\\pluglet_1_1_a1">
<fileset dir="${dist.home}" />
</copy>
</target>
</project>

1
java/plugins/dist/netbeans/build.xml поставляемый
Просмотреть файл

@ -220,6 +220,7 @@ in which the file "prefs.js" resides? The current value of this
<target name="copy.binaries" if="do.copy.binaries">
<copy todir="${browser.bin.dir}">
<fileset dir="${basedir}/../bin/${platform}/bin" />
<fileset dir="${basedir}/../bin/xp/bin" />
</copy>
</target>

Просмотреть файл

@ -1,8 +1,8 @@
bin.artifacts.pattern=${so.prefix}plugletjni.${so.extension},components/${so.prefix}pluglet.${so.extension},components/pluglet.xpt,plugins/np${so.prefix}pluglet.${so.extension},plugins/SimplePluglet.jar,plugins/jmfplayer.jar
bin.artifacts.pattern=${so.prefix}plugletjni.${so.extension},components/${so.prefix}pluglet.${so.extension},components/*luglet*.xpt,plugins/np${so.prefix}pluglet.${so.extension},plugins/SimplePluglet.jar,plugins/jmfplayer.jar
#debug.jvm.args=-Xdebug -Xrunjdwp:transport=dt_shmem,address=jdbconn,server=y,suspend=y
#Make this point to the bin directory of your firefox installation
browser.bin.dir=C:\\Projects\\mozilla\\MOZILLA_NIH\\FIREFOX_2_0_0_3_RELEASE\\mozilla\\firefox-win32_d.obj\\dist\\bin
user.profile.dir=${user.home}/APPLIC~1/Mozilla/Firefox/Profiles/2t6hklzc.default
browser.bin.dir=F:\\Projects\\mozilla\\MOZILLA_NIH\\FIREFOX_2_0_0_3_RELEASE\\mozilla\\firefox-win32_d.obj\\dist\\bin
user.profile.dir=${user.home}/APPLIC~1/Mozilla/Firefox/Profiles/69lpopfc.default
#Make this point at your JDKHOME without spaces
jdkhome.nospaces=C:\\PROGRA~1\\Java\\jdk1.5.0_12

Просмотреть файл

@ -3,5 +3,21 @@
<body>
<EMBED type="application/x-simple-pluglet" name="test"
src="index.html" width=400 height=200>
<script>
var embed = document.embeds[0];
function callPluglet()
{
var inArgv = [];
var outArgv = [];
embed.callPlugletMethod("methodName", 0, inArgv, 0, outArgv);
}
</script>
<form name="formname">
<input type=button value="Call Pluglet" onclick='callPluglet()'> </input>
</form>
</body>
</html>

Просмотреть файл

@ -60,7 +60,7 @@ CPPSRCS = nsScriptablePeer.cpp \
npAPInsIInputStreamShim.cpp \
$(NULL)
XPIDLSRCS = nsISimplePlugin.idl
XPIDLSRCS = nsIPluglet.idl
SHARED_LIBRARY_LIBS = $(PLUGIN_SDK_OBJDIR)/samples/common/$(LIB_PREFIX)plugingate_s.$(LIB_SUFFIX) ../src/$(LIB_PREFIX)pluglet.$(LIB_SUFFIX) $(XPCOM_LIBS) $(NSPR_LIBS)

Просмотреть файл

@ -55,7 +55,7 @@
#include "prlog.h"
static PRLogModuleInfo* log = NULL;
PRLogModuleInfo* log = NULL; // declared in nppluglet.h
// service manager which will give the access to all public browser services
// we will use memory service as an illustration
@ -353,7 +353,7 @@ NS_IMETHODIMP nsPluginInstance::HasPlugletForMimeType(const char *aMimeType,
nsresult rv = NS_ERROR_FAILURE;
*outResult = PR_FALSE;
nsCOMPtr<nsIPlugin> plugletEngine = nsnull;
nsIID scriptableIID = NS_ISIMPLEPLUGIN_IID;
nsIID scriptableIID = NS_IPLUGLET_IID;
if (!mPluglet) {
plugletEngine = do_GetService(PLUGLETENGINE_ContractID, &rv);
@ -428,7 +428,7 @@ NPError nsPluginInstance::GetValue(NPPVariable aVariable, void *aValue)
switch (aVariable) {
case NPPVpluginScriptableInstance: {
// addref happens in getter, so we don't addref here
nsISimplePlugin * scriptablePeer = getScriptablePeer();
nsIPluglet * scriptablePeer = getScriptablePeer();
if (scriptablePeer) {
*(nsISupports **)aValue = scriptablePeer;
} else
@ -437,7 +437,7 @@ NPError nsPluginInstance::GetValue(NPPVariable aVariable, void *aValue)
break;
case NPPVpluginScriptableIID: {
static nsIID scriptableIID = NS_ISIMPLEPLUGIN_IID;
static nsIID scriptableIID = NS_IPLUGLET_IID;
nsIID* ptr = (nsIID *)NPN_MemAlloc(sizeof(nsIID));
if (ptr) {
*ptr = scriptableIID;

Просмотреть файл

@ -43,6 +43,9 @@
#include "nsCOMPtr.h"
#include "nsIPluginInstance.h"
#include "prlog.h"
extern PRLogModuleInfo *log; // defined in nppluglet.cpp
class nsPluginInstance : public nsPluginInstanceBase
{
public:

Просмотреть файл

@ -0,0 +1,47 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
[scriptable, uuid(482e1890-1fe5-11d5-9cf8-0060b0fbd8ac)]
interface nsIPluglet : nsISupports {
boolean hasPlugletForMimeType(in string aMimeType);
void callPlugletMethod(in string methodName,
in PRUint32 inArgc,
[array, size_is(inArgc)] in string inArgv);
};

Просмотреть файл

Просмотреть файл

@ -47,7 +47,7 @@
//
#include "nppluglet.h"
static NS_DEFINE_IID(kISimplePluginIID, NS_ISIMPLEPLUGIN_IID);
static NS_DEFINE_IID(kIPlugletIID, NS_IPLUGLET_IID);
static NS_DEFINE_IID(kIClassInfoIID, NS_ICLASSINFO_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@ -86,8 +86,8 @@ NS_IMETHODIMP nsScriptablePeer::QueryInterface(const nsIID& aIID, void** aInstan
if(!aInstancePtr)
return NS_ERROR_NULL_POINTER;
if(aIID.Equals(kISimplePluginIID)) {
*aInstancePtr = static_cast<nsISimplePlugin*>(this);
if(aIID.Equals(kIPlugletIID)) {
*aInstancePtr = static_cast<nsIPluglet*>(this);
AddRef();
return NS_OK;
}
@ -99,7 +99,7 @@ NS_IMETHODIMP nsScriptablePeer::QueryInterface(const nsIID& aIID, void** aInstan
}
if(aIID.Equals(kISupportsIID)) {
*aInstancePtr = static_cast<nsISupports*>((static_cast<nsISimplePlugin*>(this)));
*aInstancePtr = static_cast<nsISupports*>((static_cast<nsIPluglet*>(this)));
AddRef();
return NS_OK;
}
@ -132,3 +132,12 @@ NS_IMETHODIMP nsScriptablePeer::HasPlugletForMimeType(const char *aMimeType, PRB
}
NS_IMETHODIMP nsScriptablePeer::CallPlugletMethod(const char *methodName,
PRUint32 inArgc, const char **inArgv)
{
nsresult rv = NS_OK;
PR_LOG(log, PR_LOG_DEBUG,
("nppluglet CallPlugletMethod: methodName: %s\n", methodName));
return rv;
}

Просмотреть файл

@ -45,7 +45,7 @@
#ifndef __nsScriptablePeer_h__
#define __nsScriptablePeer_h__
#include "nsISimplePlugin.h"
#include "nsIPluglet.h"
#include "nsIClassInfo.h"
class nsPluginInstance;
@ -78,7 +78,7 @@ class nsClassInfoMixin : public nsIClassInfo
{return NS_ERROR_NOT_IMPLEMENTED;}
};
class nsScriptablePeer : public nsISimplePlugin,
class nsScriptablePeer : public nsIPluglet,
public nsClassInfoMixin
{
public:
@ -96,7 +96,7 @@ protected:
public:
// native methods callable from JavaScript
NS_DECL_NSISIMPLEPLUGIN
NS_DECL_NSIPLUGLET
void SetInstance(nsPluginInstance* plugin);