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