OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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_PLUGINS_PPAPI_PLUGIN_INTERFACE_FACTORY_H_ | |
6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_INTERFACE_FACTORY_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/lazy_instance.h" | |
13 #include "webkit/plugins/webkit_plugins_export.h" | |
14 | |
15 namespace webkit { | |
16 namespace ppapi { | |
17 | |
18 // This class provides functionality to manage custom PPAPI interface | |
19 // factories. | |
20 class PpapiInterfaceFactoryManager { | |
21 public: | |
22 typedef const void* (InterfaceFactory)(const std::string& interface_name); | |
23 | |
24 // Registers a custom PPAPI interface factory. | |
25 WEBKIT_PLUGINS_EXPORT void RegisterFactory(InterfaceFactory* factory); | |
26 | |
27 // Unregisters the custom PPAPI interface factory passed in. | |
28 WEBKIT_PLUGINS_EXPORT void UnregisterFactory(InterfaceFactory* factory); | |
29 | |
30 // Returns a pointer to the interface identified by the name passed in. | |
31 // Returns NULL if no factory handles this interface. | |
32 const void* GetInterface(const std::string& interface_name); | |
33 | |
34 // Returns a pointer to the global instance of the | |
35 // PpapiInterfaceFactoryManager class. | |
36 WEBKIT_PLUGINS_EXPORT static PpapiInterfaceFactoryManager* GetInstance(); | |
37 | |
38 private: | |
39 friend struct base::DefaultLazyInstanceTraits<PpapiInterfaceFactoryManager>; | |
40 | |
41 PpapiInterfaceFactoryManager(); | |
42 ~PpapiInterfaceFactoryManager(); | |
43 | |
44 typedef std::vector<InterfaceFactory*> FactoryList; | |
45 | |
46 // List of registered factories. | |
47 FactoryList interface_factory_list_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(PpapiInterfaceFactoryManager); | |
50 }; | |
51 | |
52 } // namespace ppapi | |
53 } // namespace webkit | |
54 | |
55 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_INTERFACE_FACTORY_H_ | |
56 | |
OLD | NEW |