2 * Copyright 2008, Google Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include "native_client/tests/npapi_pi/plugin.h"
37 void Deallocate(NPObject
* object
) {
38 delete static_cast<BaseObject
*>(object
);
41 void Invalidate(NPObject
* object
) {
42 return static_cast<BaseObject
*>(object
)->Invalidate();
45 bool HasMethod(NPObject
* object
, NPIdentifier name
) {
46 return static_cast<BaseObject
*>(object
)->HasMethod(name
);
49 bool Invoke(NPObject
* object
, NPIdentifier name
,
50 const NPVariant
* args
, uint32_t arg_count
,
52 return static_cast<BaseObject
*>(object
)->Invoke(
53 name
, args
, arg_count
, result
);
56 bool InvokeDefault(NPObject
* object
, const NPVariant
* args
, uint32_t arg_count
,
58 return static_cast<BaseObject
*>(object
)->InvokeDefault(
59 args
, arg_count
, result
);
62 bool HasProperty(NPObject
* object
, NPIdentifier name
) {
63 return static_cast<BaseObject
*>(object
)->HasProperty(name
);
66 bool GetProperty(NPObject
* object
, NPIdentifier name
, NPVariant
* result
) {
67 return static_cast<BaseObject
*>(object
)->GetProperty(name
, result
);
70 bool SetProperty(NPObject
* object
, NPIdentifier name
, const NPVariant
* value
) {
71 return static_cast<BaseObject
*>(object
)->SetProperty(name
, value
);
74 bool RemoveProperty(NPObject
* object
, NPIdentifier name
) {
75 return static_cast<BaseObject
*>(object
)->RemoveProperty(name
);
78 NPObject
* AllocateScriptablePluginObject(NPP npp
, NPClass
* npclass
) {
79 return new ScriptablePluginObject(npp
);
84 NPClass
ScriptablePluginObject::np_class
= {
85 NP_CLASS_STRUCT_VERSION
,
86 ::AllocateScriptablePluginObject
,