| 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" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 using ppapi::thunk::EnterResourceNoLock; | 49 using ppapi::thunk::EnterResourceNoLock; |
| 50 using ppapi::thunk::PPB_Graphics2D_API; | 50 using ppapi::thunk::PPB_Graphics2D_API; |
| 51 using ppapi::thunk::PPB_Graphics3D_API; | 51 using ppapi::thunk::PPB_Graphics3D_API; |
| 52 using ppapi::thunk::PPB_Instance_API; | 52 using ppapi::thunk::PPB_Instance_API; |
| 53 | 53 |
| 54 namespace ppapi { | 54 namespace ppapi { |
| 55 namespace proxy { | 55 namespace proxy { |
| 56 | 56 |
| 57 namespace { | 57 namespace { |
| 58 | 58 |
| 59 const char kSerializationError[] = "Failed to convert a PostMessage " |
| 60 "argument from a PP_Var to a Javascript value. It may have cycles or be of " |
| 61 "an unsupported type."; |
| 62 |
| 59 InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher) { | 63 InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher) { |
| 60 return new PPB_Instance_Proxy(dispatcher); | 64 return new PPB_Instance_Proxy(dispatcher); |
| 61 } | 65 } |
| 62 | 66 |
| 63 void RequestSurroundingText(PP_Instance instance) { | 67 void RequestSurroundingText(PP_Instance instance) { |
| 64 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 68 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 65 if (!dispatcher) | 69 if (!dispatcher) |
| 66 return; // Instance has gone away while message was pending. | 70 return; // Instance has gone away while message was pending. |
| 67 | 71 |
| 68 InstanceData* data = dispatcher->GetInstanceData(instance); | 72 InstanceData* data = dispatcher->GetInstanceData(instance); |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 uint32_t event_classes) { | 930 uint32_t event_classes) { |
| 927 EnterInstanceNoLock enter(instance); | 931 EnterInstanceNoLock enter(instance); |
| 928 if (enter.succeeded()) | 932 if (enter.succeeded()) |
| 929 enter.functions()->ClearInputEventRequest(instance, event_classes); | 933 enter.functions()->ClearInputEventRequest(instance, event_classes); |
| 930 } | 934 } |
| 931 | 935 |
| 932 void PPB_Instance_Proxy::OnHostMsgPostMessage( | 936 void PPB_Instance_Proxy::OnHostMsgPostMessage( |
| 933 PP_Instance instance, | 937 PP_Instance instance, |
| 934 SerializedVarReceiveInput message) { | 938 SerializedVarReceiveInput message) { |
| 935 EnterInstanceNoLock enter(instance); | 939 EnterInstanceNoLock enter(instance); |
| 940 if (!message.is_valid_var()) { |
| 941 PpapiGlobals::Get()->LogWithSource( |
| 942 instance, PP_LOGLEVEL_ERROR, std::string(), kSerializationError); |
| 943 return; |
| 944 } |
| 945 |
| 936 if (enter.succeeded()) | 946 if (enter.succeeded()) |
| 937 enter.functions()->PostMessage(instance, | 947 enter.functions()->PostMessage(instance, |
| 938 message.GetForInstance(dispatcher(), | 948 message.GetForInstance(dispatcher(), |
| 939 instance)); | 949 instance)); |
| 940 } | 950 } |
| 941 | 951 |
| 942 void PPB_Instance_Proxy::OnHostMsgLockMouse(PP_Instance instance) { | 952 void PPB_Instance_Proxy::OnHostMsgLockMouse(PP_Instance instance) { |
| 943 // Need to be careful to always issue the callback. | 953 // Need to be careful to always issue the callback. |
| 944 pp::CompletionCallback cb = callback_factory_.NewCallback( | 954 pp::CompletionCallback cb = callback_factory_.NewCallback( |
| 945 &PPB_Instance_Proxy::MouseLockCompleteInHost, instance); | 955 &PPB_Instance_Proxy::MouseLockCompleteInHost, instance); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 PP_Instance instance) { | 1264 PP_Instance instance) { |
| 1255 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 1265 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
| 1256 GetInstanceData(instance); | 1266 GetInstanceData(instance); |
| 1257 if (!data) | 1267 if (!data) |
| 1258 return; // Instance was probably deleted. | 1268 return; // Instance was probably deleted. |
| 1259 data->should_do_request_surrounding_text = false; | 1269 data->should_do_request_surrounding_text = false; |
| 1260 } | 1270 } |
| 1261 | 1271 |
| 1262 } // namespace proxy | 1272 } // namespace proxy |
| 1263 } // namespace ppapi | 1273 } // namespace ppapi |
| OLD | NEW |