sbXPCScriptableStub.h
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25  */
26 
27 #ifndef __SB_XPCSCRIPTABLE_STUB_H__
28 #define __SB_XPCSCRIPTABLE_STUB_H__
29 
30 #include <nsIXPCScriptable.h>
31 
38 {
39 public:
40  virtual ~sbXPCScriptableStub() {};
41  /* GetClassName(char * *aClassName) needs to be implemented by the user */
42 
43  /* GetScriptableFlags(PRUint32 *aScriptableFlags) needs to be implemented by the user */
44 
45  NS_IMETHOD PreCreate( nsISupports *nativeObj,
46  JSContext * cx,
47  JSObject * globalObj,
48  JSObject * *parentObj )
49  {
50  return NS_ERROR_NOT_IMPLEMENTED;
51  }
52 
53  NS_IMETHOD Create( nsIXPConnectWrappedNative *wrapper,
54  JSContext * cx,
55  JSObject * obj )
56  {
57  return NS_ERROR_NOT_IMPLEMENTED;
58  }
59 
60  NS_IMETHOD PostCreate( nsIXPConnectWrappedNative *wrapper,
61  JSContext * cx,
62  JSObject * obj )
63  {
64  return NS_ERROR_NOT_IMPLEMENTED;
65  }
66 
67  /*
68  * AddProperty is called whenever a new property should be added to the object
69  * (note that this will be called even if the called was C/C++).
70  */
71  NS_IMETHOD AddProperty( nsIXPConnectWrappedNative *wrapper,
72  JSContext * cx,
73  JSObject * obj,
74  jsval id,
75  jsval * vp,
76  PRBool *_retval )
77  {
78  return NS_ERROR_NOT_IMPLEMENTED;
79  }
80 
81  NS_IMETHOD DelProperty( nsIXPConnectWrappedNative *wrapper,
82  JSContext * cx,
83  JSObject * obj,
84  jsval id,
85  jsval * vp,
86  PRBool *_retval )
87  {
88  return NS_ERROR_NOT_IMPLEMENTED;
89  }
90 
91  /*
92  * GetProperty is called every time JS attempts to get a property; that is, this
93  * gets invoked a lot and can be used to override properties on the JS object.
94  */
95  NS_IMETHOD GetProperty( nsIXPConnectWrappedNative *wrapper,
96  JSContext * cx,
97  JSObject * obj,
98  jsval id,
99  jsval * vp,
100  PRBool *_retval )
101  {
102  return NS_ERROR_NOT_IMPLEMENTED;
103  }
104 
105  NS_IMETHOD SetProperty( nsIXPConnectWrappedNative *wrapper,
106  JSContext * cx,
107  JSObject * obj,
108  jsval id,
109  jsval * vp,
110  PRBool *_retval )
111  {
112  return NS_ERROR_NOT_IMPLEMENTED;
113  }
114 
115  NS_IMETHOD Enumerate( nsIXPConnectWrappedNative *wrapper,
116  JSContext * cx,
117  JSObject * obj,
118  PRBool *_retval )
119  {
120  return NS_ERROR_NOT_IMPLEMENTED;
121  }
122 
123  /*
124  * NewEnumerate is called when JS does a for..in loop to find properties on the
125  * object. It only returns property names, not values (see NewResolve below).
126  */
127  NS_IMETHOD NewEnumerate( nsIXPConnectWrappedNative *wrapper,
128  JSContext * cx,
129  JSObject * obj,
130  PRUint32 enum_op,
131  jsval * statep,
132  jsid *idp,
133  PRBool *_retval )
134  {
135  return NS_ERROR_NOT_IMPLEMENTED;
136  }
137 
138  /*
139  * NewResolve is invoked when the JS engine needs to fetch a property (before
140  * GetProperty is called). It it used to find where in the prototype chain a
141  * given property exists.
142  */
143  NS_IMETHOD NewResolve( nsIXPConnectWrappedNative *wrapper,
144  JSContext * cx,
145  JSObject * obj,
146  jsval id,
147  PRUint32 flags,
148  JSObject * *objp,
149  PRBool *_retval )
150  {
151  return NS_ERROR_NOT_IMPLEMENTED;
152  }
153 
154  NS_IMETHOD Convert( nsIXPConnectWrappedNative *wrapper,
155  JSContext * cx,
156  JSObject * obj,
157  PRUint32 type,
158  jsval * vp,
159  PRBool *_retval )
160  {
161  return NS_ERROR_NOT_IMPLEMENTED;
162  }
163 
164  NS_IMETHOD Finalize( nsIXPConnectWrappedNative *wrapper,
165  JSContext * cx,
166  JSObject * obj )
167  {
168  return NS_ERROR_NOT_IMPLEMENTED;
169  }
170 
171  /* XXX Mook: I can't figure out when the heck CheckAccess gets called :( */
172  NS_IMETHOD CheckAccess( nsIXPConnectWrappedNative *wrapper,
173  JSContext * cx,
174  JSObject * obj,
175  jsval id,
176  PRUint32 mode,
177  jsval * vp,
178  PRBool *_retval )
179  {
180  return NS_ERROR_NOT_IMPLEMENTED;
181  }
182 
183  /* [[Call]] is invoked when the JS object is being called as a function
184  * (i.e. similiar to a C++ functor object)
185  */
186  NS_IMETHOD Call( nsIXPConnectWrappedNative *wrapper,
187  JSContext * cx,
188  JSObject * obj,
189  PRUint32 argc,
190  jsval * argv,
191  jsval * vp,
192  PRBool *_retval )
193  {
194  return NS_ERROR_NOT_IMPLEMENTED;
195  }
196 
197  NS_IMETHOD Construct( nsIXPConnectWrappedNative *wrapper,
198  JSContext * cx,
199  JSObject * obj,
200  PRUint32 argc,
201  jsval * argv,
202  jsval * vp,
203  PRBool *_retval )
204  {
205  return NS_ERROR_NOT_IMPLEMENTED;
206  }
207 
208  NS_IMETHOD HasInstance( nsIXPConnectWrappedNative *wrapper,
209  JSContext * cx,
210  JSObject * obj,
211  jsval val,
212  PRBool *bp,
213  PRBool *_retval )
214  {
215  return NS_ERROR_NOT_IMPLEMENTED;
216  }
217 
218  NS_IMETHOD Trace( nsIXPConnectWrappedNative *wrapper,
219  JSTracer * trc,
220  JSObject * obj )
221  {
222  return NS_ERROR_NOT_IMPLEMENTED;
223  }
224 
225  NS_IMETHOD Equality( nsIXPConnectWrappedNative *wrapper,
226  JSContext * cx,
227  JSObject * obj,
228  jsval val,
229  PRBool *_retval )
230  {
231  return NS_ERROR_NOT_IMPLEMENTED;
232  }
233 
234  NS_IMETHOD OuterObject( nsIXPConnectWrappedNative *wrapper,
235  JSContext * cx,
236  JSObject * obj,
237  JSObject * *_retval )
238  {
239  return NS_ERROR_NOT_IMPLEMENTED;
240  }
241 
242  NS_IMETHOD InnerObject( nsIXPConnectWrappedNative *wrapper,
243  JSContext * cx,
244  JSObject * obj,
245  JSObject * *_retval )
246  {
247  return NS_ERROR_NOT_IMPLEMENTED;
248  }
249 
250  NS_IMETHOD PostCreatePrototype( JSContext * cx,
251  JSObject * proto )
252  {
253  return NS_ERROR_NOT_IMPLEMENTED;
254  }
255 };
256 
257 #endif // __SB_XPCSCRIPTABLE_STUB_H__
258 
NS_IMETHOD Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, PRBool *_retval)
NS_IMETHOD Finalize(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj)
NS_IMETHOD HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, jsval val, PRBool *bp, PRBool *_retval)
NS_IMETHOD Convert(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, PRUint32 type, jsval *vp, PRBool *_retval)
NS_IMETHOD PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj)
NS_IMETHOD OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, JSObject **_retval)
NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
NS_IMETHOD DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
sbDeviceFirmwareAutoCheckForUpdate prototype flags
NS_IMETHOD Trace(nsIXPConnectWrappedNative *wrapper, JSTracer *trc, JSObject *obj)
NS_IMETHOD Create(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj)
NS_IMETHOD PostCreatePrototype(JSContext *cx, JSObject *proto)
NS_IMETHOD CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, jsval id, PRUint32 mode, jsval *vp, PRBool *_retval)
NS_IMETHOD Equality(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, jsval val, PRBool *_retval)
NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, jsval id, PRUint32 flags, JSObject **objp, PRBool *_retval)
NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
this _dialogInput val(dateText)
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj, JSObject **parentObj)
NS_IMETHOD InnerObject(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, JSObject **_retval)
NS_IMETHOD NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, PRUint32 enum_op, jsval *statep, jsid *idp, PRBool *_retval)
NS_IMETHOD Call(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, PRUint32 argc, jsval *argv, jsval *vp, PRBool *_retval)
NS_IMETHOD Construct(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, PRUint32 argc, jsval *argv, jsval *vp, PRBool *_retval)