Delete unused downloads page asset.
[chromium-blink-merge.git] / ppapi / c / dev / ppp_class_deprecated.h
blob0f39d26430ce41c4565fc9f869e95e1513427244
1 /* Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5 #ifndef PPAPI_C_PPP_CLASS_DEPRECATED_H_
6 #define PPAPI_C_PPP_CLASS_DEPRECATED_H_
8 #include "ppapi/c/dev/deprecated_bool.h"
9 #include "ppapi/c/pp_stdint.h"
10 #include "ppapi/c/pp_var.h"
12 /**
13 * @file
14 * Defines the PPP_Class_Deprecated struct.
16 * @addtogroup PPP
17 * @{
20 struct PP_Var;
22 /**
23 * Interface for the plugin to implement JavaScript-accessible objects.
25 * This interface has no interface name. Instead, the plugin passes a pointer
26 * to this interface to PPB_Var_Deprecated.CreateObject that corresponds to the
27 * object being implemented.
29 * See the PPB_Var_Deprecated interface for more information on these functions.
30 * This interface just allows you to implement the "back end" of those
31 * functions, so most of the contract is specified in that interface.
33 * See
34 * http://code.google.com/p/ppapi/wiki/InterfacingWithJavaScript
35 * for general information on using and implementing vars.
37 struct PPP_Class_Deprecated {
38 /**
39 * |name| is guaranteed to be an integer or string type var. Exception is
40 * guaranteed non-NULL. An integer is used for |name| when implementing
41 * array access into the object. This test should only return true for
42 * properties that are not methods. Use HasMethod() to handle methods.
44 bool (*HasProperty)(void* object,
45 struct PP_Var name,
46 struct PP_Var* exception);
48 /**
49 * |name| is guaranteed to be a string-type. Exception is guaranteed non-NULL.
50 * If the method does not exist, return false and don't set the exception.
51 * Errors in this function will probably not occur in general usage, but
52 * if you need to throw an exception, still return false.
54 bool (*HasMethod)(void* object,
55 struct PP_Var name,
56 struct PP_Var* exception);
58 /**
59 * |name| is guaranteed to be a string-type or an integer-type var. Exception
60 * is guaranteed non-NULL. An integer is used for |name| when implementing
61 * array access into the object. If the property does not exist, set the
62 * exception and return a var of type Void. A property does not exist if
63 * a call HasProperty() for the same |name| would return false.
65 struct PP_Var (*GetProperty)(void* object,
66 struct PP_Var name,
67 struct PP_Var* exception);
69 /**
70 * Exception is guaranteed non-NULL.
72 * This should include all enumerable properties, including methods. Be sure
73 * to set |*property_count| to 0 and |properties| to NULL in all failure
74 * cases, these should never be unset when calling this function. The
75 * pointers passed in are guaranteed not to be NULL, so you don't have to
76 * NULL check them.
78 * If you have any properties, allocate the property array with
79 * PPB_Core.MemAlloc(sizeof(PP_Var) * property_count) and add a reference
80 * to each property on behalf of the caller. The caller is responsible for
81 * Release()ing each var and calling PPB_Core.MemFree on the property pointer.
83 void (*GetAllPropertyNames)(void* object,
84 uint32_t* property_count,
85 struct PP_Var** properties,
86 struct PP_Var* exception);
88 /**
89 * |name| is guaranteed to be an integer or string type var. Exception is
90 * guaranteed non-NULL.
92 void (*SetProperty)(void* object,
93 struct PP_Var name,
94 struct PP_Var value,
95 struct PP_Var* exception);
97 /**
98 * |name| is guaranteed to be an integer or string type var. Exception is
99 * guaranteed non-NULL.
101 void (*RemoveProperty)(void* object,
102 struct PP_Var name,
103 struct PP_Var* exception);
105 // TODO(brettw) need native array access here.
108 * |name| is guaranteed to be a string type var. Exception is guaranteed
109 * non-NULL
111 struct PP_Var (*Call)(void* object,
112 struct PP_Var method_name,
113 uint32_t argc,
114 struct PP_Var* argv,
115 struct PP_Var* exception);
117 /** Exception is guaranteed non-NULL. */
118 struct PP_Var (*Construct)(void* object,
119 uint32_t argc,
120 struct PP_Var* argv,
121 struct PP_Var* exception);
124 * Called when the reference count of the object reaches 0. Normally, plugins
125 * would free their internal data pointed to by the |object| pointer.
127 void (*Deallocate)(void* object);
131 * @}
132 * End addtogroup PPP
134 #endif /* PPAPI_C_PPP_CLASS_DEPRECATED_H_ */