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 30 matching lines...) Expand all Loading... |
41 GetInterfaceFunc local_get_interface); | 41 GetInterfaceFunc local_get_interface); |
42 ~HostDispatcher(); | 42 ~HostDispatcher(); |
43 | 43 |
44 // The host side maintains a mapping from PP_Instance to Dispatcher so | 44 // The host side maintains a mapping from PP_Instance to Dispatcher so |
45 // that we can send the messages to the right channel. | 45 // that we can send the messages to the right channel. |
46 static HostDispatcher* GetForInstance(PP_Instance instance); | 46 static HostDispatcher* GetForInstance(PP_Instance instance); |
47 static void SetForInstance(PP_Instance instance, | 47 static void SetForInstance(PP_Instance instance, |
48 HostDispatcher* dispatcher); | 48 HostDispatcher* dispatcher); |
49 static void RemoveForInstance(PP_Instance instance); | 49 static void RemoveForInstance(PP_Instance instance); |
50 | 50 |
51 // Calls the plugin's PPP_InitializeModule function and returns true if | |
52 // the call succeeded. | |
53 bool InitializeModule(); | |
54 | |
55 // Dispatcher overrides. | 51 // Dispatcher overrides. |
56 virtual bool IsPlugin() const; | 52 virtual bool IsPlugin() const; |
57 | 53 |
58 // IPC::Channel::Listener. | 54 // IPC::Channel::Listener. |
59 virtual bool OnMessageReceived(const IPC::Message& msg); | 55 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 56 virtual void OnChannelError(); |
60 | 57 |
61 // Proxied version of calling GetInterface on the plugin. This will check | 58 // Proxied version of calling GetInterface on the plugin. This will check |
62 // if the plugin supports the given interface (with caching) and returns the | 59 // if the plugin supports the given interface (with caching) and returns the |
63 // pointer to the proxied interface if it is supported. Returns NULL if the | 60 // pointer to the proxied interface if it is supported. Returns NULL if the |
64 // given interface isn't supported by the plugin or the proxy. | 61 // given interface isn't supported by the plugin or the proxy. |
65 const void* GetProxiedInterface(const std::string& interface); | 62 const void* GetProxiedInterface(const std::string& interface); |
66 | 63 |
67 private: | 64 private: |
68 friend class HostDispatcherTest; | 65 friend class HostDispatcherTest; |
69 | 66 |
70 enum PluginInterfaceSupport { | 67 enum PluginInterfaceSupport { |
71 INTERFACE_UNQUERIED = 0, // Must be 0 so memset(0) will clear the list. | 68 INTERFACE_UNQUERIED = 0, // Must be 0 so memset(0) will clear the list. |
72 INTERFACE_SUPPORTED, | 69 INTERFACE_SUPPORTED, |
73 INTERFACE_UNSUPPORTED | 70 INTERFACE_UNSUPPORTED |
74 }; | 71 }; |
75 PluginInterfaceSupport plugin_interface_support_[INTERFACE_ID_COUNT]; | 72 PluginInterfaceSupport plugin_interface_support_[INTERFACE_ID_COUNT]; |
76 | 73 |
77 // All target proxies currently created. These are ones that receive | 74 // All target proxies currently created. These are ones that receive |
78 // messages. They are created on demand when we receive messages. | 75 // messages. They are created on demand when we receive messages. |
79 scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT]; | 76 scoped_ptr<InterfaceProxy> target_proxies_[INTERFACE_ID_COUNT]; |
80 | 77 |
81 DISALLOW_COPY_AND_ASSIGN(HostDispatcher); | 78 DISALLOW_COPY_AND_ASSIGN(HostDispatcher); |
82 }; | 79 }; |
83 | 80 |
84 } // namespace proxy | 81 } // namespace proxy |
85 } // namespace pp | 82 } // namespace pp |
86 | 83 |
87 #endif // PPAPI_PROXY_HOST_DISPATCHER_H_ | 84 #endif // PPAPI_PROXY_HOST_DISPATCHER_H_ |
OLD | NEW |