OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 PPAPI_PROXY_HOST_DISPATCHER_H_ | 5 #ifndef PPAPI_PROXY_HOST_DISPATCHER_H_ |
6 #define PPAPI_PROXY_HOST_DISPATCHER_H_ | 6 #define PPAPI_PROXY_HOST_DISPATCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 // Returns the proxy object associated with the given interface ID, creating | 73 // Returns the proxy object associated with the given interface ID, creating |
74 // it if necessary. This is used in cases where a proxy needs to access code | 74 // it if necessary. This is used in cases where a proxy needs to access code |
75 // in the proxy for another interface. It's assumed that the interface always | 75 // in the proxy for another interface. It's assumed that the interface always |
76 // exists, so this is only used for browser proxies. | 76 // exists, so this is only used for browser proxies. |
77 // | 77 // |
78 // Will return NULL if an interface isn't supported. | 78 // Will return NULL if an interface isn't supported. |
79 InterfaceProxy* GetOrCreatePPBInterfaceProxy(InterfaceID id); | 79 InterfaceProxy* GetOrCreatePPBInterfaceProxy(InterfaceID id); |
80 | 80 |
81 // Returns the proxy interface for talking to the implementation. | 81 // Returns the proxy interface for talking to the implementation. |
82 const PPB_Proxy_Private* GetPPBProxy(); | 82 const PPB_Proxy_Private* ppb_proxy() const { return ppb_proxy_; } |
83 | 83 |
84 private: | 84 private: |
85 friend class HostDispatcherTest; | 85 friend class HostDispatcherTest; |
86 | 86 |
87 // Makes an instance of the given PPB interface proxy, storing it in the | 87 // Makes an instance of the given PPB interface proxy, storing it in the |
88 // target_proxies_ array. An proxy for this interface must not exist yet. | 88 // target_proxies_ array. An proxy for this interface must not exist yet. |
89 InterfaceProxy* CreatePPBInterfaceProxy(const InterfaceProxy::Info* info); | 89 InterfaceProxy* CreatePPBInterfaceProxy(const InterfaceProxy::Info* info); |
90 | 90 |
91 PP_Module pp_module_; | 91 PP_Module pp_module_; |
92 | 92 |
93 enum PluginInterfaceSupport { | 93 enum PluginInterfaceSupport { |
94 INTERFACE_UNQUERIED = 0, // Must be 0 so memset(0) will clear the list. | 94 INTERFACE_UNQUERIED = 0, // Must be 0 so memset(0) will clear the list. |
95 INTERFACE_SUPPORTED, | 95 INTERFACE_SUPPORTED, |
96 INTERFACE_UNSUPPORTED | 96 INTERFACE_UNSUPPORTED |
97 }; | 97 }; |
98 PluginInterfaceSupport plugin_interface_support_[INTERFACE_ID_COUNT]; | 98 PluginInterfaceSupport plugin_interface_support_[INTERFACE_ID_COUNT]; |
99 | 99 |
100 // All target proxies currently created. These are ones that receive | 100 // All target proxies currently created. These are ones that receive |
101 // messages. They are created on demand when we receive messages. | 101 // messages. They are created on demand when we receive messages. |
102 scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT]; | 102 scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT]; |
103 | 103 |
104 // Lazily initialized, may be NULL. Use GetPPBProxy(). | 104 // Guaranteed non-NULL. |
105 const PPB_Proxy_Private* ppb_proxy_; | 105 const PPB_Proxy_Private* ppb_proxy_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(HostDispatcher); | 107 DISALLOW_COPY_AND_ASSIGN(HostDispatcher); |
108 }; | 108 }; |
109 | 109 |
110 } // namespace proxy | 110 } // namespace proxy |
111 } // namespace pp | 111 } // namespace pp |
112 | 112 |
113 #endif // PPAPI_PROXY_HOST_DISPATCHER_H_ | 113 #endif // PPAPI_PROXY_HOST_DISPATCHER_H_ |
OLD | NEW |