91 lines
2.9 KiB
C++
91 lines
2.9 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
*
|
|
* 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 Netscape are
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
* Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
*/
|
|
|
|
// ==============================
|
|
// ! Scriptability related code !
|
|
// ==============================
|
|
//
|
|
// nsScriptablePeer - xpconnect scriptable peer
|
|
//
|
|
|
|
#ifndef __nsScriptablePeer_h__
|
|
#define __nsScriptablePeer_h__
|
|
|
|
#include "nsI4xScriptablePlugin.h"
|
|
#include "nsIClassInfo.h"
|
|
|
|
class CPlugin;
|
|
|
|
// We must implement nsIClassInfo because it signals the
|
|
// Mozilla Security Manager to allow calls from JavaScript.
|
|
|
|
class nsClassInfoMixin : public nsIClassInfo
|
|
{
|
|
// These flags are used by the DOM and security systems to signal that
|
|
// JavaScript callers are allowed to call this object's scritable methods.
|
|
NS_IMETHOD GetFlags(PRUint32 *aFlags)
|
|
{*aFlags = nsIClassInfo::PLUGIN_OBJECT | nsIClassInfo::DOM_OBJECT;
|
|
return NS_OK;}
|
|
NS_IMETHOD GetImplementationLanguage(PRUint32 *aImplementationLanguage)
|
|
{*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
|
|
return NS_OK;}
|
|
// The rest of the methods can safely return error codes...
|
|
NS_IMETHOD GetInterfaces(PRUint32 *count, nsIID * **array)
|
|
{return NS_ERROR_NOT_IMPLEMENTED;}
|
|
NS_IMETHOD GetHelperForLanguage(PRUint32 language, nsISupports **_retval)
|
|
{return NS_ERROR_NOT_IMPLEMENTED;}
|
|
NS_IMETHOD GetContractID(char * *aContractID)
|
|
{return NS_ERROR_NOT_IMPLEMENTED;}
|
|
NS_IMETHOD GetClassDescription(char * *aClassDescription)
|
|
{return NS_ERROR_NOT_IMPLEMENTED;}
|
|
NS_IMETHOD GetClassID(nsCID * *aClassID)
|
|
{return NS_ERROR_NOT_IMPLEMENTED;}
|
|
NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
|
|
{return NS_ERROR_NOT_IMPLEMENTED;}
|
|
};
|
|
|
|
class nsScriptablePeer : public nsI4xScriptablePlugin,
|
|
public nsClassInfoMixin
|
|
{
|
|
public:
|
|
nsScriptablePeer(CPlugin* plugin);
|
|
~nsScriptablePeer();
|
|
|
|
public:
|
|
// methods from nsISupports
|
|
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
|
NS_IMETHOD_(nsrefcnt) AddRef();
|
|
NS_IMETHOD_(nsrefcnt) Release();
|
|
|
|
protected:
|
|
nsrefcnt mRefCnt;
|
|
|
|
public:
|
|
// native methods callable from JavaScript
|
|
NS_IMETHOD ShowVersion();
|
|
NS_IMETHOD Clear();
|
|
|
|
protected:
|
|
CPlugin* mPlugin;
|
|
};
|
|
|
|
#endif |