OLD | NEW |
| (Empty) |
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 WEBKIT_GLUE_PLUGINS_PEPPER_CLASS_H_ | |
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_CLASS_H_ | |
7 | |
8 #include "webkit/glue/plugins/pepper_resource.h" | |
9 | |
10 #include <string> | |
11 | |
12 #include "base/hash_tables.h" | |
13 #include "ppapi/c/ppb_class.h" | |
14 | |
15 namespace pepper { | |
16 | |
17 class PluginModule; | |
18 | |
19 class VarObjectClass : public Resource { | |
20 public: | |
21 struct Property { | |
22 explicit Property(const PP_ClassProperty& prop); | |
23 | |
24 const PP_ClassFunction method; | |
25 const PP_ClassFunction getter; | |
26 const PP_ClassFunction setter; | |
27 const bool writable; | |
28 const bool enumerable; | |
29 }; | |
30 | |
31 struct InstanceData; | |
32 | |
33 typedef base::hash_map<std::string, Property> PropertyMap; | |
34 | |
35 // Returns the PPB_Var interface for the plugin to use. | |
36 static const PPB_Class* GetInterface(); | |
37 | |
38 VarObjectClass(PluginModule* module, PP_ClassDestructor destruct, | |
39 PP_ClassFunction invoke, PP_ClassProperty* properties); | |
40 virtual ~VarObjectClass(); | |
41 | |
42 // Resource override. | |
43 virtual VarObjectClass* AsVarObjectClass(); | |
44 | |
45 const PropertyMap &properties() const { return properties_; } | |
46 | |
47 PP_ClassDestructor instance_native_destructor() { | |
48 return instance_native_destructor_; | |
49 } | |
50 | |
51 PP_ClassFunction instance_invoke() { | |
52 return instance_invoke_; | |
53 } | |
54 | |
55 private: | |
56 PropertyMap properties_; | |
57 PP_ClassDestructor instance_native_destructor_; | |
58 PP_ClassFunction instance_invoke_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(VarObjectClass); | |
61 }; | |
62 | |
63 } // namespace pepper | |
64 | |
65 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_CLASS_H_ | |
66 | |
OLD | NEW |