17
17
* You should have received a copy of the GNU Library General Public
18
18
* License along with this library; if not, write to the
19
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
* Boston, MA 02111-1307, USA.
22
* $Id: totemGMPPlugin.cpp 3790 2006-12-15 23:08:57Z chpe $
19
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
* Boston, MA 02110-1301 USA.
25
#include <mozilla-config.h>
28
#include <nsDOMError.h>
29
#include <nsIProgrammingLanguage.h>
30
#include <nsISupportsImpl.h>
34
#define GNOME_ENABLE_DEBUG 1
35
/* define GNOME_ENABLE_DEBUG for more debug spew */
38
#include "totemDebug.h"
40
#include "totemGMPPlugin.h"
41
#include "totemClassInfo.h"
43
29
#include "totemGMPPlaylist.h"
45
/* cf079ca3-c94f-4676-a9ae-6d9bffd765bd */
46
static const nsCID kClassID =
47
{ 0xcf079ca3, 0xc94f, 0x4676, \
48
{ 0xa9, 0xae, 0x6d, 0x9b, 0xff, 0xd7, 0x65, 0xbd } };
50
static const char kClassDescription[] = "totemGMPPlaylist";
52
totemGMPPlaylist::totemGMPPlaylist (totemScriptablePlugin *aScriptable)
31
static const char *propertyNames[] = {
37
static const char *methodNames[] = {
50
TOTEM_IMPLEMENT_NPCLASS (totemGMPPlaylist,
51
propertyNames, G_N_ELEMENTS (propertyNames),
52
methodNames, G_N_ELEMENTS (methodNames),
55
totemGMPPlaylist::totemGMPPlaylist (NPP aNPP)
56
: totemNPObject (aNPP),
57
mName (NPN_StrDup ("Playlist"))
54
D ("%s ctor [%p]", kClassDescription, (void*) this);
56
/* We keep a reference to the main scriptable, so the code won't be unloaded unless it's ok to do so */
57
mScriptable = aScriptable;
58
NS_ADDREF (mScriptable);
61
62
totemGMPPlaylist::~totemGMPPlaylist ()
63
D ("%s dtor [%p]", kClassDescription, (void*) this);
65
NS_RELEASE (mScriptable);
69
/* Interface implementations */
71
NS_IMPL_ISUPPORTS2 (totemGMPPlaylist,
77
TOTEM_CLASSINFO_BEGIN (totemGMPPlaylist,
81
TOTEM_CLASSINFO_ENTRY (0, totemIGMPPlaylist)
86
#undef TOTEM_SCRIPTABLE_INTERFACE
87
#define TOTEM_SCRIPTABLE_INTERFACE "totemIGMPPlaylist"
89
/* void appendItem (in totemIGMPMedia item); */
91
totemGMPPlaylist::AppendItem(totemIGMPMedia *item)
93
TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED ();
98
/* readonly attribute long attributeCount; */
100
totemGMPPlaylist::GetAttributeCount(PRInt32 *aAttributeCount)
102
TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED ();
104
*aAttributeCount = 0;
108
/* AUTF8String attributeName (in long index); */
110
totemGMPPlaylist::AttributeName(PRInt32 index, nsACString & _retval)
112
return GetAttributeName (index, _retval);
115
/* AUTF8String getattributeName (in long index); */
117
totemGMPPlaylist::GetAttributeName(PRInt32 index, nsACString & _retval)
119
TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED ();
125
/* readonly attribute long count; */
127
totemGMPPlaylist::GetCount(PRInt32 *aCount)
129
TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED ();
135
/* AUTF8String getItemInfo (in AUTF8String name); */
137
totemGMPPlaylist::GetItemInfo(const nsACString & name, nsACString & _retval)
139
TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED ();
145
/* void insertItem (in long index, in totemIGMPMedia item); */
147
totemGMPPlaylist::InsertItem(PRInt32 index, totemIGMPMedia *item)
149
TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED ();
154
/* boolean isIdentical (in totemIGMPPlaylist playlist); */
156
totemGMPPlaylist::IsIdentical(totemIGMPPlaylist *playlist, PRBool *_retval)
158
nsISupports *thisPlaylist = static_cast<nsISupports*>
159
(static_cast<totemIGMPPlaylist*>(this));
161
*_retval = thisPlaylist == playlist;
165
/* totemIGMPMedia item (in long index); */
167
totemGMPPlaylist::Item(PRInt32 index, totemIGMPMedia **_retval)
169
TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED ();
171
return NS_ERROR_NOT_IMPLEMENTED;
174
/* void moveItem (in long oldIndex, in long newIndex); */
176
totemGMPPlaylist::MoveItem(PRInt32 oldIndex, PRInt32 newIndex)
178
TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED ();
183
/* attribute AUTF8String name; */
185
totemGMPPlaylist::GetName(nsACString & aName)
187
TOTEM_SCRIPTABLE_LOG_ACCESS ();
194
totemGMPPlaylist::SetName(const nsACString & aName)
196
TOTEM_SCRIPTABLE_LOG_ACCESS ();
202
/* void removeItem (in totemIGMPMedia item); */
204
totemGMPPlaylist::RemoveItem(totemIGMPMedia *item)
206
TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED ();
211
/* void setItemInfo (in AUTF8String name, in AUTF8String value); */
213
totemGMPPlaylist::SetItemInfo(const nsACString & name, const nsACString & value)
215
TOTEM_SCRIPTABLE_WARN_UNIMPLEMENTED ();
70
totemGMPPlaylist::InvokeByIndex (int aIndex,
71
const NPVariant *argv,
75
TOTEM_LOG_INVOKE (aIndex, totemGMPPlaylist);
77
switch (Methods (aIndex)) {
79
/* AUTF8String attributeName (in long index); */
80
case eGetAttributeName:
81
/* AUTF8String getAttributeName (in long index); */
83
TOTEM_WARN_INVOKE_UNIMPLEMENTED (aIndex, totemGMPPlaylist);
84
/* AUTF8String getItemInfo (in AUTF8String name); */
85
return StringVariant (_result, "");
88
/* boolean isIdentical (in totemIGMPPlaylist playlist); */
90
if (!GetObjectFromArguments (argv, argc, 0, other))
93
return BoolVariant (_result, other == static_cast<NPObject*>(this));
97
/* totemIGMPMedia item (in long index); */
98
TOTEM_WARN_1_INVOKE_UNIMPLEMENTED (aIndex, totemGMPPlaylist);
99
return NullVariant (_result);
102
/* void appendItem (in totemIGMPMedia item); */
104
/* void insertItem (in long index, in totemIGMPMedia item); */
106
/* void moveItem (in long oldIndex, in long newIndex); */
108
/* void removeItem (in totemIGMPMedia item); */
110
/* void setItemInfo (in AUTF8String name, in AUTF8String value); */
111
TOTEM_WARN_INVOKE_UNIMPLEMENTED (aIndex, totemGMPPlaylist);
112
return VoidVariant (_result);
119
totemGMPPlaylist::GetPropertyByIndex (int aIndex,
122
TOTEM_LOG_GETTER (aIndex, totemGMPPlaylist);
124
switch (Properties (aIndex)) {
125
case eAttributeCount:
126
/* readonly attribute long attributeCount; */
128
/* readonly attribute long count; */
129
return Int32Variant (_result, 0);
132
/* attribute AUTF8String name; */
133
return StringVariant (_result, mName);
140
totemGMPPlaylist::SetPropertyByIndex (int aIndex,
141
const NPVariant *aValue)
143
TOTEM_LOG_SETTER (aIndex, totemGMPPlaylist);
145
switch (Properties (aIndex)) {
147
/* attribute AUTF8String name; */
148
return DupStringFromArguments (aValue, 1, 0, mName);
150
case eAttributeCount:
151
/* readonly attribute long attributeCount; */
153
/* readonly attribute long count; */
154
return ThrowPropertyNotWritable ();