OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2008 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 O3D_GPU_PLUGIN_NP_UTILS_DEFAULT_NP_OBJECT_H_ |
| 6 #define O3D_GPU_PLUGIN_NP_UTILS_DEFAULT_NP_OBJECT_H_ |
| 7 |
| 8 #include "third_party/npapi/bindings/npapi.h" |
| 9 #include "third_party/npapi/bindings/npruntime.h" |
| 10 |
| 11 namespace o3d { |
| 12 namespace gpu_plugin { |
| 13 |
| 14 class BaseNPDispatcher; |
| 15 |
| 16 // This class implements each of the functions in the NPClass interface. They |
| 17 // all return error by default. Note that these are not virtual functions and |
| 18 // this is not an interface. This class can be used as a mixin so that an |
| 19 // NPObject class does not need to implement every NPClass function but rather |
| 20 // inherits a default from DefaultNPObject. |
| 21 template <typename RootClass> |
| 22 class DefaultNPObject : public RootClass { |
| 23 public: |
| 24 void Invalidate() {} |
| 25 |
| 26 bool HasMethod(NPIdentifier name) { |
| 27 return false; |
| 28 } |
| 29 |
| 30 bool Invoke(NPIdentifier name, |
| 31 const NPVariant* args, |
| 32 uint32_t num_args, |
| 33 NPVariant* result) { |
| 34 return false; |
| 35 } |
| 36 |
| 37 bool InvokeDefault(const NPVariant* args, |
| 38 uint32_t num_args, |
| 39 NPVariant* result) { |
| 40 return false; |
| 41 } |
| 42 |
| 43 bool HasProperty(NPIdentifier name) { |
| 44 return false; |
| 45 } |
| 46 |
| 47 bool GetProperty(NPIdentifier name, NPVariant* result) { |
| 48 return false; |
| 49 } |
| 50 |
| 51 bool SetProperty(NPIdentifier name, const NPVariant* value) { |
| 52 return false; |
| 53 } |
| 54 |
| 55 bool RemoveProperty(NPIdentifier name) { |
| 56 return false; |
| 57 } |
| 58 |
| 59 bool Enumerate(NPIdentifier** names, |
| 60 uint32_t* count) { |
| 61 *names = NULL; |
| 62 *count = 0; |
| 63 return true; |
| 64 } |
| 65 |
| 66 bool Construct(const NPVariant* args, |
| 67 uint32_t num_args, |
| 68 NPVariant* result) { |
| 69 return false; |
| 70 } |
| 71 |
| 72 static BaseNPDispatcher* GetDispatcherChain() { |
| 73 return NULL; |
| 74 } |
| 75 |
| 76 protected: |
| 77 DefaultNPObject() {} |
| 78 virtual ~DefaultNPObject() {} |
| 79 |
| 80 private: |
| 81 DISALLOW_COPY_AND_ASSIGN(DefaultNPObject); |
| 82 }; |
| 83 } // namespace gpu_plugin |
| 84 } // namespace o3d |
| 85 |
| 86 #endif // O3D_GPU_PLUGIN_NP_UTILS_DEFAULT_NP_OBJECT_H_ |
OLD | NEW |