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