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 #include "ppapi/proxy/dispatcher.h" | 5 #include "ppapi/proxy/dispatcher.h" |
6 | 6 |
7 #include <string.h> // For memset. | 7 #include <string.h> // For memset. |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // static | 174 // static |
175 InterfaceList* InterfaceList::GetInstance() { | 175 InterfaceList* InterfaceList::GetInstance() { |
176 return Singleton<InterfaceList>::get(); | 176 return Singleton<InterfaceList>::get(); |
177 } | 177 } |
178 | 178 |
179 } // namespace | 179 } // namespace |
180 | 180 |
181 Dispatcher::Dispatcher(base::ProcessHandle remote_process_handle, | 181 Dispatcher::Dispatcher(base::ProcessHandle remote_process_handle, |
182 GetInterfaceFunc local_get_interface) | 182 GetInterfaceFunc local_get_interface) |
183 : ProxyChannel(remote_process_handle), | 183 : ProxyChannel(remote_process_handle), |
| 184 dispatcher_delegate_(NULL), |
184 disallow_trusted_interfaces_(false), // TODO(brettw) make this settable. | 185 disallow_trusted_interfaces_(false), // TODO(brettw) make this settable. |
185 local_get_interface_(local_get_interface), | 186 local_get_interface_(local_get_interface), |
186 callback_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 187 callback_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
187 } | 188 } |
188 | 189 |
189 Dispatcher::~Dispatcher() { | 190 Dispatcher::~Dispatcher() { |
190 } | 191 } |
191 | 192 |
192 bool Dispatcher::OnMessageReceived(const IPC::Message& msg) { | 193 bool Dispatcher::OnMessageReceived(const IPC::Message& msg) { |
193 // Control messages. | 194 // Control messages. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 235 } |
235 | 236 |
236 // static | 237 // static |
237 const InterfaceProxy::Info* Dispatcher::GetPPPInterfaceInfo(InterfaceID id) { | 238 const InterfaceProxy::Info* Dispatcher::GetPPPInterfaceInfo(InterfaceID id) { |
238 if (id <= 0 || id >= INTERFACE_ID_COUNT) | 239 if (id <= 0 || id >= INTERFACE_ID_COUNT) |
239 return NULL; | 240 return NULL; |
240 const InterfaceList* list = InterfaceList::GetInstance(); | 241 const InterfaceList* list = InterfaceList::GetInstance(); |
241 return list->id_to_plugin_info_[id]; | 242 return list->id_to_plugin_info_[id]; |
242 } | 243 } |
243 | 244 |
| 245 void Dispatcher::SetDelegate(Delegate* delegate) { |
| 246 DCHECK(!dispatcher_delegate_); |
| 247 dispatcher_delegate_ = delegate; |
| 248 } |
| 249 |
244 void Dispatcher::SetSerializationRules( | 250 void Dispatcher::SetSerializationRules( |
245 VarSerializationRules* var_serialization_rules) { | 251 VarSerializationRules* var_serialization_rules) { |
246 serialization_rules_.reset(var_serialization_rules); | 252 serialization_rules_.reset(var_serialization_rules); |
247 } | 253 } |
248 | 254 |
249 const void* Dispatcher::GetLocalInterface(const char* interface_name) { | 255 const void* Dispatcher::GetLocalInterface(const char* interface_name) { |
250 return local_get_interface_(interface_name); | 256 return local_get_interface_(interface_name); |
251 } | 257 } |
252 | 258 |
253 base::MessageLoopProxy* Dispatcher::GetIPCMessageLoop() { | 259 base::MessageLoopProxy* Dispatcher::GetIPCMessageLoop() { |
254 return delegate()->GetIPCMessageLoop(); | 260 return delegate()->GetIPCMessageLoop(); |
255 } | 261 } |
256 | 262 |
257 void Dispatcher::AddIOThreadMessageFilter( | 263 void Dispatcher::AddIOThreadMessageFilter( |
258 IPC::ChannelProxy::MessageFilter* filter) { | 264 IPC::ChannelProxy::MessageFilter* filter) { |
259 channel()->AddFilter(filter); | 265 channel()->AddFilter(filter); |
260 } | 266 } |
261 | 267 |
262 } // namespace proxy | 268 } // namespace proxy |
263 } // namespace pp | 269 } // namespace pp |
OLD | NEW |