OLD | NEW |
---|---|
1 // Copyright (c) 2012 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 #include "ppapi/proxy/ppb_instance_proxy.h" | 5 #include "ppapi/proxy/ppb_instance_proxy.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/c/pp_time.h" | 10 #include "ppapi/c/pp_time.h" |
11 #include "ppapi/c/pp_var.h" | 11 #include "ppapi/c/pp_var.h" |
12 #include "ppapi/c/ppb_audio_config.h" | 12 #include "ppapi/c/ppb_audio_config.h" |
13 #include "ppapi/c/ppb_instance.h" | 13 #include "ppapi/c/ppb_instance.h" |
14 #include "ppapi/c/ppb_messaging.h" | 14 #include "ppapi/c/ppb_messaging.h" |
15 #include "ppapi/c/ppb_mouse_lock.h" | 15 #include "ppapi/c/ppb_mouse_lock.h" |
16 #include "ppapi/c/private/pp_content_decryptor.h" | 16 #include "ppapi/c/private/pp_content_decryptor.h" |
17 #include "ppapi/proxy/broker_resource.h" | 17 #include "ppapi/proxy/broker_resource.h" |
18 #include "ppapi/proxy/browser_font_singleton_resource.h" | 18 #include "ppapi/proxy/browser_font_singleton_resource.h" |
19 #include "ppapi/proxy/content_decryptor_private_serializer.h" | 19 #include "ppapi/proxy/content_decryptor_private_serializer.h" |
20 #include "ppapi/proxy/enter_proxy.h" | 20 #include "ppapi/proxy/enter_proxy.h" |
21 #include "ppapi/proxy/extensions_common_resource.h" | 21 #include "ppapi/proxy/extensions_common_resource.h" |
22 #include "ppapi/proxy/file_mapping_resource.h" | 22 #include "ppapi/proxy/file_mapping_resource.h" |
23 #include "ppapi/proxy/flash_clipboard_resource.h" | 23 #include "ppapi/proxy/flash_clipboard_resource.h" |
24 #include "ppapi/proxy/flash_file_resource.h" | 24 #include "ppapi/proxy/flash_file_resource.h" |
25 #include "ppapi/proxy/flash_fullscreen_resource.h" | 25 #include "ppapi/proxy/flash_fullscreen_resource.h" |
26 #include "ppapi/proxy/flash_resource.h" | 26 #include "ppapi/proxy/flash_resource.h" |
27 #include "ppapi/proxy/gamepad_resource.h" | 27 #include "ppapi/proxy/gamepad_resource.h" |
28 #include "ppapi/proxy/host_dispatcher.h" | 28 #include "ppapi/proxy/host_dispatcher.h" |
29 #include "ppapi/proxy/isolated_file_system_private_resource.h" | 29 #include "ppapi/proxy/isolated_file_system_private_resource.h" |
30 #include "ppapi/proxy/message_handler.h" | |
30 #include "ppapi/proxy/network_proxy_resource.h" | 31 #include "ppapi/proxy/network_proxy_resource.h" |
31 #include "ppapi/proxy/pdf_resource.h" | 32 #include "ppapi/proxy/pdf_resource.h" |
32 #include "ppapi/proxy/plugin_dispatcher.h" | 33 #include "ppapi/proxy/plugin_dispatcher.h" |
33 #include "ppapi/proxy/ppapi_messages.h" | 34 #include "ppapi/proxy/ppapi_messages.h" |
34 #include "ppapi/proxy/serialized_var.h" | 35 #include "ppapi/proxy/serialized_var.h" |
35 #include "ppapi/proxy/truetype_font_singleton_resource.h" | 36 #include "ppapi/proxy/truetype_font_singleton_resource.h" |
36 #include "ppapi/proxy/uma_private_resource.h" | 37 #include "ppapi/proxy/uma_private_resource.h" |
37 #include "ppapi/shared_impl/ppapi_globals.h" | 38 #include "ppapi/shared_impl/ppapi_globals.h" |
38 #include "ppapi/shared_impl/ppb_url_util_shared.h" | 39 #include "ppapi/shared_impl/ppb_url_util_shared.h" |
39 #include "ppapi/shared_impl/ppb_view_shared.h" | 40 #include "ppapi/shared_impl/ppb_view_shared.h" |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
733 } | 734 } |
734 #endif // !defined(OS_NACL) | 735 #endif // !defined(OS_NACL) |
735 | 736 |
736 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, | 737 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, |
737 PP_Var message) { | 738 PP_Var message) { |
738 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( | 739 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( |
739 API_ID_PPB_INSTANCE, | 740 API_ID_PPB_INSTANCE, |
740 instance, SerializedVarSendInputShmem(dispatcher(), message, | 741 instance, SerializedVarSendInputShmem(dispatcher(), message, |
741 instance))); | 742 instance))); |
742 } | 743 } |
744 | |
743 int32_t PPB_Instance_Proxy::RegisterMessageHandler( | 745 int32_t PPB_Instance_Proxy::RegisterMessageHandler( |
744 PP_Instance instance, | 746 PP_Instance instance, |
745 void* user_data, | 747 void* user_data, |
746 const PPP_MessageHandler_0_1* handler, | 748 const PPP_MessageHandler_0_1* handler, |
747 PP_Resource message_loop) { | 749 PP_Resource message_loop) { |
748 // Not yet implemented. See crbug.com/367896 | 750 InstanceData* data = |
749 return PP_ERROR_NOTSUPPORTED; | 751 static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance); |
752 if (!data) | |
753 return PP_ERROR_BADARGUMENT; | |
754 | |
755 int32_t result = PP_ERROR_FAILED; | |
756 scoped_ptr<MessageHandler> message_handler = MessageHandler::Create( | |
757 instance, handler, user_data, message_loop, &result); | |
758 if (message_handler) { | |
raymes
2014/06/06 06:38:17
nit: no need for {}
| |
759 data->message_handler = message_handler.Pass(); | |
760 } | |
761 return result; | |
750 } | 762 } |
751 | 763 |
752 void PPB_Instance_Proxy::UnregisterMessageHandler(PP_Instance instance) { | 764 void PPB_Instance_Proxy::UnregisterMessageHandler(PP_Instance instance) { |
753 // Not yet implemented. See crbug.com/367896 | 765 InstanceData* data = |
766 static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance); | |
767 if (!data) | |
768 return; | |
769 data->message_handler.reset(); | |
754 } | 770 } |
755 | 771 |
756 PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance, | 772 PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance, |
757 PP_MouseCursor_Type type, | 773 PP_MouseCursor_Type type, |
758 PP_Resource image, | 774 PP_Resource image, |
759 const PP_Point* hot_spot) { | 775 const PP_Point* hot_spot) { |
760 // Some of these parameters are important for security. This check is in the | 776 // Some of these parameters are important for security. This check is in the |
761 // plugin process just for the convenience of the caller (since we don't | 777 // plugin process just for the convenience of the caller (since we don't |
762 // bother returning errors from the other process with a sync message). The | 778 // bother returning errors from the other process with a sync message). The |
763 // parameters will be validated again in the renderer. | 779 // parameters will be validated again in the renderer. |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1361 PP_Instance instance) { | 1377 PP_Instance instance) { |
1362 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 1378 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
1363 GetInstanceData(instance); | 1379 GetInstanceData(instance); |
1364 if (!data) | 1380 if (!data) |
1365 return; // Instance was probably deleted. | 1381 return; // Instance was probably deleted. |
1366 data->should_do_request_surrounding_text = false; | 1382 data->should_do_request_surrounding_text = false; |
1367 } | 1383 } |
1368 | 1384 |
1369 } // namespace proxy | 1385 } // namespace proxy |
1370 } // namespace ppapi | 1386 } // namespace ppapi |
OLD | NEW |