OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef O3D_GPU_PLUGIN_NP_UTILS_DYNAMIC_NP_OBJECT_H_ | 5 #ifndef O3D_GPU_PLUGIN_NP_UTILS_DYNAMIC_NP_OBJECT_H_ |
6 #define O3D_GPU_PLUGIN_NP_UTILS_DYNAMIC_NP_OBJECT_H_ | 6 #define O3D_GPU_PLUGIN_NP_UTILS_DYNAMIC_NP_OBJECT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "o3d/gpu_plugin/np_utils/base_np_object.h" | 10 #include "o3d/gpu_plugin/np_utils/default_np_object.h" |
11 #include "o3d/gpu_plugin/np_utils/np_utils.h" | 11 #include "o3d/gpu_plugin/np_utils/np_utils.h" |
12 | 12 |
13 namespace o3d { | 13 namespace o3d { |
14 namespace gpu_plugin { | 14 namespace gpu_plugin { |
15 | 15 |
16 // NPObjects of this type have a dictionary of property name / variant pairs | 16 // NPObjects of this type have a dictionary of property name / variant pairs |
17 // that can be changed at runtime through NPAPI. | 17 // that can be changed at runtime through NPAPI. |
18 class DynamicNPObject : public BaseNPObject { | 18 class DynamicNPObject : public DefaultNPObject<NPObject> { |
19 public: | 19 public: |
20 explicit DynamicNPObject(NPP npp); | 20 explicit DynamicNPObject(NPP npp); |
21 | 21 |
22 virtual void Invalidate(); | 22 void Invalidate(); |
23 virtual bool HasProperty(NPIdentifier name); | 23 bool HasProperty(NPIdentifier name); |
24 virtual bool GetProperty(NPIdentifier name, NPVariant* result); | 24 bool GetProperty(NPIdentifier name, NPVariant* result); |
25 virtual bool SetProperty(NPIdentifier name, const NPVariant* value); | 25 bool SetProperty(NPIdentifier name, const NPVariant* value); |
26 virtual bool RemoveProperty(NPIdentifier name); | 26 bool RemoveProperty(NPIdentifier name); |
27 virtual bool Enumerate(NPIdentifier** names, uint32_t* count); | 27 bool Enumerate(NPIdentifier** names, uint32_t* count); |
28 | 28 |
29 private: | 29 private: |
30 typedef std::map<NPIdentifier, SmartNPVariant> PropertyMap; | 30 typedef std::map<NPIdentifier, SmartNPVariant> PropertyMap; |
31 PropertyMap properties_; | 31 PropertyMap properties_; |
32 DISALLOW_COPY_AND_ASSIGN(DynamicNPObject); | 32 DISALLOW_COPY_AND_ASSIGN(DynamicNPObject); |
33 }; | 33 }; |
34 } // namespace gpu_plugin | 34 } // namespace gpu_plugin |
35 } // namespace o3d | 35 } // namespace o3d |
36 | 36 |
37 #endif // O3D_GPU_PLUGIN_NP_UTILS_DYNAMIC_NP_OBJECT_H_ | 37 #endif // O3D_GPU_PLUGIN_NP_UTILS_DYNAMIC_NP_OBJECT_H_ |
OLD | NEW |