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/plugin_dispatcher.h" | 5 #include "ppapi/proxy/plugin_dispatcher.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "ipc/ipc_message.h" | 11 #include "ipc/ipc_message.h" |
12 #include "ipc/ipc_sync_channel.h" | 12 #include "ipc/ipc_sync_channel.h" |
13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
14 #include "ppapi/c/pp_errors.h" | 14 #include "ppapi/c/pp_errors.h" |
15 #include "ppapi/proxy/interface_proxy.h" | 15 #include "ppapi/proxy/interface_proxy.h" |
16 #include "ppapi/proxy/plugin_message_filter.h" | 16 #include "ppapi/proxy/plugin_message_filter.h" |
17 #include "ppapi/proxy/plugin_resource_tracker.h" | 17 #include "ppapi/proxy/plugin_resource_tracker.h" |
18 #include "ppapi/proxy/plugin_var_serialization_rules.h" | 18 #include "ppapi/proxy/plugin_var_serialization_rules.h" |
19 #include "ppapi/proxy/ppapi_messages.h" | 19 #include "ppapi/proxy/ppapi_messages.h" |
20 #include "ppapi/proxy/ppb_font_proxy.h" | 20 #include "ppapi/proxy/ppb_font_proxy.h" |
21 #include "ppapi/proxy/ppp_class_proxy.h" | 21 #include "ppapi/proxy/ppp_class_proxy.h" |
22 #include "ppapi/proxy/resource_creation_proxy.h" | 22 #include "ppapi/proxy/resource_creation_proxy.h" |
23 #include "ppapi/shared_impl/ppapi_preferences.h" | |
yzshen1
2011/05/25 23:40:11
[minor]
You may not need it since it has been incl
| |
23 #include "ppapi/shared_impl/tracker_base.h" | 24 #include "ppapi/shared_impl/tracker_base.h" |
24 | 25 |
25 #if defined(OS_POSIX) | 26 #if defined(OS_POSIX) |
26 #include "base/eintr_wrapper.h" | 27 #include "base/eintr_wrapper.h" |
27 #include "ipc/ipc_channel_posix.h" | 28 #include "ipc/ipc_channel_posix.h" |
28 #endif | 29 #endif |
29 | 30 |
30 namespace pp { | 31 namespace pp { |
31 namespace proxy { | 32 namespace proxy { |
32 | 33 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 "Line", IPC_MESSAGE_ID_LINE(msg.type())); | 116 "Line", IPC_MESSAGE_ID_LINE(msg.type())); |
116 // Handle common control messages. | 117 // Handle common control messages. |
117 if (Dispatcher::OnMessageReceived(msg)) | 118 if (Dispatcher::OnMessageReceived(msg)) |
118 return true; | 119 return true; |
119 | 120 |
120 if (msg.routing_id() == MSG_ROUTING_CONTROL) { | 121 if (msg.routing_id() == MSG_ROUTING_CONTROL) { |
121 // Handle some plugin-specific control messages. | 122 // Handle some plugin-specific control messages. |
122 bool handled = true; | 123 bool handled = true; |
123 IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg) | 124 IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg) |
124 IPC_MESSAGE_HANDLER(PpapiMsg_SupportsInterface, OnMsgSupportsInterface) | 125 IPC_MESSAGE_HANDLER(PpapiMsg_SupportsInterface, OnMsgSupportsInterface) |
126 IPC_MESSAGE_HANDLER(PpapiMsg_SetPreferences, OnMsgSetPreferences) | |
125 IPC_END_MESSAGE_MAP() | 127 IPC_END_MESSAGE_MAP() |
126 return handled; | 128 return handled; |
127 } | 129 } |
128 | 130 |
129 if (msg.routing_id() <= 0 && msg.routing_id() >= INTERFACE_ID_COUNT) { | 131 if (msg.routing_id() <= 0 && msg.routing_id() >= INTERFACE_ID_COUNT) { |
130 // Host is sending us garbage. Since it's supposed to be trusted, this | 132 // Host is sending us garbage. Since it's supposed to be trusted, this |
131 // isn't supposed to happen. Crash here in all builds in case the renderer | 133 // isn't supposed to happen. Crash here in all builds in case the renderer |
132 // is compromised. | 134 // is compromised. |
133 CHECK(false); | 135 CHECK(false); |
134 return true; | 136 return true; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 | 269 |
268 // Query the plugin & cache the result. | 270 // Query the plugin & cache the result. |
269 const void* interface_functions = GetLocalInterface(interface_name.c_str()); | 271 const void* interface_functions = GetLocalInterface(interface_name.c_str()); |
270 if (!interface_functions) | 272 if (!interface_functions) |
271 return; | 273 return; |
272 target_proxies_[info->id].reset( | 274 target_proxies_[info->id].reset( |
273 info->create_proxy(this, interface_functions)); | 275 info->create_proxy(this, interface_functions)); |
274 *result = true; | 276 *result = true; |
275 } | 277 } |
276 | 278 |
279 void PluginDispatcher::OnMsgSetPreferences(const ::ppapi::Preferences& prefs) { | |
280 preferences_ = prefs; | |
281 } | |
282 | |
277 } // namespace proxy | 283 } // namespace proxy |
278 } // namespace pp | 284 } // namespace pp |
279 | 285 |
OLD | NEW |