Added version attribute to nsI4xScriptablePlugin.idl.

git-svn-id: svn://10.0.0.236/trunk@102647 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
beard%netscape.com
2001-09-10 14:56:04 +00:00
parent 08f0c16feb
commit cdfc1133b9
5 changed files with 20 additions and 2 deletions

View File

@@ -26,4 +26,6 @@
interface nsI4xScriptablePlugin : nsISupports {
void showVersion();
void clear();
readonly attribute string version;
};

View File

@@ -111,3 +111,10 @@ NS_IMETHODIMP nsScriptablePeer::Clear()
return NS_OK;
}
NS_IMETHODIMP nsScriptablePeer::GetVersion(char * *aVersion)
{
if (mPlugin)
mPlugin->getVersion(aVersion);
return NS_OK;
}

View File

@@ -81,8 +81,7 @@ protected:
public:
// native methods callable from JavaScript
NS_IMETHOD ShowVersion();
NS_IMETHOD Clear();
NS_DECL_NSI4XSCRIPTABLEPLUGIN
protected:
CPlugin* mPlugin;

View File

@@ -116,6 +116,15 @@ void CPlugin::clear()
#endif
}
void CPlugin::getVersion(char* *aVersion)
{
const char *ua = NPN_UserAgent(m_pNPInstance);
char*& version = *aVersion;
version = (char*)NPN_MemAlloc(1 + strlen(ua));
if (version)
strcpy(version, ua);
}
// ==============================
// ! Scriptability related code !
// ==============================

View File

@@ -52,6 +52,7 @@ public:
void showVersion();
void clear();
void getVersion(char* *aVersion);
nsI4xScriptablePlugin* getScriptablePeer();
};