| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DISPATCHER_H_ | 5 #ifndef PPAPI_PROXY_DISPATCHER_H_ |
| 6 #define PPAPI_PROXY_DISPATCHER_H_ | 6 #define PPAPI_PROXY_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/tracked_objects.h" | 14 #include "base/tracked_objects.h" |
| 14 #include "ipc/ipc_channel_proxy.h" | 15 #include "ipc/ipc_channel_proxy.h" |
| 15 #include "ppapi/c/pp_instance.h" | 16 #include "ppapi/c/pp_instance.h" |
| 16 #include "ppapi/c/pp_module.h" | 17 #include "ppapi/c/pp_module.h" |
| 17 #include "ppapi/proxy/proxy_channel.h" | 18 #include "ppapi/proxy/proxy_channel.h" |
| 18 #include "ppapi/proxy/interface_list.h" | 19 #include "ppapi/proxy/interface_list.h" |
| 19 #include "ppapi/proxy/interface_proxy.h" | 20 #include "ppapi/proxy/interface_proxy.h" |
| 20 #include "ppapi/proxy/plugin_var_tracker.h" | 21 #include "ppapi/proxy/plugin_var_tracker.h" |
| 21 #include "ppapi/shared_impl/api_id.h" | 22 #include "ppapi/shared_impl/api_id.h" |
| 22 | 23 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // IPC::Channel::Listener implementation. | 81 // IPC::Channel::Listener implementation. |
| 81 virtual bool OnMessageReceived(const IPC::Message& msg); | 82 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 82 | 83 |
| 83 GetInterfaceFunc local_get_interface() const { return local_get_interface_; } | 84 GetInterfaceFunc local_get_interface() const { return local_get_interface_; } |
| 84 | 85 |
| 85 protected: | 86 protected: |
| 86 Dispatcher(base::ProcessHandle remote_process_handle, | 87 Dispatcher(base::ProcessHandle remote_process_handle, |
| 87 GetInterfaceFunc local_get_interface); | 88 GetInterfaceFunc local_get_interface); |
| 88 | 89 |
| 89 // Setter for the derived classes to set the appropriate var serialization. | 90 // Setter for the derived classes to set the appropriate var serialization. |
| 90 // Takes ownership of the given pointer, which must be on the heap. | 91 // Takes one reference of the given pointer, which must be on the heap. |
| 91 void SetSerializationRules(VarSerializationRules* var_serialization_rules); | 92 void SetSerializationRules(VarSerializationRules* var_serialization_rules); |
| 92 | 93 |
| 93 // Called when an invalid message is received from the remote site. The | 94 // Called when an invalid message is received from the remote site. The |
| 94 // default implementation does nothing, derived classes can override. | 95 // default implementation does nothing, derived classes can override. |
| 95 virtual void OnInvalidMessageReceived(); | 96 virtual void OnInvalidMessageReceived(); |
| 96 | 97 |
| 97 bool disallow_trusted_interfaces() const { | 98 bool disallow_trusted_interfaces() const { |
| 98 return disallow_trusted_interfaces_; | 99 return disallow_trusted_interfaces_; |
| 99 } | 100 } |
| 100 | 101 |
| 101 private: | 102 private: |
| 102 friend class HostDispatcherTest; | 103 friend class HostDispatcherTest; |
| 103 friend class PluginDispatcherTest; | 104 friend class PluginDispatcherTest; |
| 104 | 105 |
| 105 // Lists all lazily-created interface proxies. | 106 // Lists all lazily-created interface proxies. |
| 106 scoped_ptr<InterfaceProxy> proxies_[API_ID_COUNT]; | 107 scoped_ptr<InterfaceProxy> proxies_[API_ID_COUNT]; |
| 107 | 108 |
| 108 bool disallow_trusted_interfaces_; | 109 bool disallow_trusted_interfaces_; |
| 109 | 110 |
| 110 GetInterfaceFunc local_get_interface_; | 111 GetInterfaceFunc local_get_interface_; |
| 111 | 112 |
| 112 scoped_ptr<VarSerializationRules> serialization_rules_; | 113 scoped_refptr<VarSerializationRules> serialization_rules_; |
| 113 | 114 |
| 114 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 115 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 } // namespace proxy | 118 } // namespace proxy |
| 118 } // namespace ppapi | 119 } // namespace ppapi |
| 119 | 120 |
| 120 #endif // PPAPI_PROXY_DISPATCHER_H_ | 121 #endif // PPAPI_PROXY_DISPATCHER_H_ |
| OLD | NEW |