Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(945)

Side by Side Diff: ppapi/proxy/ppb_instance_proxy.cc

Issue 264303002: PPAPI: Implement synchronous postMessage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 } 768 }
768 #endif // !defined(OS_NACL) 769 #endif // !defined(OS_NACL)
769 770
770 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, 771 void PPB_Instance_Proxy::PostMessage(PP_Instance instance,
771 PP_Var message) { 772 PP_Var message) {
772 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( 773 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage(
773 API_ID_PPB_INSTANCE, 774 API_ID_PPB_INSTANCE,
774 instance, SerializedVarSendInputShmem(dispatcher(), message, 775 instance, SerializedVarSendInputShmem(dispatcher(), message,
775 instance))); 776 instance)));
776 } 777 }
778
777 int32_t PPB_Instance_Proxy::RegisterMessageHandler( 779 int32_t PPB_Instance_Proxy::RegisterMessageHandler(
778 PP_Instance instance, 780 PP_Instance instance,
779 void* user_data, 781 void* user_data,
780 const PPP_MessageHandler_0_1* handler, 782 const PPP_MessageHandler_0_1* handler,
781 PP_Resource message_loop) { 783 PP_Resource message_loop) {
782 // Not yet implemented. See crbug.com/367896 784 InstanceData* data =
783 return PP_ERROR_NOTSUPPORTED; 785 static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance);
786 if (!data)
787 return PP_ERROR_BADARGUMENT;
788
789 int32_t result = PP_ERROR_FAILED;
790 scoped_ptr<MessageHandler> message_handler = MessageHandler::Create(
791 instance, handler, user_data, message_loop, &result);
792 if (message_handler)
793 data->message_handler = message_handler.Pass();
794 return result;
784 } 795 }
785 796
786 void PPB_Instance_Proxy::UnregisterMessageHandler(PP_Instance instance) { 797 void PPB_Instance_Proxy::UnregisterMessageHandler(PP_Instance instance) {
787 // Not yet implemented. See crbug.com/367896 798 InstanceData* data =
799 static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance);
800 if (!data)
801 return;
802 data->message_handler.reset();
788 } 803 }
789 804
790 PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance, 805 PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance,
791 PP_MouseCursor_Type type, 806 PP_MouseCursor_Type type,
792 PP_Resource image, 807 PP_Resource image,
793 const PP_Point* hot_spot) { 808 const PP_Point* hot_spot) {
794 // Some of these parameters are important for security. This check is in the 809 // Some of these parameters are important for security. This check is in the
795 // plugin process just for the convenience of the caller (since we don't 810 // plugin process just for the convenience of the caller (since we don't
796 // bother returning errors from the other process with a sync message). The 811 // bother returning errors from the other process with a sync message). The
797 // parameters will be validated again in the renderer. 812 // parameters will be validated again in the renderer.
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 PP_Instance instance) { 1446 PP_Instance instance) {
1432 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 1447 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
1433 GetInstanceData(instance); 1448 GetInstanceData(instance);
1434 if (!data) 1449 if (!data)
1435 return; // Instance was probably deleted. 1450 return; // Instance was probably deleted.
1436 data->should_do_request_surrounding_text = false; 1451 data->should_do_request_surrounding_text = false;
1437 } 1452 }
1438 1453
1439 } // namespace proxy 1454 } // namespace proxy
1440 } // namespace ppapi 1455 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698