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

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
« no previous file with comments | « ppapi/proxy/ppapi_messages.h ('k') | ppapi/proxy/ppb_message_loop_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/file_mapping_resource.h" 21 #include "ppapi/proxy/file_mapping_resource.h"
22 #include "ppapi/proxy/flash_clipboard_resource.h" 22 #include "ppapi/proxy/flash_clipboard_resource.h"
23 #include "ppapi/proxy/flash_file_resource.h" 23 #include "ppapi/proxy/flash_file_resource.h"
24 #include "ppapi/proxy/flash_fullscreen_resource.h" 24 #include "ppapi/proxy/flash_fullscreen_resource.h"
25 #include "ppapi/proxy/flash_resource.h" 25 #include "ppapi/proxy/flash_resource.h"
26 #include "ppapi/proxy/gamepad_resource.h" 26 #include "ppapi/proxy/gamepad_resource.h"
27 #include "ppapi/proxy/host_dispatcher.h" 27 #include "ppapi/proxy/host_dispatcher.h"
28 #include "ppapi/proxy/isolated_file_system_private_resource.h" 28 #include "ppapi/proxy/isolated_file_system_private_resource.h"
29 #include "ppapi/proxy/message_handler.h"
29 #include "ppapi/proxy/network_proxy_resource.h" 30 #include "ppapi/proxy/network_proxy_resource.h"
30 #include "ppapi/proxy/pdf_resource.h" 31 #include "ppapi/proxy/pdf_resource.h"
31 #include "ppapi/proxy/plugin_dispatcher.h" 32 #include "ppapi/proxy/plugin_dispatcher.h"
32 #include "ppapi/proxy/ppapi_messages.h" 33 #include "ppapi/proxy/ppapi_messages.h"
33 #include "ppapi/proxy/serialized_var.h" 34 #include "ppapi/proxy/serialized_var.h"
34 #include "ppapi/proxy/truetype_font_singleton_resource.h" 35 #include "ppapi/proxy/truetype_font_singleton_resource.h"
35 #include "ppapi/proxy/uma_private_resource.h" 36 #include "ppapi/proxy/uma_private_resource.h"
36 #include "ppapi/shared_impl/ppapi_globals.h" 37 #include "ppapi/shared_impl/ppapi_globals.h"
37 #include "ppapi/shared_impl/ppb_url_util_shared.h" 38 #include "ppapi/shared_impl/ppb_url_util_shared.h"
38 #include "ppapi/shared_impl/ppb_view_shared.h" 39 #include "ppapi/shared_impl/ppb_view_shared.h"
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 } 767 }
767 #endif // !defined(OS_NACL) 768 #endif // !defined(OS_NACL)
768 769
769 void PPB_Instance_Proxy::PostMessage(PP_Instance instance, 770 void PPB_Instance_Proxy::PostMessage(PP_Instance instance,
770 PP_Var message) { 771 PP_Var message) {
771 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage( 772 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage(
772 API_ID_PPB_INSTANCE, 773 API_ID_PPB_INSTANCE,
773 instance, SerializedVarSendInputShmem(dispatcher(), message, 774 instance, SerializedVarSendInputShmem(dispatcher(), message,
774 instance))); 775 instance)));
775 } 776 }
777
776 int32_t PPB_Instance_Proxy::RegisterMessageHandler( 778 int32_t PPB_Instance_Proxy::RegisterMessageHandler(
777 PP_Instance instance, 779 PP_Instance instance,
778 void* user_data, 780 void* user_data,
779 const PPP_MessageHandler_0_1* handler, 781 const PPP_MessageHandler_0_1* handler,
780 PP_Resource message_loop) { 782 PP_Resource message_loop) {
781 // Not yet implemented. See crbug.com/367896 783 InstanceData* data =
782 return PP_ERROR_NOTSUPPORTED; 784 static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance);
785 if (!data)
786 return PP_ERROR_BADARGUMENT;
787
788 int32_t result = PP_ERROR_FAILED;
789 scoped_ptr<MessageHandler> message_handler = MessageHandler::Create(
790 instance, handler, user_data, message_loop, &result);
791 if (message_handler)
792 data->message_handler = message_handler.Pass();
793 return result;
783 } 794 }
784 795
785 void PPB_Instance_Proxy::UnregisterMessageHandler(PP_Instance instance) { 796 void PPB_Instance_Proxy::UnregisterMessageHandler(PP_Instance instance) {
786 // Not yet implemented. See crbug.com/367896 797 InstanceData* data =
798 static_cast<PluginDispatcher*>(dispatcher())->GetInstanceData(instance);
799 if (!data)
800 return;
801 data->message_handler.reset();
787 } 802 }
788 803
789 PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance, 804 PP_Bool PPB_Instance_Proxy::SetCursor(PP_Instance instance,
790 PP_MouseCursor_Type type, 805 PP_MouseCursor_Type type,
791 PP_Resource image, 806 PP_Resource image,
792 const PP_Point* hot_spot) { 807 const PP_Point* hot_spot) {
793 // Some of these parameters are important for security. This check is in the 808 // Some of these parameters are important for security. This check is in the
794 // plugin process just for the convenience of the caller (since we don't 809 // plugin process just for the convenience of the caller (since we don't
795 // bother returning errors from the other process with a sync message). The 810 // bother returning errors from the other process with a sync message). The
796 // parameters will be validated again in the renderer. 811 // parameters will be validated again in the renderer.
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 PP_Instance instance) { 1445 PP_Instance instance) {
1431 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 1446 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
1432 GetInstanceData(instance); 1447 GetInstanceData(instance);
1433 if (!data) 1448 if (!data)
1434 return; // Instance was probably deleted. 1449 return; // Instance was probably deleted.
1435 data->should_do_request_surrounding_text = false; 1450 data->should_do_request_surrounding_text = false;
1436 } 1451 }
1437 1452
1438 } // namespace proxy 1453 } // namespace proxy
1439 } // namespace ppapi 1454 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppapi_messages.h ('k') | ppapi/proxy/ppb_message_loop_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698