NOT PART OF BUILD. Implement the site service provider and event sinks plus lots of cleanup

This commit is contained in:
locka%iol.ie 2002-09-30 22:11:28 +00:00
Родитель 3af7a46278
Коммит d714b783a8
12 изменённых файлов: 1893 добавлений и 156 удалений

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

@ -44,6 +44,13 @@
#include "nsISupports.h"
#include "LegacyPlugin.h"
#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
#include "XPConnect.h"
#endif
#ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT
#include "LiveConnect.h"
#endif
// NPP_Initialize
//
@ -66,7 +73,7 @@ void NPP_Shutdown(void)
{
NG_TRACE_METHOD(NPP_Shutdown);
#ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT
liveconnect_shutdown();
liveconnect_Shutdown();
#endif
_Module.Unlock();
}
@ -80,7 +87,7 @@ jref NPP_GetJavaClass(void)
{
NG_TRACE_METHOD(NPP_GetJavaClass);
#ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT
return liveconnect_getjavaclass();
return liveconnect_GetJavaClass();
#endif
return NULL;
}
@ -117,6 +124,12 @@ NPError NewControl(const char *pluginType,
tstring szCodebase;
PropertyList pl;
if (strcmp(pluginType, MIME_OLEOBJECT1) != 0 &&
strcmp(pluginType, MIME_OLEOBJECT2) != 0)
{
clsid = xpc_GetCLSIDForType(pluginType);
}
for (int16 i = 0; i < argc; i++)
{
if (stricmp(argn[i], "CLSID") == 0 ||
@ -234,7 +247,7 @@ NPError NewControl(const char *pluginType,
}
// Make sure we got a CLSID
if (memcmp(&clsid, &CLSID_NULL, sizeof(CLSID)) == 0)
if (::IsEqualCLSID(clsid, CLSID_NULL))
{
return NPERR_GENERIC_ERROR;
}
@ -250,6 +263,13 @@ NPError NewControl(const char *pluginType,
}
pSite->AddRef();
#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
CComPtr<IServiceProvider> sp;
xpc_GetServiceProvider(pData, &sp);
if (sp)
pSite->SetServiceProvider(sp);
#endif
// TODO check the object is installed and at least as recent as
// that specified in szCodebase
@ -268,8 +288,19 @@ NPError NewControl(const char *pluginType,
return NPERR_GENERIC_ERROR;
}
CControlEventSinkInstance *pSink = NULL;
CControlEventSinkInstance::CreateInstance(&pSink);
if (pSink)
{
pSink->AddRef();
CComPtr<IUnknown> control;
pSite->GetControlUnknown(&control);
pSink->SubscribeToEvents(control);
}
pData->nType = itControl;
pData->pControlSite = pSite;
pData->pControlEventSink = pSink;
return NPERR_NO_ERROR;
}
@ -301,6 +332,7 @@ NPError NP_LOADDS NPP_New(NPMIMEType pluginType,
{
return NPERR_GENERIC_ERROR;
}
pData->pPluginInstance = instance;
pData->szUrl = NULL;
pData->szContentType = (pluginType) ? strdup(pluginType) : NULL;
#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
@ -314,15 +346,11 @@ NPError NP_LOADDS NPP_New(NPMIMEType pluginType,
{
rv = NewScript(pluginType, pData, mode, argc, argn, argv);
}
else if (strcmp(pluginType, MIME_OLEOBJECT1) == 0 ||
strcmp(pluginType, MIME_OLEOBJECT2) == 0)
else /* if (strcmp(pluginType, MIME_OLEOBJECT1) == 0 ||
strcmp(pluginType, MIME_OLEOBJECT2) == 0) */
{
rv = NewControl(pluginType, pData, mode, argc, argn, argv);
}
else
{
// Unknown MIME type
}
// Test if plugin creation has succeeded and cleanup if it hasn't
if (rv != NPERR_NO_ERROR)
@ -365,6 +393,11 @@ NPP_Destroy(NPP instance, NPSavedData** save)
pSite->Detach();
pSite->Release();
}
if (pData->pControlEventSink)
{
pData->pControlEventSink->UnsubscribeFromEvents();
pData->pControlEventSink->Release();
}
#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
if (pData->pScriptingPeer)
{
@ -446,7 +479,7 @@ NPP_SetWindow(NPP instance, NPWindow* window)
pSite->SetPosition(rcPos);
}
}
}
}
return NPERR_NO_ERROR;
}
@ -617,7 +650,7 @@ NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
NPError rv = NPERR_GENERIC_ERROR;
#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
rv = xpconnect_getvalue(instance, variable, value);
rv = xpc_GetValue(instance, variable, value);
#endif
return rv;
}

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

@ -52,11 +52,15 @@ enum PluginInstanceType
// Data associated with a plugin instance
struct PluginInstanceData {
NPP pPluginInstance;
PluginInstanceType nType;
union
{
CActiveScriptSiteInstance *pScriptSite;
CControlSiteInstance *pControlSite;
struct {
CControlSiteInstance *pControlSite;
CControlEventSinkInstance *pControlEventSink;
};
};
char *szUrl;
char *szContentType;
@ -66,13 +70,4 @@ struct PluginInstanceData {
#endif
};
#ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT
extern void liveconnect_shutdown();
extern jref liveconnect_getjavaclass();
#endif
#ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
extern NPError xpconnect_getvalue(NPP instance, NPPVariable variable, void *value);
#endif
#endif

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

@ -59,8 +59,9 @@
#include "_java/MozAxPlugin.h"
#include "LegacyPlugin.h"
#include "LiveConnect.h"
void liveconnect_shutdown()
void liveconnect_Shutdown()
{
JRIEnv* env = NPN_GetJavaEnv();
if (env) {
@ -78,7 +79,7 @@ void liveconnect_shutdown()
}
}
jref liveconnect_getjavaclass()
jref liveconnect_GetJavaClass()
{
JRIEnv* env = NPN_GetJavaEnv();
if (env) {

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

@ -38,6 +38,7 @@ REQUIRES = \
java \
plugin \
string \
dom \
$(NULL)
XPIFILE = mozactivex.xpi
@ -46,7 +47,7 @@ NO_DIST_INSTALL = 1
NO_INSTALL = 1
# Path to the Mozilla ActiveX control (some files are copied from there)
MOZCTLSRC=../control
MOZCTLSRC=$(srcdir)/../control
############
# LiveConnect settings
@ -77,7 +78,6 @@ SDK_CLASSES = $(PLUGINSDK)/classes/java_30.zip
SDK_CLASSPATH = "$(subst /,\,$(SDK_CLASSES));."
endif
############
# XPConnect settings
@ -85,27 +85,53 @@ MOZ_ACTIVEX_PLUGIN_XPCONNECT = 1
# XPConnect support in (Netscape 6.1+/Mozilla)
############
# Windows Media Player settings
# IMPORTANT NOTE - WMP is being used as a real world test harness to exercise
# some of the site-side interfaces. Don't enable this option
# in normal use.
# WMP support needs XPConnect
ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
# MOZ_ACTIVEX_PLUGIN_WMPSUPPORT = 1
WMP_SDK = C:/m/WMSDK/WMPSDK9
endif
###############################################################################
ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
XPIDLSRCS = \
./nsIMozAxPlugin.idl \
./nsIMozAxPlugin.idl \
$(NULL)
endif
ifdef MOZ_ACTIVEX_PLUGIN_WMPSUPPORT
XPIDLSRCS += nsWMP.idl
endif
_CONTROL_CPPSRCS = \
ActiveScriptSite.cpp \
ControlEventSink.cpp \
ControlSite.cpp \
ControlSiteIPFrame.cpp \
ItemContainer.cpp \
PropertyBag.cpp \
$(NULL)
GARBAGE += $(addprefix $(srcdir)/,$(_CONTROL_CPPSRCS)) $(DEFFILE)
CPPSRCS = \
StdAfx.cpp \
ControlSite.cpp \
ControlSiteIPFrame.cpp \
ItemContainer.cpp \
PropertyBag.cpp \
ActiveScriptSite.cpp \
LegacyPlugin.cpp \
MozActiveX.cpp \
npwin.cpp
npwin.cpp \
$(_CONTROL_CPPSRCS) \
$(NULL)
ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
CPPSRCS += XPConnect.cpp
CPPSRCS += XPConnect.cpp XPCDocument.cpp
endif
ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT
@ -113,6 +139,10 @@ CPPSRCS += LiveConnect.cpp
CSRCS += javastubs.c
endif
ifdef MOZ_ACTIVEX_PLUGIN_WMPSUPPORT
CPPSRCS += XPCMediaPlayer.cpp
endif
DEFINES += -DWIN32_LEAN_AND_MEAN
LOCAL_INCLUDES = -I$(MOZCTLSRC)
@ -122,7 +152,12 @@ LOCAL_INCLUDES += -I./_java
endif
ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
LOCAL_INCLUDES += -I./_xpidlgen
LOCAL_INCLUDES += -I$(XPIDL_GEN_DIR)
endif
ifdef MOZ_ACTIVEX_PLUGIN_WMPSUPPORT
LOCAL_INCLUDES += -I$(WMP_SDK)/include
DEFINES += -DMOZ_ACTIVEX_PLUGIN_WMPSUPPORT
endif
OS_LIBS += \
@ -159,17 +194,26 @@ include $(topsrcdir)/config/rules.mk
CXXFLAGS += -GX
copy-sources: $(addprefix $(MOZCTLSRC)/,$(_CONTROL_CPPSRCS))
$(INSTALL) $^ $(srcdir)
export:: copy-sources
install-plugin: $(SHARED_LIBRARY)
ifdef SHARED_LIBRARY
$(INSTALL) $(SHARED_LIBRARY) $(DIST)/bin/plugins
$(INSTALL) $< $(DIST)/bin/plugins
endif
install-class:
$(INSTALL) MozAxPlugin.class $(DIST)/bin/plugins
install-class: MozAxPlugin.class
$(INSTALL) $< $(DIST)/bin/plugins
install-typelib:
$(INSTALL) _xpidlgen/nsIMozAxPlugin.xpt $(DIST)/bin/plugins
install-typelib: $(XPIDL_GEN_DIR)/nsIMozAxPlugin.xpt
$(INSTALL) $< $(DIST)/bin/plugins
ifdef MOZ_ACTIVEX_PLUGIN_WMPSUPPORT
install-wmp-typelib: $(XPIDL_GEN_DIR)/nsWMP.xpt
$(INSTALL) $< $(DIST)/bin/plugins
endif
libs:: install-plugin
@ -181,29 +225,31 @@ ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
libs:: install-typelib
endif
clean::
-rm $(DEFFILE)
ifdef MOZ_ACTIVEX_PLUGIN_WMPSUPPORT
libs:: install-wmp-typelib
endif
## Note: Ensure you create the redist dir containing the correct runtime dlls
xpi:: install.js $(SHARED_LIBRARY)
$(ZIP_PROG) -9 -j $(DIST)/bin/$(XPIFILE) install.js
$(ZIP_PROG) -9 -j $(DIST)/bin/$(XPIFILE) $<
$(ZIP_PROG) -9 -j $(DIST)/bin/$(XPIFILE) $(SHARED_LIBRARY)
$(ZIP_PROG) -9 -j $(DIST)/bin/$(XPIFILE) $(subst \,/,$(MOZ_SRC))/redist/microsoft/system/msvcrt.dll
$(ZIP_PROG) -9 -j $(DIST)/bin/$(XPIFILE) $(subst \,/,$(MOZ_SRC))/redist/microsoft/system/msvcp60.dll
$(ZIP_PROG) -9 -j $(DIST)/bin/$(XPIFILE) $(topsrcdir)/../redist/microsoft/system/msvcrt.dll
$(ZIP_PROG) -9 -j $(DIST)/bin/$(XPIFILE) $(topsrcdir)/../redist/microsoft/system/msvcp60.dll
ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT
xpi::
$(ZIP_PROG) -9 -j $(DIST)/bin/$(XPIFILE) MozAxPlugin.class
endif
ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
xpi::
$(ZIP_PROG) -9 -j $(DIST)/bin/$(XPIFILE) _xpidlgen/nsIMozAxPlugin.xpt
$(ZIP_PROG) -9 -j $(DIST)/bin/$(XPIFILE) $(XPIDL_GEN_DIR)/nsIMozAxPlugin.xpt
endif
ifdef MOZ_ACTIVEX_PLUGIN_WMPSUPPORT
$(ZIP_PROG) -9 -j $(DIST)/bin/$(XPIFILE) $(XPIDL_GEN_DIR)/nsWMP.xpt
endif
$(SHARED_LIBRARY) : $(DEFFILE) copy-sources
$(DEFFILE):
-rm $@
-rm -f $@
@echo "; npmozax.def : Declares the module parameters." >> $@
@echo "; This file was autogenerated by mkctldef.bat!" >> $@
@echo "" >> $@
@ -213,7 +259,6 @@ $(DEFFILE):
@echo "NP_GetEntryPoints @1" >> $@
@echo "NP_Initialize @2" >> $@
@echo "NP_Shutdown @3" >> $@
@echo "; NSGetFactory @10" >> $@
ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT
./MozAxPlugin.class: ./MozAxPlugin.java
@ -327,38 +372,5 @@ LiveConnect.cpp: StdAfx.h \
./_java/java_lang_Float.h \
./_java/java_lang_Character.h \
$(NULL)
endif
ActiveScriptSite.cpp: $(MOZCTLSRC)/ActiveScriptSite.cpp
-cp $(MOZCTLSRC)/ActiveScriptSite.cpp .
MozActiveX.res: MozActiveX.rc resource.h
MozActiveX.cpp: StdAfx.h
ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
XPConnect.cpp: StdAfx.h \
./_xpidlgen/nsIMozAxPlugin.h \
$(NULL)
endif
LegacyPlugin.cpp: StdAfx.h ./LegacyPlugin.h
ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
LegacyPlugin.cpp : ./_xpidlgen/nsIMozAxPlugin.h
endif
StdAfx.cpp : StdAfx.h
PropertyBag.cpp : $(MOZCTLSRC)/PropertyBag.cpp
-cp $(MOZCTLSRC)/PropertyBag.cpp .
ControlSite.cpp : $(MOZCTLSRC)/ControlSite.cpp
-cp $(MOZCTLSRC)/ControlSite.cpp .
ControlSiteIPFrame.cpp : $(MOZCTLSRC)/ControlSiteIPFrame.cpp
-cp $(MOZCTLSRC)/ControlSiteIPFrame.cpp .
ItemContainer.cpp : $(MOZCTLSRC)/ItemContainer.cpp
-cp $(MOZCTLSRC)/ItemContainer.cpp .

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

@ -88,14 +88,10 @@ typedef long int32;
#include "ItemContainer.h"
#include "ControlSite.h"
#include "ControlSiteIPFrame.h"
#include "ControlEventSink.h"
#include "ActiveScriptSite.h"
#include "npapi.h"
//#include "nsIFactory.h"
//#include "nsIPlugin.h"
//#include "nsIPluginInstance.h"
//#include "ActiveXPlugin.h"
//#include "ActiveXPluginInstance.h"
#include "ActiveScriptSite.h"
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

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

@ -0,0 +1,830 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Adam Lock <adamlock@netscape.com>
*
* 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "StdAfx.h"
#include <mshtml.h>
#include "XPConnect.h"
#include "LegacyPlugin.h"
#include "npapi.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsIDOMWindow.h"
#include "nsIDOMWindowInternal.h"
#include "nsIDOMLocation.h"
class HTMLDocument :
public CComObjectRootEx<CComSingleThreadModel>,
public IHTMLDocument2,
public IServiceProvider
{
public:
PluginInstanceData *mData;
HTMLDocument()
{
xpc_AddRef();
}
virtual ~HTMLDocument()
{
xpc_Release();
}
BEGIN_COM_MAP(HTMLDocument)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IHTMLDocument)
COM_INTERFACE_ENTRY(IHTMLDocument2)
COM_INTERFACE_ENTRY(IServiceProvider)
END_COM_MAP()
// IServiceProvider
virtual /* [local] */ HRESULT STDMETHODCALLTYPE QueryService(
/* [in] */ REFGUID guidService,
/* [in] */ REFIID riid,
/* [out] */ void **ppvObject)
{
return QueryInterface(riid, ppvObject);
}
// IDispatch
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(
/* [out] */ UINT *pctinfo)
{
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo **ppTInfo)
{
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID *rgDispId)
{
return E_NOTIMPL;
}
virtual /* [local] */ HRESULT STDMETHODCALLTYPE Invoke(
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS *pDispParams,
/* [out] */ VARIANT *pVarResult,
/* [out] */ EXCEPINFO *pExcepInfo,
/* [out] */ UINT *puArgErr)
{
return E_NOTIMPL;
}
// IHTMLDocument
virtual /* [nonbrowsable][hidden][id][propget] */ HRESULT STDMETHODCALLTYPE get_Script(
/* [out][retval] */ IDispatch **p)
{
return E_NOTIMPL;
}
// IHTMLDocument2
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_all(
/* [out][retval] */ IHTMLElementCollection **p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_body(
/* [out][retval] */ IHTMLElement **p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_activeElement(
/* [out][retval] */ IHTMLElement **p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_images(
/* [out][retval] */ IHTMLElementCollection **p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_applets(
/* [out][retval] */ IHTMLElementCollection **p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_links(
/* [out][retval] */ IHTMLElementCollection **p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_forms(
/* [out][retval] */ IHTMLElementCollection **p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_anchors(
/* [out][retval] */ IHTMLElementCollection **p)
{
return E_NOTIMPL;
}
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_title(
/* [in] */ BSTR v)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_title(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_scripts(
/* [out][retval] */ IHTMLElementCollection **p)
{
return E_NOTIMPL;
}
virtual /* [hidden][id][propput] */ HRESULT STDMETHODCALLTYPE put_designMode(
/* [in] */ BSTR v)
{
return E_NOTIMPL;
}
virtual /* [hidden][id][propget] */ HRESULT STDMETHODCALLTYPE get_designMode(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_selection(
/* [out][retval] */ IHTMLSelectionObject **p)
{
return E_NOTIMPL;
}
virtual /* [bindable][id][propget] */ HRESULT STDMETHODCALLTYPE get_readyState(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_frames(
/* [out][retval] */ IHTMLFramesCollection2 **p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_embeds(
/* [out][retval] */ IHTMLElementCollection **p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_plugins(
/* [out][retval] */ IHTMLElementCollection **p)
{
return E_NOTIMPL;
}
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_alinkColor(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_alinkColor(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_bgColor(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_bgColor(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_fgColor(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fgColor(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_linkColor(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_linkColor(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_vlinkColor(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_vlinkColor(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_referrer(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_location(
/* [out][retval] */ IHTMLLocation **p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_lastModified(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_URL(
/* [in] */ BSTR v)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_URL(
/* [out][retval] */ BSTR *p)
{
*p = NULL;
#if 0
nsCOMPtr<nsIDOMWindow> window;
NPN_GetValue(mData->pPluginInstance, NPNVDOMWindow, (void *) &window);
if (window)
{
nsCOMPtr<nsIDOMWindowInternal> windowInternal = do_QueryInterface(window);
if (windowInternal)
{
nsCOMPtr<nsIDOMLocation> location;
nsAutoString href;
windowInternal->GetLocation(getter_AddRefs(location));
if (location &&
NS_SUCCEEDED(location->GetHref(href)))
{
USES_CONVERSION;
*p = ::SysAllocString(href.get());
return S_OK;
}
}
}
#endif
return E_FAIL;
}
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_domain(
/* [in] */ BSTR v)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_domain(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_cookie(
/* [in] */ BSTR v)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_cookie(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [hidden][bindable][id][propput] */ HRESULT STDMETHODCALLTYPE put_expando(
/* [in] */ VARIANT_BOOL v)
{
return E_NOTIMPL;
}
virtual /* [hidden][bindable][id][propget] */ HRESULT STDMETHODCALLTYPE get_expando(
/* [out][retval] */ VARIANT_BOOL *p)
{
return E_NOTIMPL;
}
virtual /* [hidden][id][propput] */ HRESULT STDMETHODCALLTYPE put_charset(
/* [in] */ BSTR v)
{
return E_NOTIMPL;
}
virtual /* [hidden][id][propget] */ HRESULT STDMETHODCALLTYPE get_charset(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_defaultCharset(
/* [in] */ BSTR v)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_defaultCharset(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_mimeType(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fileSize(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fileCreatedDate(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fileModifiedDate(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fileUpdatedDate(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_security(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_protocol(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nameProp(
/* [out][retval] */ BSTR *p)
{
return E_NOTIMPL;
}
virtual /* [id][vararg] */ HRESULT STDMETHODCALLTYPE write(
/* [in] */ SAFEARRAY * psarray)
{
return E_NOTIMPL;
}
virtual /* [id][vararg] */ HRESULT STDMETHODCALLTYPE writeln(
/* [in] */ SAFEARRAY * psarray)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE open(
/* [in][defaultvalue] */ BSTR url,
/* [in][optional] */ VARIANT name,
/* [in][optional] */ VARIANT features,
/* [in][optional] */ VARIANT replace,
/* [out][retval] */ IDispatch **pomWindowResult)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE close( void)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE clear( void)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE queryCommandSupported(
/* [in] */ BSTR cmdID,
/* [out][retval] */ VARIANT_BOOL *pfRet)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE queryCommandEnabled(
/* [in] */ BSTR cmdID,
/* [out][retval] */ VARIANT_BOOL *pfRet)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE queryCommandState(
/* [in] */ BSTR cmdID,
/* [out][retval] */ VARIANT_BOOL *pfRet)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE queryCommandIndeterm(
/* [in] */ BSTR cmdID,
/* [out][retval] */ VARIANT_BOOL *pfRet)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE queryCommandText(
/* [in] */ BSTR cmdID,
/* [out][retval] */ BSTR *pcmdText)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE queryCommandValue(
/* [in] */ BSTR cmdID,
/* [out][retval] */ VARIANT *pcmdValue)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE execCommand(
/* [in] */ BSTR cmdID,
/* [in][defaultvalue] */ VARIANT_BOOL showUI,
/* [in][optional] */ VARIANT value,
/* [out][retval] */ VARIANT_BOOL *pfRet)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE execCommandShowHelp(
/* [in] */ BSTR cmdID,
/* [out][retval] */ VARIANT_BOOL *pfRet)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE createElement(
/* [in] */ BSTR eTag,
/* [out][retval] */ IHTMLElement **newElem)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onhelp(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onhelp(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onclick(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onclick(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_ondblclick(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_ondblclick(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onkeyup(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onkeyup(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onkeydown(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onkeydown(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onkeypress(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onkeypress(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onmouseup(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onmouseup(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onmousedown(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onmousedown(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onmousemove(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onmousemove(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onmouseout(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onmouseout(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onmouseover(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onmouseover(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onreadystatechange(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onreadystatechange(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onafterupdate(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onafterupdate(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onrowexit(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onrowexit(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onrowenter(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onrowenter(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_ondragstart(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_ondragstart(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onselectstart(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onselectstart(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE elementFromPoint(
/* [in] */ long x,
/* [in] */ long y,
/* [out][retval] */ IHTMLElement **elementHit)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_parentWindow(
/* [out][retval] */ IHTMLWindow2 **p)
{
return E_NOTIMPL;
}
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_styleSheets(
/* [out][retval] */ IHTMLStyleSheetsCollection **p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onbeforeupdate(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onbeforeupdate(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onerrorupdate(
/* [in] */ VARIANT v)
{
return E_NOTIMPL;
}
virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onerrorupdate(
/* [out][retval] */ VARIANT *p)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE toString(
/* [out][retval] */ BSTR *String)
{
return E_NOTIMPL;
}
virtual /* [id] */ HRESULT STDMETHODCALLTYPE createStyleSheet(
/* [in][defaultvalue] */ BSTR bstrHref,
/* [in][defaultvalue] */ long lIndex,
/* [out][retval] */ IHTMLStyleSheet **ppnewStyleSheet)
{
return E_NOTIMPL;
}
};
HRESULT xpc_GetServiceProvider(PluginInstanceData *pData, IServiceProvider **pSP)
{
CComObject<HTMLDocument> *pDoc = NULL;
CComObject<HTMLDocument>::CreateInstance(&pDoc);
pDoc->mData = pData;
return pDoc->QueryInterface(_uuidof(IServiceProvider), (void **) pSP);
}

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

@ -0,0 +1,570 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Adam Lock <adamlock@netscape.com>
*
* 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 NPL, 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 NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "stdafx.h"
#include "XPCMediaPlayer.h"
#include "nsString.h"
//#############################################################################
// IMPORTANT!!!!!
// I am using Windows Media Player to test how the plugin copes with arbitrary
// scriptability interfaces and to exercise the IHTMLDocument2 and IWebBrowser
// interfaces that many controls expect.
// THIS CODE ISN'T GOING STAY SO DON'T RELY ON IT!!!
//#############################################################################
const IID IID_IWMPCore =
{ 0xD84CCA99, 0xCCE2, 0x11d2, { 0x9E, 0xCC, 0x00, 0x00, 0xF8, 0x08, 0x59, 0x81 } };
/* Header file */
class nsWMPControls :
public nsIWMPControls,
public nsIClassInfoImpl<nsWMPControls>
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWMPCONTROLS
nsWMPScriptablePeer *mOwner;
HRESULT GetIWMPControls(IWMPControls **pc);
nsWMPControls(nsWMPScriptablePeer *pOwner);
virtual ~nsWMPControls();
/* additional members */
};
/* Header file */
class nsWMPSettings :
public nsIWMPSettings,
public nsIClassInfoImpl<nsWMPControls>
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWMPSETTINGS
nsWMPScriptablePeer *mOwner;
HRESULT GetIWMPSettings(IWMPSettings **ps);
nsWMPSettings(nsWMPScriptablePeer *pOwner);
virtual ~nsWMPSettings();
/* additional members */
};
nsWMPScriptablePeer::nsWMPScriptablePeer()
{
NS_INIT_ISUPPORTS();
mControls = new nsWMPControls(this);
mControls->AddRef();
mSettings = new nsWMPSettings(this);
mSettings->AddRef();
}
nsWMPScriptablePeer::~nsWMPScriptablePeer()
{
mSettings->Release();
mControls->Release();
}
NS_IMPL_ADDREF_INHERITED(nsWMPScriptablePeer, nsScriptablePeer)
NS_IMPL_RELEASE_INHERITED(nsWMPScriptablePeer, nsScriptablePeer)
NS_INTERFACE_MAP_BEGIN(nsWMPScriptablePeer)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIWMPCore, nsIWMPPlayer2)
NS_INTERFACE_MAP_ENTRY(nsIWMPPlayer2)
NS_INTERFACE_MAP_END_INHERITING(nsScriptablePeer)
HRESULT
nsWMPScriptablePeer::GetIWMPCore(IWMPCore **pwmpc)
{
*pwmpc = NULL;
CComPtr<IDispatch> disp;
HRESULT hr = GetIDispatch(&disp);
if (FAILED(hr)) return hr;
return disp->QueryInterface(IID_IWMPCore, (void **) pwmpc);
}
///////////////////////////////////////////////////////////////////////////////
// nsIWMPCore
/* attribute AString URL; */
NS_IMETHODIMP nsWMPScriptablePeer::GetURL(nsAString & aURL)
{
CComPtr<IWMPCore> wmpc;
HRESULT hr = GetIWMPCore(&wmpc);
if (FAILED(hr)) return hr;
CComBSTR bstrURL;
hr = wmpc->get_URL(&bstrURL);
if (SUCCEEDED(hr))
{
aURL.Assign(bstrURL.m_str);
}
return HR2NS(hr);
}
NS_IMETHODIMP nsWMPScriptablePeer::SetURL(const nsAString & aURL)
{
CComPtr<IWMPCore> wmpc;
HRESULT hr = GetIWMPCore(&wmpc);
if (FAILED(hr)) return hr;
nsAutoString url(aURL);
CComBSTR bstrURL(url.get());
hr = wmpc->put_URL(bstrURL);
// DEBUG
nsAutoString urlTest;
GetURL(urlTest);
nsAutoString urlBaseTest;
mSettings->GetBaseURL(urlBaseTest);
return HR2NS(hr);
}
/* readonly attribute nsIWMPControls controls; */
NS_IMETHODIMP nsWMPScriptablePeer::GetControls(nsIWMPControls * *aControls)
{
return mControls->QueryInterface(NS_GET_IID(nsIWMPControls), (void **) aControls);
}
/* readonly attribute nsIWMPSettings settings; */
NS_IMETHODIMP nsWMPScriptablePeer::GetSettings(nsIWMPSettings * *aSettings)
{
return mSettings->QueryInterface(NS_GET_IID(nsIWMPSettings), (void **) aSettings);
}
///////////////////////////////////////////////////////////////////////////////
// nsIWMPPlayer2
/* attribute boolean stretchToFit; */
NS_IMETHODIMP nsWMPScriptablePeer::GetStretchToFit(PRBool *aStretchToFit)
{
CComPtr<IWMPCore> wmpc;
HRESULT hr = GetIWMPCore(&wmpc);
if (FAILED(hr)) return hr;
CComQIPtr<IWMPPlayer2> wmpp2 = wmpc;
VARIANT_BOOL bStretchToFit = VARIANT_FALSE;
if (wmpp2)
wmpp2->get_stretchToFit(&bStretchToFit);
*aStretchToFit = (bStretchToFit == VARIANT_TRUE) ? PR_TRUE : PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP nsWMPScriptablePeer::SetStretchToFit(PRBool aStretchToFit)
{
CComPtr<IWMPCore> wmpc;
HRESULT hr = GetIWMPCore(&wmpc);
if (FAILED(hr)) return hr;
CComQIPtr<IWMPPlayer2> wmpp2 = wmpc;
if (wmpp2)
wmpp2->put_stretchToFit(aStretchToFit ? VARIANT_TRUE : VARIANT_FALSE);
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Some sanity saving macros to remove some drudgery of this work.
#define IMPL_COMMON(iface) \
CComPtr<iface> i; \
HRESULT hr = Get ## iface (&i); \
if (FAILED(hr)) return mOwner->HR2NS(hr);
#define IMPL_GETPROP_BOOL_NAMED(iface, propname, item, retval) \
IMPL_COMMON(iface) \
VARIANT_BOOL bValue = VARIANT_FALSE; \
nsAutoString strItem(item); \
CComBSTR bstrItem(strItem.get()); \
hr = i->get_ ## propname(bstrItem, &bValue); \
if (FAILED(hr)) return mOwner->HR2NS(hr); \
*(retval) = (bValue == VARIANT_TRUE) ? PR_TRUE : PR_FALSE; \
return NS_OK;
#define IMPL_SETPROP_BOOL_NAMED(iface, propname, item, retval) \
IMPL_COMMON(iface) \
VARIANT_BOOL bValue = VARIANT_FALSE; \
nsAutoString strItem(item); \
CComBSTR bstrItem(strItem.get()); \
hr = i->put_ ## propname(bstrItem, bValue); \
if (FAILED(hr)) return mOwner->HR2NS(hr); \
return NS_OK;
#define IMPL_GETPROP_BOOL(iface, propname, retval) \
IMPL_COMMON(iface) \
VARIANT_BOOL bValue = VARIANT_FALSE; \
hr = i->get_ ## propname(&bValue); \
if (FAILED(hr)) return mOwner->HR2NS(hr); \
*(retval) = (bValue == VARIANT_TRUE) ? PR_TRUE : PR_FALSE; \
return NS_OK;
#define IMPL_SETPROP_BOOL(iface, propname, value) \
IMPL_COMMON(iface) \
hr = i->put_ ## propname((value) ? VARIANT_TRUE : VARIANT_FALSE); \
if (FAILED(hr)) return mOwner->HR2NS(hr); \
return NS_OK;
#define IMPL_GETPROP_NUM(iface, propname, nstype, oletype, retval) \
IMPL_COMMON(iface) \
oletype nValue = 0; \
hr = i->get_ ## propname(&nValue); \
if (FAILED(hr)) return mOwner->HR2NS(hr); \
*(retval) = (nstype) nValue; \
return NS_OK;
#define IMPL_SETPROP_NUM(iface, propname, nstype, oletype, value) \
IMPL_COMMON(iface) \
hr = i->put_ ## propname((oletype)(value)); \
if (FAILED(hr)) return mOwner->HR2NS(hr); \
return NS_OK;
#define IMPL_GETPROP_DOUBLE(iface, propname, retval) \
IMPL_GETPROP_NUM(iface, propname, double, double, retval)
#define IMPL_SETPROP_DOUBLE(iface, propname, retval) \
IMPL_SETPROP_NUM(iface, propname, double, double, retval)
#define IMPL_GETPROP_LONG(iface, propname, retval) \
IMPL_GETPROP_NUM(iface, propname, PRInt32, long, retval)
#define IMPL_SETPROP_LONG(iface, propname, retval) \
IMPL_SETPROP_NUM(iface, propname, PRInt32, long, retval)
#define IMPL_GETPROP_BSTR(iface, propname, retval) \
IMPL_COMMON(iface) \
CComBSTR bstrVal; \
hr = i->get_ ## propname(&bstrVal); \
if (FAILED(hr)) return mOwner->HR2NS(hr); \
retval.Assign(bstrVal.m_str); \
return NS_OK;
#define IMPL_SETPROP_BSTR(iface, propname, value) \
IMPL_COMMON(iface) \
nsAutoString val(value); \
CComBSTR bstrVal(val.get()); \
hr = i->put_ ## propname (bstrVal); \
if (FAILED(hr)) return mOwner->HR2NS(hr); \
return NS_OK;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/* Implementation file */
NS_IMPL_ISUPPORTS2(nsWMPControls, nsIWMPControls, nsIClassInfo)
nsWMPControls::nsWMPControls(nsWMPScriptablePeer *pOwner) :
mOwner(pOwner)
{
NS_INIT_ISUPPORTS();
/* member initializers and constructor code */
}
nsWMPControls::~nsWMPControls()
{
/* destructor code */
}
HRESULT
nsWMPControls::GetIWMPControls(IWMPControls **pc)
{
*pc = NULL;
CComPtr<IWMPCore> wmpc;
HRESULT hr = mOwner->GetIWMPCore(&wmpc);
if (FAILED(hr)) return hr;
return wmpc->get_controls(pc);
}
///////////////////////////////////////////////////////////////////////////////
// nsIWMPControls
/* boolean isAvailable (in AString item); */
NS_IMETHODIMP nsWMPControls::IsAvailable(const nsAString &aItem, PRBool *_retval)
{
IMPL_GETPROP_BOOL_NAMED(IWMPControls, isAvailable, aItem, _retval);
}
/* void play (); */
NS_IMETHODIMP nsWMPControls::Play()
{
IMPL_COMMON(IWMPControls);
return mOwner->HR2NS(i->play());
}
/* void stop (); */
NS_IMETHODIMP nsWMPControls::Stop()
{
IMPL_COMMON(IWMPControls);
return mOwner->HR2NS(i->stop());
}
/* void pause (); */
NS_IMETHODIMP nsWMPControls::Pause()
{
IMPL_COMMON(IWMPControls);
return mOwner->HR2NS(i->pause());
}
/* void fastForward (); */
NS_IMETHODIMP nsWMPControls::FastForward()
{
IMPL_COMMON(IWMPControls);
return mOwner->HR2NS(i->fastForward());
}
/* void fastReverse (); */
NS_IMETHODIMP nsWMPControls::FastReverse()
{
IMPL_COMMON(IWMPControls);
return mOwner->HR2NS(i->fastReverse());
}
/* attribute double currentPosition; */
NS_IMETHODIMP nsWMPControls::GetCurrentPosition(double *aCurrentPosition)
{
IMPL_GETPROP_DOUBLE(IWMPControls, currentPosition, aCurrentPosition);
}
NS_IMETHODIMP nsWMPControls::SetCurrentPosition(double aCurrentPosition)
{
IMPL_SETPROP_DOUBLE(IWMPControls, currentPosition, aCurrentPosition);
}
/* readonly attribute AString currentPositionString; */
NS_IMETHODIMP nsWMPControls::GetCurrentPositionString(nsAString &aCurrentPositionString)
{
IMPL_GETPROP_BSTR(IWMPControls, currentPositionString, aCurrentPositionString);
}
/* void next (); */
NS_IMETHODIMP nsWMPControls::Next()
{
IMPL_COMMON(IWMPControls);
return mOwner->HR2NS(i->next());
}
/* void previous (); */
NS_IMETHODIMP nsWMPControls::Previous()
{
IMPL_COMMON(IWMPControls);
return mOwner->HR2NS(i->previous());
}
/* attribute nsIWMPMedia currentItem; */
NS_IMETHODIMP nsWMPControls::GetCurrentItem(nsIWMPMedia * *aCurrentItem)
{
IMPL_COMMON(IWMPControls);
// TODO
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsWMPControls::SetCurrentItem(nsIWMPMedia * aCurrentItem)
{
IMPL_COMMON(IWMPControls);
// TODO
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute long currentMarker; */
NS_IMETHODIMP nsWMPControls::GetCurrentMarker(PRInt32 *aCurrentMarker)
{
IMPL_GETPROP_LONG(IWMPControls, currentMarker, aCurrentMarker);
}
NS_IMETHODIMP nsWMPControls::SetCurrentMarker(PRInt32 aCurrentMarker)
{
IMPL_SETPROP_LONG(IWMPControls, currentMarker, aCurrentMarker);
}
/* void playItem (in nsIWMPMedia aItem); */
NS_IMETHODIMP nsWMPControls::PlayItem(nsIWMPMedia *aItem)
{
IMPL_COMMON(IWMPControls);
// TODO
return NS_ERROR_NOT_IMPLEMENTED;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/* Implementation file */
NS_IMPL_ISUPPORTS2(nsWMPSettings, nsIWMPSettings, nsIClassInfo)
nsWMPSettings::nsWMPSettings(nsWMPScriptablePeer *pOwner) :
mOwner(pOwner)
{
NS_INIT_ISUPPORTS();
/* member initializers and constructor code */
}
nsWMPSettings::~nsWMPSettings()
{
/* destructor code */
}
HRESULT
nsWMPSettings::GetIWMPSettings(IWMPSettings **ps)
{
*ps = NULL;
CComPtr<IWMPCore> wmpc;
HRESULT hr = mOwner->GetIWMPCore(&wmpc);
if (FAILED(hr)) return hr;
return wmpc->get_settings(ps);
}
///////////////////////////////////////////////////////////////////////////////
// nsIWMPControls
/* boolean isAvailable (in AString aItem); */
NS_IMETHODIMP nsWMPSettings::IsAvailable(const nsAString & aItem, PRBool *_retval)
{
IMPL_GETPROP_BOOL_NAMED(IWMPSettings, isAvailable, aItem, _retval);
}
/* attribute boolean autoStart; */
NS_IMETHODIMP nsWMPSettings::GetAutoStart(PRBool *aAutoStart)
{
IMPL_GETPROP_BOOL(IWMPSettings, autoStart, aAutoStart);
}
NS_IMETHODIMP nsWMPSettings::SetAutoStart(PRBool aAutoStart)
{
IMPL_SETPROP_BOOL(IWMPSettings, autoStart, aAutoStart);
}
/* attribute AString baseURL; */
NS_IMETHODIMP nsWMPSettings::GetBaseURL(nsAString & aBaseURL)
{
IMPL_GETPROP_BSTR(IWMPSettings, baseURL, aBaseURL);
}
NS_IMETHODIMP nsWMPSettings::SetBaseURL(const nsAString & aBaseURL)
{
IMPL_SETPROP_BSTR(IWMPSettings, baseURL, aBaseURL);
}
/* attribute AString defaultFrame; */
NS_IMETHODIMP nsWMPSettings::GetDefaultFrame(nsAString & aDefaultFrame)
{
IMPL_GETPROP_BSTR(IWMPSettings, defaultFrame, aDefaultFrame);
}
NS_IMETHODIMP nsWMPSettings::SetDefaultFrame(const nsAString & aDefaultFrame)
{
IMPL_SETPROP_BSTR(IWMPSettings, defaultFrame, aDefaultFrame);
}
/* attribute boolean invokeURLs; */
NS_IMETHODIMP nsWMPSettings::GetInvokeURLs(PRBool *aInvokeURLs)
{
IMPL_GETPROP_BOOL(IWMPSettings, invokeURLs, aInvokeURLs);
}
NS_IMETHODIMP nsWMPSettings::SetInvokeURLs(PRBool aInvokeURLs)
{
IMPL_SETPROP_BOOL(IWMPSettings, invokeURLs, aInvokeURLs);
}
/* attribute boolean mute; */
NS_IMETHODIMP nsWMPSettings::GetMute(PRBool *aMute)
{
IMPL_GETPROP_BOOL(IWMPSettings, mute, aMute);
}
NS_IMETHODIMP nsWMPSettings::SetMute(PRBool aMute)
{
IMPL_SETPROP_BOOL(IWMPSettings, mute, aMute);
}
/* attribute long playCount; */
NS_IMETHODIMP nsWMPSettings::GetPlayCount(PRInt32 *aPlayCount)
{
IMPL_GETPROP_LONG(IWMPSettings, playCount, aPlayCount);
}
NS_IMETHODIMP nsWMPSettings::SetPlayCount(PRInt32 aPlayCount)
{
IMPL_SETPROP_LONG(IWMPSettings, playCount, aPlayCount);
}
/* attribute double rate; */
NS_IMETHODIMP nsWMPSettings::GetRate(double *aRate)
{
IMPL_GETPROP_DOUBLE(IWMPSettings, rate, aRate);
}
NS_IMETHODIMP nsWMPSettings::SetRate(double aRate)
{
IMPL_SETPROP_DOUBLE(IWMPSettings, rate, aRate);
}
/* attribute long balance; */
NS_IMETHODIMP nsWMPSettings::GetBalance(PRInt32 *aBalance)
{
IMPL_GETPROP_LONG(IWMPSettings, balance, aBalance);
}
NS_IMETHODIMP nsWMPSettings::SetBalance(PRInt32 aBalance)
{
IMPL_SETPROP_LONG(IWMPSettings, balance, aBalance);
}
/* attribute long volume; */
NS_IMETHODIMP nsWMPSettings::GetVolume(PRInt32 *aVolume)
{
IMPL_GETPROP_LONG(IWMPSettings, volume, aVolume);
}
NS_IMETHODIMP nsWMPSettings::SetVolume(PRInt32 aVolume)
{
IMPL_SETPROP_LONG(IWMPSettings, volume, aVolume);
}
/* boolean getMode (in AString aMode); */
NS_IMETHODIMP nsWMPSettings::GetMode(const nsAString & aMode, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setMode (in AString aMode, in boolean aValue); */
NS_IMETHODIMP nsWMPSettings::SetMode(const nsAString & aMode, PRBool aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute boolean enableErrorDialogs; */
NS_IMETHODIMP nsWMPSettings::GetEnableErrorDialogs(PRBool *aEnableErrorDialogs)
{
IMPL_GETPROP_BOOL(IWMPSettings, enableErrorDialogs, aEnableErrorDialogs);
}
NS_IMETHODIMP nsWMPSettings::SetEnableErrorDialogs(PRBool aEnableErrorDialogs)
{
IMPL_SETPROP_BOOL(IWMPSettings, enableErrorDialogs, aEnableErrorDialogs);
}

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

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

@ -51,26 +51,26 @@
#include "LegacyPlugin.h"
#include "XPConnect.h"
// TODO remove me
#ifdef MOZ_ACTIVEX_PLUGIN_WMPSUPPORT
#include "XPCMediaPlayer.h"
#endif
static NS_DEFINE_IID(kIClassInfoIID, NS_ICLASSINFO_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static PRUint32 gInstances = 0;
///////////////////////////////////////////////////////////////////////////////
// nsScriptablePeer
nsScriptablePeer::nsScriptablePeer()
{
NS_INIT_ISUPPORTS();
if (gInstances == 0)
XPCOMGlueStartup(nsnull);
gInstances++;
xpc_AddRef();
}
nsScriptablePeer::~nsScriptablePeer()
{
if (--gInstances == 0)
XPCOMGlueShutdown();
xpc_Release();
}
NS_IMPL_ADDREF(nsScriptablePeer)
@ -428,56 +428,6 @@ nsScriptablePeer::InternalInvoke(const char *aMethod, unsigned int aNumArgs, nsI
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////
// nsISupports
// We must implement nsIClassInfo because it signals the
// Mozilla Security Manager to allow calls from JavaScript.
NS_IMETHODIMP nsScriptablePeer::GetFlags(PRUint32 *aFlags)
{
*aFlags = nsIClassInfo::PLUGIN_OBJECT | nsIClassInfo::DOM_OBJECT;
return NS_OK;
}
NS_IMETHODIMP nsScriptablePeer::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
return NS_OK;
}
// The rest of the methods can safely return error codes...
NS_IMETHODIMP nsScriptablePeer::GetInterfaces(PRUint32 *count, nsIID * **array)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsScriptablePeer::GetHelperForLanguage(PRUint32 language, nsISupports **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsScriptablePeer::GetContractID(char * *aContractID)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsScriptablePeer::GetClassDescription(char * *aClassDescription)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsScriptablePeer::GetClassID(nsCID * *aClassID)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsScriptablePeer::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
///////////////////////////////////////////////////////////////////////////////
// nsDefaultScriptablePeer
// Defines to be used as interface names by nsDefaultScriptablePeer
///////////////////////////////////////////////////////////////////////////////
// nsIMozAxPlugin
@ -614,21 +564,90 @@ nsScriptablePeer::SetProperty(const char *propertyName, nsIVariant *propertyValu
}
///////////////////////////////////////////////////////////////////////////////
// Some public methods
static nsScriptablePeer *
GetPeerForCLSID(const CLSID &clsid)
static PRUint32 gInstances = 0;
void xpc_AddRef()
{
if (gInstances == 0)
XPCOMGlueStartup(nsnull);
gInstances++;
}
void xpc_Release()
{
if (--gInstances == 0)
XPCOMGlueShutdown();
}
// TODO remove me
#ifdef MOZ_ACTIVEX_PLUGIN_WMPSUPPORT
const CLSID kWindowsMediaPlayer = {
0x6BF52A52, 0x394A, 0x11d3, { 0xB1, 0x53, 0x00, 0xC0, 0x4F, 0x79, 0xFA, 0xA6 } };
#endif
CLSID xpc_GetCLSIDForType(const char *mimeType)
{
if (mimeType == NULL)
{
return CLSID_NULL;
}
// Read the registry to see if there is a CLSID for an object to be associated with
// this MIME type.
USES_CONVERSION;
CRegKey keyMimeDB;
if (keyMimeDB.Open(HKEY_CLASSES_ROOT, _T("MIME\\Database\\Content Type"), KEY_READ) == ERROR_SUCCESS)
{
CRegKey keyMimeType;
if (keyMimeType.Open(keyMimeDB, A2CT(mimeType), KEY_READ) == ERROR_SUCCESS)
{
USES_CONVERSION;
TCHAR szGUID[64];
ULONG nCount = 64;
LONG lRes;
GUID guidValue = GUID_NULL;
if (keyMimeType.QueryValue(_T("CLSID"), szGUID, &nCount) == ERROR_SUCCESS &&
SUCCEEDED(::CLSIDFromString(T2OLE(szGUID), &guidValue)))
{
return guidValue;
}
}
}
return CLSID_NULL;
}
nsScriptablePeer *
xpc_GetPeerForCLSID(const CLSID &clsid)
{
// TODO remove me
#ifdef MOZ_ACTIVEX_PLUGIN_WMPSUPPORT
if (::IsEqualCLSID(clsid, kWindowsMediaPlayer))
{
return new nsWMPScriptablePeer();
}
#endif
return new nsScriptablePeer();
}
static nsIID
GetIIDForCLSID(const CLSID &clsid)
nsIID
xpc_GetIIDForCLSID(const CLSID &clsid)
{
// TODO remove me
#ifdef MOZ_ACTIVEX_PLUGIN_WMPSUPPORT
if (::IsEqualCLSID(clsid, kWindowsMediaPlayer))
{
return NS_GET_IID(nsIWMPPlayer2);
}
#endif
return NS_GET_IID(nsIMozAxPlugin);
}
// Called by NPP_GetValue to provide the scripting values
NPError
xpconnect_getvalue(NPP instance, NPPVariable variable, void *value)
xpc_GetValue(NPP instance, NPPVariable variable, void *value)
{
if (instance == NULL)
{
@ -647,7 +666,7 @@ xpconnect_getvalue(NPP instance, NPPVariable variable, void *value)
{
if (!pData->pScriptingPeer)
{
nsScriptablePeer *peer = GetPeerForCLSID(pData->clsid);
nsScriptablePeer *peer = xpc_GetPeerForCLSID(pData->clsid);
peer->AddRef();
pData->pScriptingPeer = (nsIMozAxPlugin *) peer;
peer->mPlugin = pData;
@ -662,7 +681,7 @@ xpconnect_getvalue(NPP instance, NPPVariable variable, void *value)
else if (variable == kVarScriptableIID)
{
nsIID *piid = (nsIID *) NPN_MemAlloc(sizeof(nsIID));
*piid = GetIIDForCLSID(pData->clsid);
*piid = xpc_GetIIDForCLSID(pData->clsid);
*((nsIID **) value) = piid;
return NPERR_NO_ERROR;
}

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

@ -39,13 +39,42 @@
#ifndef XPCONNECT_H
#define XPCONNECT_H
#include <servprov.h>
#include "nsIClassInfo.h"
#include "nsIMozAxPlugin.h"
#include "LegacyPlugin.h"
template <class T> class nsIClassInfoImpl : public nsIClassInfo
{
NS_IMETHODIMP GetFlags(PRUint32 *aFlags)
{
*aFlags = nsIClassInfo::PLUGIN_OBJECT | nsIClassInfo::DOM_OBJECT;
return NS_OK;
}
NS_IMETHODIMP GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
return NS_OK;
}
// The rest of the methods can safely return error codes...
NS_IMETHODIMP GetInterfaces(PRUint32 *count, nsIID * **array)
{ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP GetHelperForLanguage(PRUint32 language, nsISupports **_retval)
{ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP GetContractID(char * *aContractID)
{ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP GetClassDescription(char * *aClassDescription)
{ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP GetClassID(nsCID * *aClassID)
{ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
{ return NS_ERROR_NOT_IMPLEMENTED; }
};
class nsScriptablePeer :
public nsIClassInfo,
public nsIClassInfoImpl<nsScriptablePeer>,
public nsIMozAxPlugin
{
protected:
@ -57,7 +86,6 @@ public:
PluginInstanceData* mPlugin;
NS_DECL_ISUPPORTS
NS_DECL_NSICLASSINFO
NS_DECL_NSIMOZAXPLUGIN
protected:
@ -68,4 +96,12 @@ protected:
NS_IMETHOD InternalInvoke(const char *aMethod, unsigned int aNumArgs, nsIVariant *aArgs[]);
};
extern void xpc_AddRef();
extern void xpc_Release();
extern CLSID xpc_GetCLSIDForType(const char *mimeType);
extern NPError xpc_GetValue(NPP instance, NPPVariable variable, void *value);
extern nsScriptablePeer *xpc_GetPeerForCLSID(const CLSID &clsid);
extern nsIID xpc_GetIIDForCLSID(const CLSID &clsid);
extern HRESULT xpc_GetServiceProvider(PluginInstanceData *pData, IServiceProvider **pSP);
#endif

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

@ -323,3 +323,7 @@ jref NPN_GetJavaPeer(NPP instance)
return g_pNavigatorFuncs->getJavaPeer(instance);
}
NPError NPN_GetValue(NPP instance, NPNVariable variable, void *result)
{
return g_pNavigatorFuncs->getvalue(instance, variable, result);
}

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

@ -0,0 +1,241 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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 Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Adam Lock <adamlock@netscape.com>
*/
#include "nsISupports.idl"
#include "nsIMozAxPlugin.idl"
[scriptable, uuid(94D55E95-3FAC-11d3-B155-00C04F79FAA6)]
interface nsIWMPMedia : nsISupports
{
/** Determines if the supplied object is the same as the this one */
boolean isIdentical(in nsIWMPMedia aIn);
/** Returns the media URL */
readonly attribute AString sourceURL;
/** Returns or sets the name of the media */
attribute AString name;
/** Returns the original width of the source images */
readonly attribute long width;
/** Returns the original height of the source images */
readonly attribute long height;
/** Returns the number of markers in the file */
readonly attribute long markerCount;
/** Returns the time of a marker */
double markerTime(in long aMarkerNum);
/** Returns the name of a marker */
AString markerName(in long aMarkerNum);
/** Returns duration of current media */
readonly attribute double duration;
/** Returns duration of current media as a string */
readonly attribute AString durationString;
/** Returns the count of the attributes associated with this media */
readonly attribute long attributeCount;
/** Returns the name of the attribute whose index has been specified */
AString getAttributeName(in long aIndex);
/** Returns the value of specified attribute for this media */
AString getItemInfo(in AString aItemName);
/** Sets the value of specified attribute for this media */
void setItemInfo(in AString aItemName, in AString aValue);
/** Gets an item info by atom */
AString getItemInfoByAtom(in long aAtom);
/*
[
id( DISPID_WMPMEDIA_ISMEMBEROF ), helpstring( "Is the media a member of the given playlist" ) ]
HRESULT isMemberOf( [in] IWMPPlaylist* pPlaylist, [out, retval] VARIANT_BOOL* pvarfIsMemberOf );
*/
/** Is the attribute read only */
boolean isReadOnlyItem(in AString aItemName);
};
[scriptable, uuid(74C09E02-F828-11d2-A74B-00A0C905F36E)]
interface nsIWMPControls : nsISupports
{
/** Returns whether or not the specified media functionality is available */
boolean isAvailable(in AString aItem);
/** Begins playing media */
void play();
/** Stops play of media */
void stop();
/** Pauses play of media */
void pause();
/** Fast play of media in forward direction */
void fastForward();
/** Fast play of media in reverse direction */
void fastReverse();
/** Returns or sets the current position in media */
attribute double currentPosition;
/** Returns the current position in media as a string */
readonly attribute AString currentPositionString;
/** Sets the current item to the next item in the playlist */
void next();
/** Sets the current item to the previous item in the playlist */
void previous();
/** Returns/Sets the play item */
attribute nsIWMPMedia currentItem;
/** Returns or sets the current marker */
attribute long currentMarker;
/** Sets the current item and plays it */
void playItem(in nsIWMPMedia aItem);
};
[scriptable, uuid(9104D1AB-80C9-4fed-ABF0-2E6417A6DF14)]
interface nsIWMPSettings : nsISupports
{
/** Returns whether or not the specified media functionality is available */
boolean isAvailable(in AString aItem);
/** Returns or sets whether media should automatically begin playing */
attribute boolean autoStart;
/** Returns or sets the base URL used for relative path resolution */
attribute AString baseURL;
/** Returns or sets the frame location that changes when a URL flip occurs */
attribute AString defaultFrame;
/** Returns or sets whether URL events should spawn a browser */
attribute boolean invokeURLs;
/** Returns or sets whether audio should be muted */
attribute boolean mute;
/** Returns or sets how many times media should play */
attribute long playCount;
/** Returns or sets current playback rate*/
attribute double rate;
/** Returns or sets current audio balance */
attribute long balance;
/** Returns or sets current audio volume */
attribute long volume;
/** Returns the mode of the playlist */
boolean getMode(in AString aMode);
/** Sets the mode of the playlist */
void setMode(in AString aMode, in boolean aValue);
/** Returns or sets whether error dialogs are shown by default when embedded */
attribute boolean enableErrorDialogs;
};
[scriptable, uuid(D84CCA99-CCE2-11d2-9ECC-0000F8085981)]
interface nsIWMPCore : nsISupports
{
/** Returns or sets the URL */
attribute AString URL;
// openState
// playState
/** Returns the control handler */
readonly attribute nsIWMPControls controls;
/** Returns the settings handler */
readonly attribute nsIWMPSettings settings;
// currentMedia
// mediaCollection
// playlistCollection
// versionInfo
// launchURL
// network
// currentPlaylist
// cdromCollection
// closedCaption
/*
readonly attribute isOnline;
[ id(DISPID_WMPCORE_ISONLINE), propget, helpstring( "Returns whether the machine is online." ) ]
HRESULT isOnline( [out, retval] VARIANT_BOOL *pfOnline );
readonly attribute IWMPError error;
[ id(DISPID_WMPCORE_ERROR), propget, helpstring("Returns the error object")]
HRESULT error([out, retval] IWMPError **ppError);
readonly attribute AString status;
[ id(DISPID_WMPCORE_STATUS), propget, helpstring("Returns status string")]
HRESULT status([out, retval] BSTR *pbstrStatus);
*/
};
[scriptable, uuid(0E6B01D1-D407-4c85-BF5F-1C01F6150280)]
interface nsIWMPPlayer2 : nsIWMPCore
{
/*
[ id(DISPID_WMPOCX_ENABLED), propget, helpstring("Returns a boolen value specifying whether or not the control is enabled")]
HRESULT enabled([out, retval] VARIANT_BOOL *pbEnabled);
[ id(DISPID_WMPOCX_ENABLED), propput, helpstring("Sets a boolean value specifying whether or not the control is enabled")]
HRESULT enabled([in] VARIANT_BOOL bEnabled);
[ id(DISPID_WMPOCX_FULLSCREEN), propget, helpstring("Returns a boolean value specifying whether or not the control is in full screen mode")]
HRESULT fullScreen([out, retval] VARIANT_BOOL *pbFullScreen);
[ id(DISPID_WMPOCX_FULLSCREEN), propput, helpstring("Sets a boolean value specifying whether or not the control is in full screen mode")]
HRESULT fullScreen(VARIANT_BOOL bFullScreen);
[ id(DISPID_WMPOCX_ENABLECONTEXTMENU), propget, helpstring("Returns a boolean value specifying whether or not the context menu is enabled on the control")]
HRESULT enableContextMenu([out, retval] VARIANT_BOOL *pbEnableContextMenu);
[ id(DISPID_WMPOCX_ENABLECONTEXTMENU), propput, helpstring("Sets a boolean value specifying whether or not the context menu is enabled on the control")]
HRESULT enableContextMenu(VARIANT_BOOL bEnableContextMenu);
[ id(DISPID_WMPOCX_UIMODE), propput, helpstring("Specifies the ui mode to select")]
HRESULT uiMode([in] BSTR bstrMode);
[ id(DISPID_WMPOCX_UIMODE), propget, helpstring("Returns the currently selected ui mode")]
HRESULT uiMode([out, retval] BSTR *pbstrMode);
[ id(DISPID_WMPOCX2_STRETCHTOFIT), propget, helpstring("Returns a boolen value specifying whether or not video is stretched")]
HRESULT stretchToFit([out, retval] VARIANT_BOOL *pbEnabled);
[ id(DISPID_WMPOCX2_STRETCHTOFIT), propput, helpstring("Sets a boolean value specifying whether or not video is stretched")]
HRESULT stretchToFit([in] VARIANT_BOOL bEnabled);
[ id(DISPID_WMPOCX2_WINDOWLESSVIDEO), propget, helpstring("Returns a boolen value specifying whether or not video is windowless")]
HRESULT windowlessVideo([out, retval] VARIANT_BOOL *pbEnabled);
[ id(DISPID_WMPOCX2_WINDOWLESSVIDEO), propput, helpstring("Sets a boolean value specifying whether or not video is windowless")]
HRESULT windowlessVideo([in] VARIANT_BOOL bEnabled);
*/
/** Returns or sets whether or not video is stretched */
attribute boolean stretchToFit;
};