regenerated from Navigator.idl

This commit is contained in:
beard%netscape.com 1999-04-15 21:54:14 +00:00
parent c64d820259
commit 7daa4e4e7c
2 changed files with 81 additions and 38 deletions

View File

@ -24,6 +24,8 @@
#include "nsString.h"
#include "nsIScriptContext.h"
class nsIDOMPluginArray;
class nsIDOMMimeTypeArray;
#define NS_IDOMNAVIGATOR_IID \
{ 0xa6cf906e, 0x15b3, 0x11d2, \
@ -33,44 +35,52 @@ class nsIDOMNavigator : public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMNAVIGATOR_IID; return iid; }
NS_IMETHOD GetUserAgent(nsString& aUserAgent)=0;
NS_IMETHOD GetAppCodeName(nsString& aAppCodeName)=0;
NS_IMETHOD GetAppVersion(nsString& aAppVersion)=0;
NS_IMETHOD GetAppName(nsString& aAppName)=0;
NS_IMETHOD GetAppVersion(nsString& aAppVersion)=0;
NS_IMETHOD GetLanguage(nsString& aLanguage)=0;
NS_IMETHOD GetMimeTypes(nsIDOMMimeTypeArray** aMimeTypes)=0;
NS_IMETHOD GetPlatform(nsString& aPlatform)=0;
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins)=0;
NS_IMETHOD GetSecurityPolicy(nsString& aSecurityPolicy)=0;
NS_IMETHOD GetUserAgent(nsString& aUserAgent)=0;
NS_IMETHOD JavaEnabled(PRBool* aReturn)=0;
};
#define NS_DECL_IDOMNAVIGATOR \
NS_IMETHOD GetUserAgent(nsString& aUserAgent); \
NS_IMETHOD GetAppCodeName(nsString& aAppCodeName); \
NS_IMETHOD GetAppVersion(nsString& aAppVersion); \
NS_IMETHOD GetAppName(nsString& aAppName); \
NS_IMETHOD GetAppVersion(nsString& aAppVersion); \
NS_IMETHOD GetLanguage(nsString& aLanguage); \
NS_IMETHOD GetMimeTypes(nsIDOMMimeTypeArray** aMimeTypes); \
NS_IMETHOD GetPlatform(nsString& aPlatform); \
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins); \
NS_IMETHOD GetSecurityPolicy(nsString& aSecurityPolicy); \
NS_IMETHOD GetUserAgent(nsString& aUserAgent); \
NS_IMETHOD JavaEnabled(PRBool* aReturn); \
#define NS_FORWARD_IDOMNAVIGATOR(_to) \
NS_IMETHOD GetUserAgent(nsString& aUserAgent) { return _to##GetUserAgent(aUserAgent); } \
NS_IMETHOD GetAppCodeName(nsString& aAppCodeName) { return _to##GetAppCodeName(aAppCodeName); } \
NS_IMETHOD GetAppVersion(nsString& aAppVersion) { return _to##GetAppVersion(aAppVersion); } \
NS_IMETHOD GetAppName(nsString& aAppName) { return _to##GetAppName(aAppName); } \
NS_IMETHOD GetAppVersion(nsString& aAppVersion) { return _to##GetAppVersion(aAppVersion); } \
NS_IMETHOD GetLanguage(nsString& aLanguage) { return _to##GetLanguage(aLanguage); } \
NS_IMETHOD GetMimeTypes(nsIDOMMimeTypeArray** aMimeTypes) { return _to##GetMimeTypes(aMimeTypes); } \
NS_IMETHOD GetPlatform(nsString& aPlatform) { return _to##GetPlatform(aPlatform); } \
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins) { return _to##GetPlugins(aPlugins); } \
NS_IMETHOD GetSecurityPolicy(nsString& aSecurityPolicy) { return _to##GetSecurityPolicy(aSecurityPolicy); } \
NS_IMETHOD GetUserAgent(nsString& aUserAgent) { return _to##GetUserAgent(aUserAgent); } \
NS_IMETHOD JavaEnabled(PRBool* aReturn) { return _to##JavaEnabled(aReturn); } \

View File

@ -27,26 +27,33 @@
#include "nsIPtr.h"
#include "nsString.h"
#include "nsIDOMNavigator.h"
#include "nsIDOMPluginArray.h"
#include "nsIDOMMimeTypeArray.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kINavigatorIID, NS_IDOMNAVIGATOR_IID);
static NS_DEFINE_IID(kIPluginArrayIID, NS_IDOMPLUGINARRAY_IID);
static NS_DEFINE_IID(kIMimeTypeArrayIID, NS_IDOMMIMETYPEARRAY_IID);
NS_DEF_PTR(nsIDOMNavigator);
NS_DEF_PTR(nsIDOMPluginArray);
NS_DEF_PTR(nsIDOMMimeTypeArray);
//
// Navigator property ids
//
enum Navigator_slots {
NAVIGATOR_USERAGENT = -1,
NAVIGATOR_APPCODENAME = -2,
NAVIGATOR_APPCODENAME = -1,
NAVIGATOR_APPNAME = -2,
NAVIGATOR_APPVERSION = -3,
NAVIGATOR_APPNAME = -4,
NAVIGATOR_LANGUAGE = -5,
NAVIGATOR_LANGUAGE = -4,
NAVIGATOR_MIMETYPES = -5,
NAVIGATOR_PLATFORM = -6,
NAVIGATOR_SECURITYPOLICY = -7
NAVIGATOR_PLUGINS = -7,
NAVIGATOR_SECURITYPOLICY = -8,
NAVIGATOR_USERAGENT = -9
};
/***********************************************************************/
@ -65,17 +72,6 @@ GetNavigatorProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) {
switch(JSVAL_TO_INT(id)) {
case NAVIGATOR_USERAGENT:
{
nsAutoString prop;
if (NS_OK == a->GetUserAgent(prop)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case NAVIGATOR_APPCODENAME:
{
nsAutoString prop;
@ -87,17 +83,6 @@ GetNavigatorProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case NAVIGATOR_APPVERSION:
{
nsAutoString prop;
if (NS_OK == a->GetAppVersion(prop)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case NAVIGATOR_APPNAME:
{
nsAutoString prop;
@ -109,6 +94,17 @@ GetNavigatorProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case NAVIGATOR_APPVERSION:
{
nsAutoString prop;
if (NS_OK == a->GetAppVersion(prop)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case NAVIGATOR_LANGUAGE:
{
nsAutoString prop;
@ -120,6 +116,18 @@ GetNavigatorProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case NAVIGATOR_MIMETYPES:
{
nsIDOMMimeTypeArray* prop;
if (NS_OK == a->GetMimeTypes(&prop)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case NAVIGATOR_PLATFORM:
{
nsAutoString prop;
@ -131,6 +139,18 @@ GetNavigatorProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case NAVIGATOR_PLUGINS:
{
nsIDOMPluginArray* prop;
if (NS_OK == a->GetPlugins(&prop)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case NAVIGATOR_SECURITYPOLICY:
{
nsAutoString prop;
@ -142,6 +162,17 @@ GetNavigatorProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case NAVIGATOR_USERAGENT:
{
nsAutoString prop;
if (NS_OK == a->GetUserAgent(prop)) {
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
}
else {
return JS_FALSE;
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
@ -269,13 +300,15 @@ JSClass NavigatorClass = {
//
static JSPropertySpec NavigatorProperties[] =
{
{"userAgent", NAVIGATOR_USERAGENT, JSPROP_ENUMERATE | JSPROP_READONLY},
{"appCodeName", NAVIGATOR_APPCODENAME, JSPROP_ENUMERATE | JSPROP_READONLY},
{"appVersion", NAVIGATOR_APPVERSION, JSPROP_ENUMERATE | JSPROP_READONLY},
{"appName", NAVIGATOR_APPNAME, JSPROP_ENUMERATE | JSPROP_READONLY},
{"appVersion", NAVIGATOR_APPVERSION, JSPROP_ENUMERATE | JSPROP_READONLY},
{"language", NAVIGATOR_LANGUAGE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"mimeTypes", NAVIGATOR_MIMETYPES, JSPROP_ENUMERATE | JSPROP_READONLY},
{"platform", NAVIGATOR_PLATFORM, JSPROP_ENUMERATE | JSPROP_READONLY},
{"plugins", NAVIGATOR_PLUGINS, JSPROP_ENUMERATE | JSPROP_READONLY},
{"securityPolicy", NAVIGATOR_SECURITYPOLICY, JSPROP_ENUMERATE | JSPROP_READONLY},
{"userAgent", NAVIGATOR_USERAGENT, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};