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
3 // found in the LICENSE file.
5 #include "ppapi/proxy/ppb_instance_proxy.h"
7 #include "base/memory/ref_counted.h"
8 #include "build/build_config.h"
9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/pp_time.h"
11 #include "ppapi/c/pp_var.h"
12 #include "ppapi/c/ppb_audio_config.h"
13 #include "ppapi/c/ppb_instance.h"
14 #include "ppapi/c/ppb_messaging.h"
15 #include "ppapi/c/ppb_mouse_lock.h"
16 #include "ppapi/c/private/pp_content_decryptor.h"
17 #include "ppapi/proxy/broker_resource.h"
18 #include "ppapi/proxy/content_decryptor_private_serializer.h"
19 #include "ppapi/proxy/enter_proxy.h"
20 #include "ppapi/proxy/flash_clipboard_resource.h"
21 #include "ppapi/proxy/flash_file_resource.h"
22 #include "ppapi/proxy/flash_fullscreen_resource.h"
23 #include "ppapi/proxy/flash_resource.h"
24 #include "ppapi/proxy/gamepad_resource.h"
25 #include "ppapi/proxy/host_dispatcher.h"
26 #include "ppapi/proxy/plugin_dispatcher.h"
27 #include "ppapi/proxy/ppapi_messages.h"
28 #include "ppapi/proxy/ppb_flash_proxy.h"
29 #include "ppapi/proxy/serialized_var.h"
30 #include "ppapi/shared_impl/ppapi_globals.h"
31 #include "ppapi/shared_impl/ppb_url_util_shared.h"
32 #include "ppapi/shared_impl/ppb_view_shared.h"
33 #include "ppapi/shared_impl/var.h"
34 #include "ppapi/thunk/enter.h"
35 #include "ppapi/thunk/ppb_graphics_2d_api.h"
36 #include "ppapi/thunk/ppb_graphics_3d_api.h"
37 #include "ppapi/thunk/thunk.h"
39 // Windows headers interfere with this file.
44 using ppapi::thunk::EnterInstanceNoLock
;
45 using ppapi::thunk::EnterResourceNoLock
;
46 using ppapi::thunk::PPB_Graphics2D_API
;
47 using ppapi::thunk::PPB_Graphics3D_API
;
48 using ppapi::thunk::PPB_Instance_API
;
55 InterfaceProxy
* CreateInstanceProxy(Dispatcher
* dispatcher
) {
56 return new PPB_Instance_Proxy(dispatcher
);
59 void RequestSurroundingText(PP_Instance instance
) {
60 PluginDispatcher
* dispatcher
= PluginDispatcher::GetForInstance(instance
);
62 return; // Instance has gone away while message was pending.
64 InstanceData
* data
= dispatcher
->GetInstanceData(instance
);
65 DCHECK(data
); // Should have it, since we still have a dispatcher.
66 data
->is_request_surrounding_text_pending
= false;
67 if (!data
->should_do_request_surrounding_text
)
70 // Just fake out a RequestSurroundingText message to the proxy for the PPP
72 InterfaceProxy
* proxy
= dispatcher
->GetInterfaceProxy(API_ID_PPP_TEXT_INPUT
);
75 proxy
->OnMessageReceived(PpapiMsg_PPPTextInput_RequestSurroundingText(
76 API_ID_PPP_TEXT_INPUT
, instance
,
77 PPB_Instance_Shared::kExtraCharsForTextInput
));
82 PPB_Instance_Proxy::PPB_Instance_Proxy(Dispatcher
* dispatcher
)
83 : InterfaceProxy(dispatcher
),
84 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
87 PPB_Instance_Proxy::~PPB_Instance_Proxy() {
91 const InterfaceProxy::Info
* PPB_Instance_Proxy::GetInfoPrivate() {
92 static const Info info
= {
93 ppapi::thunk::GetPPB_Instance_Private_0_1_Thunk(),
94 PPB_INSTANCE_PRIVATE_INTERFACE_0_1
,
95 API_ID_NONE
, // 1_0 is the canonical one.
102 bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message
& msg
) {
103 // Prevent the dispatcher from going away during a call to ExecuteScript.
104 // This must happen OUTSIDE of ExecuteScript since the SerializedVars use
105 // the dispatcher upon return of the function (converting the
106 // SerializedVarReturnValue/OutParam to a SerializedVar in the destructor).
107 #if !defined(OS_NACL)
108 ScopedModuleReference
death_grip(dispatcher());
112 IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy
, msg
)
113 #if !defined(OS_NACL)
114 // Plugin -> Host messages.
115 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject
,
116 OnHostMsgGetWindowObject
)
117 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetOwnerElementObject
,
118 OnHostMsgGetOwnerElementObject
)
119 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_BindGraphics
,
120 OnHostMsgBindGraphics
)
121 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_IsFullFrame
,
122 OnHostMsgIsFullFrame
)
124 PpapiHostMsg_PPBInstance_GetAudioHardwareOutputSampleRate
,
125 OnHostMsgGetAudioHardwareOutputSampleRate
)
127 PpapiHostMsg_PPBInstance_GetAudioHardwareOutputBufferSize
,
128 OnHostMsgGetAudioHardwareOutputBufferSize
)
129 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript
,
130 OnHostMsgExecuteScript
)
131 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDefaultCharSet
,
132 OnHostMsgGetDefaultCharSet
)
133 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PostMessage
,
134 OnHostMsgPostMessage
)
135 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetFullscreen
,
136 OnHostMsgSetFullscreen
)
137 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetScreenSize
,
138 OnHostMsgGetScreenSize
)
139 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_RequestInputEvents
,
140 OnHostMsgRequestInputEvents
)
141 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ClearInputEvents
,
142 OnHostMsgClearInputEvents
)
143 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInputEvent_HandleInputEvent_ACK
,
144 OnMsgHandleInputEventAck
)
145 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_LockMouse
,
147 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UnlockMouse
,
148 OnHostMsgUnlockMouse
)
149 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetCursor
,
151 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SetTextInputType
,
152 OnHostMsgSetTextInputType
)
153 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateCaretPosition
,
154 OnHostMsgUpdateCaretPosition
)
155 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_CancelCompositionText
,
156 OnHostMsgCancelCompositionText
)
157 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_UpdateSurroundingText
,
158 OnHostMsgUpdateSurroundingText
)
159 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetDocumentURL
,
160 OnHostMsgGetDocumentURL
)
161 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument
,
162 OnHostMsgResolveRelativeToDocument
)
163 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest
,
164 OnHostMsgDocumentCanRequest
)
165 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument
,
166 OnHostMsgDocumentCanAccessDocument
)
167 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL
,
168 OnHostMsgGetPluginInstanceURL
)
169 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_NeedKey
,
171 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyAdded
,
173 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyMessage
,
175 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_KeyError
,
177 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock
,
178 OnHostMsgDeliverBlock
)
179 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DecoderInitializeDone
,
180 OnHostMsgDecoderInitializeDone
)
181 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DecoderDeinitializeDone
,
182 OnHostMsgDecoderDeinitializeDone
)
183 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DecoderResetDone
,
184 OnHostMsgDecoderResetDone
)
185 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverFrame
,
186 OnHostMsgDeliverFrame
)
187 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverSamples
,
188 OnHostMsgDeliverSamples
)
189 #endif // !defined(OS_NACL)
191 // Host -> Plugin messages.
192 IPC_MESSAGE_HANDLER(PpapiMsg_PPBInstance_MouseLockComplete
,
193 OnPluginMsgMouseLockComplete
)
195 IPC_MESSAGE_UNHANDLED(handled
= false)
196 IPC_END_MESSAGE_MAP()
200 PP_Bool
PPB_Instance_Proxy::BindGraphics(PP_Instance instance
,
201 PP_Resource device
) {
202 // If device is 0, pass a null HostResource. This signals the host to unbind
204 HostResource host_resource
;
205 PP_Resource pp_resource
= 0;
208 PpapiGlobals::Get()->GetResourceTracker()->GetResource(device
);
209 if (!resource
|| resource
->pp_instance() != instance
)
211 host_resource
= resource
->host_resource();
212 pp_resource
= resource
->pp_resource();
214 // Passing 0 means unbinding all devices.
215 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
216 API_ID_PPB_INSTANCE
, instance
, 0));
220 // We need to pass different resource to Graphics 2D and 3D right now. Once
221 // 3D is migrated to the new design, we should be able to unify this.
222 EnterResourceNoLock
<PPB_Graphics2D_API
> enter_2d(device
, false);
223 EnterResourceNoLock
<PPB_Graphics3D_API
> enter_3d(device
, false);
224 if (enter_2d
.succeeded()) {
225 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
226 API_ID_PPB_INSTANCE
, instance
, pp_resource
));
228 } else if (enter_3d
.succeeded()) {
229 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
230 API_ID_PPB_INSTANCE
, instance
, host_resource
.host_resource()));
236 PP_Bool
PPB_Instance_Proxy::IsFullFrame(PP_Instance instance
) {
237 PP_Bool result
= PP_FALSE
;
238 dispatcher()->Send(new PpapiHostMsg_PPBInstance_IsFullFrame(
239 API_ID_PPB_INSTANCE
, instance
, &result
));
243 const ViewData
* PPB_Instance_Proxy::GetViewData(PP_Instance instance
) {
244 InstanceData
* data
= static_cast<PluginDispatcher
*>(dispatcher())->
245 GetInstanceData(instance
);
251 PP_Bool
PPB_Instance_Proxy::FlashIsFullscreen(PP_Instance instance
) {
252 // This function is only used for proxying in the renderer process. It is not
253 // implemented in the plugin process.
258 PP_Var
PPB_Instance_Proxy::GetWindowObject(PP_Instance instance
) {
259 ReceiveSerializedVarReturnValue result
;
260 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetWindowObject(
261 API_ID_PPB_INSTANCE
, instance
, &result
));
262 return result
.Return(dispatcher());
265 PP_Var
PPB_Instance_Proxy::GetOwnerElementObject(PP_Instance instance
) {
266 ReceiveSerializedVarReturnValue result
;
267 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetOwnerElementObject(
268 API_ID_PPB_INSTANCE
, instance
, &result
));
269 return result
.Return(dispatcher());
272 PP_Var
PPB_Instance_Proxy::ExecuteScript(PP_Instance instance
,
275 ReceiveSerializedException
se(dispatcher(), exception
);
277 return PP_MakeUndefined();
279 ReceiveSerializedVarReturnValue result
;
280 dispatcher()->Send(new PpapiHostMsg_PPBInstance_ExecuteScript(
281 API_ID_PPB_INSTANCE
, instance
,
282 SerializedVarSendInput(dispatcher(), script
), &se
, &result
));
283 return result
.Return(dispatcher());
286 uint32_t PPB_Instance_Proxy::GetAudioHardwareOutputSampleRate(
287 PP_Instance instance
) {
288 uint32_t result
= PP_AUDIOSAMPLERATE_NONE
;
290 new PpapiHostMsg_PPBInstance_GetAudioHardwareOutputSampleRate(
291 API_ID_PPB_INSTANCE
, instance
, &result
));
295 uint32_t PPB_Instance_Proxy::GetAudioHardwareOutputBufferSize(
296 PP_Instance instance
) {
299 new PpapiHostMsg_PPBInstance_GetAudioHardwareOutputBufferSize(
300 API_ID_PPB_INSTANCE
, instance
, &result
));
304 PP_Var
PPB_Instance_Proxy::GetDefaultCharSet(PP_Instance instance
) {
305 PluginDispatcher
* dispatcher
= PluginDispatcher::GetForInstance(instance
);
307 return PP_MakeUndefined();
309 ReceiveSerializedVarReturnValue result
;
310 dispatcher
->Send(new PpapiHostMsg_PPBInstance_GetDefaultCharSet(
311 API_ID_PPB_INSTANCE
, instance
, &result
));
312 return result
.Return(dispatcher
);
315 void PPB_Instance_Proxy::NumberOfFindResultsChanged(PP_Instance instance
,
317 PP_Bool final_result
) {
318 NOTIMPLEMENTED(); // Not proxied yet.
321 void PPB_Instance_Proxy::SelectedFindResultChanged(PP_Instance instance
,
323 NOTIMPLEMENTED(); // Not proxied yet.
326 PP_Var
PPB_Instance_Proxy::GetFontFamilies(PP_Instance instance
) {
327 PluginDispatcher
* dispatcher
= PluginDispatcher::GetForInstance(instance
);
329 return PP_MakeUndefined();
331 // Assume the font families don't change, so we can cache the result globally.
332 CR_DEFINE_STATIC_LOCAL(std::string
, families
, ());
333 if (families
.empty()) {
334 PluginGlobals::Get()->GetBrowserSender()->Send(
335 new PpapiHostMsg_PPBInstance_GetFontFamilies(&families
));
338 return StringVar::StringToPPVar(families
);
341 PP_Bool
PPB_Instance_Proxy::SetFullscreen(PP_Instance instance
,
342 PP_Bool fullscreen
) {
343 PP_Bool result
= PP_FALSE
;
344 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetFullscreen(
345 API_ID_PPB_INSTANCE
, instance
, fullscreen
, &result
));
349 PP_Bool
PPB_Instance_Proxy::GetScreenSize(PP_Instance instance
,
351 PP_Bool result
= PP_FALSE
;
352 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetScreenSize(
353 API_ID_PPB_INSTANCE
, instance
, &result
, size
));
357 thunk::PPB_Flash_API
* PPB_Instance_Proxy::GetFlashAPI() {
358 InterfaceProxy
* ip
= dispatcher()->GetInterfaceProxy(API_ID_PPB_FLASH
);
359 return static_cast<PPB_Flash_Proxy
*>(ip
);
362 Resource
* PPB_Instance_Proxy::GetSingletonResource(PP_Instance instance
,
363 SingletonResourceID id
) {
364 InstanceData
* data
= static_cast<PluginDispatcher
*>(dispatcher())->
365 GetInstanceData(instance
);
367 InstanceData::SingletonResourceMap::iterator it
=
368 data
->singleton_resources
.find(id
);
369 if (it
!= data
->singleton_resources
.end())
370 return it
->second
.get();
372 scoped_refptr
<Resource
> new_singleton
;
373 Connection
connection(PluginGlobals::Get()->GetBrowserSender(), dispatcher());
376 case BROKER_SINGLETON_ID
:
377 new_singleton
= new BrokerResource(connection
, instance
);
379 case GAMEPAD_SINGLETON_ID
:
380 new_singleton
= new GamepadResource(connection
, instance
);
382 // Flash resources aren't needed for NaCl.
383 #if !defined(OS_NACL) && !defined(NACL_WIN64)
384 case FLASH_CLIPBOARD_SINGLETON_ID
:
385 new_singleton
= new FlashClipboardResource(connection
, instance
);
387 case FLASH_FILE_SINGLETON_ID
:
388 new_singleton
= new FlashFileResource(connection
, instance
);
390 case FLASH_FULLSCREEN_SINGLETON_ID
:
391 new_singleton
= new FlashFullscreenResource(connection
, instance
);
393 case FLASH_SINGLETON_ID
:
394 new_singleton
= new FlashResource(connection
, instance
);
397 case FLASH_CLIPBOARD_SINGLETON_ID
:
398 case FLASH_FILE_SINGLETON_ID
:
399 case FLASH_FULLSCREEN_SINGLETON_ID
:
400 case FLASH_SINGLETON_ID
:
403 #endif // !defined(OS_NACL) && !defined(NACL_WIN64)
406 if (!new_singleton
) {
407 // Getting here implies that a constructor is missing in the above switch.
412 data
->singleton_resources
[id
] = new_singleton
;
413 return new_singleton
.get();
416 int32_t PPB_Instance_Proxy::RequestInputEvents(PP_Instance instance
,
417 uint32_t event_classes
) {
418 dispatcher()->Send(new PpapiHostMsg_PPBInstance_RequestInputEvents(
419 API_ID_PPB_INSTANCE
, instance
, false, event_classes
));
421 // We always register for the classes we can handle, this function validates
422 // the flags so we can notify it if anything was invalid, without requiring
424 return ValidateRequestInputEvents(false, event_classes
);
427 int32_t PPB_Instance_Proxy::RequestFilteringInputEvents(
428 PP_Instance instance
,
429 uint32_t event_classes
) {
430 dispatcher()->Send(new PpapiHostMsg_PPBInstance_RequestInputEvents(
431 API_ID_PPB_INSTANCE
, instance
, true, event_classes
));
433 // We always register for the classes we can handle, this function validates
434 // the flags so we can notify it if anything was invalid, without requiring
436 return ValidateRequestInputEvents(true, event_classes
);
439 void PPB_Instance_Proxy::ClearInputEventRequest(PP_Instance instance
,
440 uint32_t event_classes
) {
441 dispatcher()->Send(new PpapiHostMsg_PPBInstance_ClearInputEvents(
442 API_ID_PPB_INSTANCE
, instance
, event_classes
));
445 void PPB_Instance_Proxy::ClosePendingUserGesture(PP_Instance instance
,
446 PP_TimeTicks timestamp
) {
447 // Not called on the plugin side.
451 void PPB_Instance_Proxy::ZoomChanged(PP_Instance instance
,
457 void PPB_Instance_Proxy::ZoomLimitsChanged(PP_Instance instance
,
458 double minimum_factor
,
459 double maximium_factor
) {
464 PP_Var
PPB_Instance_Proxy::GetDocumentURL(PP_Instance instance
,
465 PP_URLComponents_Dev
* components
) {
466 ReceiveSerializedVarReturnValue result
;
467 PP_URLComponents_Dev url_components
;
468 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetDocumentURL(
469 API_ID_PPB_INSTANCE
, instance
, &url_components
, &result
));
471 *components
= url_components
;
472 return result
.Return(dispatcher());
475 #if !defined(OS_NACL)
476 PP_Var
PPB_Instance_Proxy::ResolveRelativeToDocument(
477 PP_Instance instance
,
479 PP_URLComponents_Dev
* components
) {
480 ReceiveSerializedVarReturnValue result
;
481 dispatcher()->Send(new PpapiHostMsg_PPBInstance_ResolveRelativeToDocument(
482 API_ID_PPB_INSTANCE
, instance
,
483 SerializedVarSendInput(dispatcher(), relative
),
485 return PPB_URLUtil_Shared::ConvertComponentsAndReturnURL(
486 result
.Return(dispatcher()),
490 PP_Bool
PPB_Instance_Proxy::DocumentCanRequest(PP_Instance instance
,
492 PP_Bool result
= PP_FALSE
;
493 dispatcher()->Send(new PpapiHostMsg_PPBInstance_DocumentCanRequest(
494 API_ID_PPB_INSTANCE
, instance
,
495 SerializedVarSendInput(dispatcher(), url
),
500 PP_Bool
PPB_Instance_Proxy::DocumentCanAccessDocument(PP_Instance instance
,
501 PP_Instance target
) {
502 PP_Bool result
= PP_FALSE
;
503 dispatcher()->Send(new PpapiHostMsg_PPBInstance_DocumentCanAccessDocument(
504 API_ID_PPB_INSTANCE
, instance
, target
, &result
));
508 PP_Var
PPB_Instance_Proxy::GetPluginInstanceURL(
509 PP_Instance instance
,
510 PP_URLComponents_Dev
* components
) {
511 ReceiveSerializedVarReturnValue result
;
512 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetPluginInstanceURL(
513 API_ID_PPB_INSTANCE
, instance
, &result
));
514 return PPB_URLUtil_Shared::ConvertComponentsAndReturnURL(
515 result
.Return(dispatcher()),
519 void PPB_Instance_Proxy::NeedKey(PP_Instance instance
,
524 new PpapiHostMsg_PPBInstance_NeedKey(
527 SerializedVarSendInput(dispatcher(), key_system
),
528 SerializedVarSendInput(dispatcher(), session_id
),
529 SerializedVarSendInput(dispatcher(), init_data
)));
532 void PPB_Instance_Proxy::KeyAdded(PP_Instance instance
,
536 new PpapiHostMsg_PPBInstance_KeyAdded(
539 SerializedVarSendInput(dispatcher(), key_system
),
540 SerializedVarSendInput(dispatcher(), session_id
)));
543 void PPB_Instance_Proxy::KeyMessage(PP_Instance instance
,
547 PP_Var default_url
) {
549 new PpapiHostMsg_PPBInstance_KeyMessage(
552 SerializedVarSendInput(dispatcher(), key_system
),
553 SerializedVarSendInput(dispatcher(), session_id
),
554 SerializedVarSendInput(dispatcher(), message
),
555 SerializedVarSendInput(dispatcher(), default_url
)));
558 void PPB_Instance_Proxy::KeyError(PP_Instance instance
,
562 int32_t system_code
) {
564 new PpapiHostMsg_PPBInstance_KeyError(
567 SerializedVarSendInput(dispatcher(), key_system
),
568 SerializedVarSendInput(dispatcher(), session_id
),
573 void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance
,
574 PP_Resource decrypted_block
,
575 const PP_DecryptedBlockInfo
* block_info
) {
576 PP_Resource decrypted_block_host_resource
= 0;
578 if (decrypted_block
) {
580 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_block
);
581 if (!object
|| object
->pp_instance() != instance
) {
585 decrypted_block_host_resource
= object
->host_resource().host_resource();
588 std::string serialized_block_info
;
589 if (!SerializeBlockInfo(*block_info
, &serialized_block_info
)) {
595 new PpapiHostMsg_PPBInstance_DeliverBlock(API_ID_PPB_INSTANCE
,
597 decrypted_block_host_resource
,
598 serialized_block_info
));
601 void PPB_Instance_Proxy::DecoderInitializeDone(
602 PP_Instance instance
,
603 PP_DecryptorStreamType decoder_type
,
607 new PpapiHostMsg_PPBInstance_DecoderInitializeDone(
615 void PPB_Instance_Proxy::DecoderDeinitializeDone(
616 PP_Instance instance
,
617 PP_DecryptorStreamType decoder_type
,
618 uint32_t request_id
) {
620 new PpapiHostMsg_PPBInstance_DecoderDeinitializeDone(
627 void PPB_Instance_Proxy::DecoderResetDone(PP_Instance instance
,
628 PP_DecryptorStreamType decoder_type
,
629 uint32_t request_id
) {
631 new PpapiHostMsg_PPBInstance_DecoderResetDone(
638 void PPB_Instance_Proxy::DeliverFrame(PP_Instance instance
,
639 PP_Resource decrypted_frame
,
640 const PP_DecryptedFrameInfo
* frame_info
) {
641 PP_Resource host_resource
= 0;
642 if (decrypted_frame
!= 0) {
643 ResourceTracker
* tracker
= PpapiGlobals::Get()->GetResourceTracker();
644 Resource
* object
= tracker
->GetResource(decrypted_frame
);
646 if (!object
|| object
->pp_instance() != instance
) {
651 host_resource
= object
->host_resource().host_resource();
654 std::string serialized_frame_info
;
655 if (!SerializeBlockInfo(*frame_info
, &serialized_frame_info
)) {
661 new PpapiHostMsg_PPBInstance_DeliverFrame(API_ID_PPB_INSTANCE
,
664 serialized_frame_info
));
667 void PPB_Instance_Proxy::DeliverSamples(
668 PP_Instance instance
,
669 PP_Resource decrypted_samples
,
670 const PP_DecryptedBlockInfo
* block_info
) {
671 PP_Resource host_resource
= 0;
672 if (decrypted_samples
!= 0) {
673 ResourceTracker
* tracker
= PpapiGlobals::Get()->GetResourceTracker();
674 Resource
* object
= tracker
->GetResource(decrypted_samples
);
676 if (!object
|| object
->pp_instance() != instance
) {
681 host_resource
= object
->host_resource().host_resource();
684 std::string serialized_block_info
;
685 if (!SerializeBlockInfo(*block_info
, &serialized_block_info
)) {
691 new PpapiHostMsg_PPBInstance_DeliverSamples(API_ID_PPB_INSTANCE
,
694 serialized_block_info
));
696 #endif // !defined(OS_NACL)
698 void PPB_Instance_Proxy::PostMessage(PP_Instance instance
,
700 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PostMessage(
702 instance
, SerializedVarSendInput(dispatcher(), message
)));
705 PP_Bool
PPB_Instance_Proxy::SetCursor(PP_Instance instance
,
706 PP_MouseCursor_Type type
,
708 const PP_Point
* hot_spot
) {
709 // Some of these parameters are important for security. This check is in the
710 // plugin process just for the convenience of the caller (since we don't
711 // bother returning errors from the other process with a sync message). The
712 // parameters will be validated again in the renderer.
713 if (!ValidateSetCursorParams(type
, image
, hot_spot
))
716 HostResource image_host_resource
;
718 Resource
* cursor_image
=
719 PpapiGlobals::Get()->GetResourceTracker()->GetResource(image
);
720 if (!cursor_image
|| cursor_image
->pp_instance() != instance
)
722 image_host_resource
= cursor_image
->host_resource();
725 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetCursor(
726 API_ID_PPB_INSTANCE
, instance
, static_cast<int32_t>(type
),
727 image_host_resource
, hot_spot
? *hot_spot
: PP_MakePoint(0, 0)));
731 int32_t PPB_Instance_Proxy::LockMouse(PP_Instance instance
,
732 scoped_refptr
<TrackedCallback
> callback
) {
733 // Save the mouse callback on the instance data.
734 InstanceData
* data
= static_cast<PluginDispatcher
*>(dispatcher())->
735 GetInstanceData(instance
);
737 return PP_ERROR_BADARGUMENT
;
738 if (TrackedCallback::IsPending(data
->mouse_lock_callback
))
739 return PP_ERROR_INPROGRESS
; // Already have a pending callback.
740 data
->mouse_lock_callback
= callback
;
742 dispatcher()->Send(new PpapiHostMsg_PPBInstance_LockMouse(
743 API_ID_PPB_INSTANCE
, instance
));
744 return PP_OK_COMPLETIONPENDING
;
747 void PPB_Instance_Proxy::UnlockMouse(PP_Instance instance
) {
748 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UnlockMouse(
749 API_ID_PPB_INSTANCE
, instance
));
752 void PPB_Instance_Proxy::SetTextInputType(PP_Instance instance
,
753 PP_TextInput_Type type
) {
754 CancelAnyPendingRequestSurroundingText(instance
);
755 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetTextInputType(
756 API_ID_PPB_INSTANCE
, instance
, type
));
759 void PPB_Instance_Proxy::UpdateCaretPosition(PP_Instance instance
,
760 const PP_Rect
& caret
,
761 const PP_Rect
& bounding_box
) {
762 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UpdateCaretPosition(
763 API_ID_PPB_INSTANCE
, instance
, caret
, bounding_box
));
766 void PPB_Instance_Proxy::CancelCompositionText(PP_Instance instance
) {
767 CancelAnyPendingRequestSurroundingText(instance
);
768 dispatcher()->Send(new PpapiHostMsg_PPBInstance_CancelCompositionText(
769 API_ID_PPB_INSTANCE
, instance
));
772 void PPB_Instance_Proxy::SelectionChanged(PP_Instance instance
) {
773 // The "right" way to do this is to send the message to the host. However,
774 // all it will do is call RequestSurroundingText with a hardcoded number of
775 // characters in response, which is an entire IPC round-trip.
777 // We can avoid this round-trip by just implementing the
778 // RequestSurroundingText logic in the plugin process. If the logic in the
779 // host becomes more complex (like a more adaptive number of characters),
780 // we'll need to reevanuate whether we want to do the round trip instead.
782 // Be careful to post a task to avoid reentering the plugin.
785 static_cast<PluginDispatcher
*>(dispatcher())->GetInstanceData(instance
);
788 data
->should_do_request_surrounding_text
= true;
790 if (!data
->is_request_surrounding_text_pending
) {
791 MessageLoop::current()->PostTask(
793 RunWhileLocked(base::Bind(&RequestSurroundingText
, instance
)));
794 data
->is_request_surrounding_text_pending
= true;
798 void PPB_Instance_Proxy::UpdateSurroundingText(PP_Instance instance
,
802 dispatcher()->Send(new PpapiHostMsg_PPBInstance_UpdateSurroundingText(
803 API_ID_PPB_INSTANCE
, instance
, text
, caret
, anchor
));
806 #if !defined(OS_NACL)
807 void PPB_Instance_Proxy::OnHostMsgGetWindowObject(
808 PP_Instance instance
,
809 SerializedVarReturnValue result
) {
810 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE
))
812 EnterInstanceNoLock
enter(instance
);
813 if (enter
.succeeded())
814 result
.Return(dispatcher(), enter
.functions()->GetWindowObject(instance
));
817 void PPB_Instance_Proxy::OnHostMsgGetOwnerElementObject(
818 PP_Instance instance
,
819 SerializedVarReturnValue result
) {
820 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE
))
822 EnterInstanceNoLock
enter(instance
);
823 if (enter
.succeeded()) {
824 result
.Return(dispatcher(),
825 enter
.functions()->GetOwnerElementObject(instance
));
829 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance
,
830 PP_Resource device
) {
831 // Note that we ignroe the return value here. Otherwise, this would need to
832 // be a slow sync call, and the plugin side of the proxy will have already
833 // validated the resources, so we shouldn't see errors here that weren't
835 EnterInstanceNoLock
enter(instance
);
836 if (enter
.succeeded())
837 enter
.functions()->BindGraphics(instance
, device
);
840 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputSampleRate(
841 PP_Instance instance
, uint32_t* result
) {
842 EnterInstanceNoLock
enter(instance
);
843 if (enter
.succeeded())
844 *result
= enter
.functions()->GetAudioHardwareOutputSampleRate(instance
);
847 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputBufferSize(
848 PP_Instance instance
, uint32_t* result
) {
849 EnterInstanceNoLock
enter(instance
);
850 if (enter
.succeeded())
851 *result
= enter
.functions()->GetAudioHardwareOutputBufferSize(instance
);
854 void PPB_Instance_Proxy::OnHostMsgIsFullFrame(PP_Instance instance
,
856 EnterInstanceNoLock
enter(instance
);
857 if (enter
.succeeded())
858 *result
= enter
.functions()->IsFullFrame(instance
);
861 void PPB_Instance_Proxy::OnHostMsgExecuteScript(
862 PP_Instance instance
,
863 SerializedVarReceiveInput script
,
864 SerializedVarOutParam out_exception
,
865 SerializedVarReturnValue result
) {
866 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE
))
868 EnterInstanceNoLock
enter(instance
);
872 if (dispatcher()->IsPlugin())
875 static_cast<HostDispatcher
*>(dispatcher())->set_allow_plugin_reentrancy();
877 result
.Return(dispatcher(), enter
.functions()->ExecuteScript(
879 script
.Get(dispatcher()),
880 out_exception
.OutParam(dispatcher())));
883 void PPB_Instance_Proxy::OnHostMsgGetDefaultCharSet(
884 PP_Instance instance
,
885 SerializedVarReturnValue result
) {
886 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV
))
888 EnterInstanceNoLock
enter(instance
);
889 if (enter
.succeeded())
890 result
.Return(dispatcher(), enter
.functions()->GetDefaultCharSet(instance
));
893 void PPB_Instance_Proxy::OnHostMsgSetFullscreen(PP_Instance instance
,
896 EnterInstanceNoLock
enter(instance
);
897 if (enter
.succeeded())
898 *result
= enter
.functions()->SetFullscreen(instance
, fullscreen
);
902 void PPB_Instance_Proxy::OnHostMsgGetScreenSize(PP_Instance instance
,
905 EnterInstanceNoLock
enter(instance
);
906 if (enter
.succeeded())
907 *result
= enter
.functions()->GetScreenSize(instance
, size
);
910 void PPB_Instance_Proxy::OnHostMsgRequestInputEvents(PP_Instance instance
,
912 uint32_t event_classes
) {
913 EnterInstanceNoLock
enter(instance
);
914 if (enter
.succeeded()) {
916 enter
.functions()->RequestFilteringInputEvents(instance
, event_classes
);
918 enter
.functions()->RequestInputEvents(instance
, event_classes
);
922 void PPB_Instance_Proxy::OnHostMsgClearInputEvents(PP_Instance instance
,
923 uint32_t event_classes
) {
924 EnterInstanceNoLock
enter(instance
);
925 if (enter
.succeeded())
926 enter
.functions()->ClearInputEventRequest(instance
, event_classes
);
929 void PPB_Instance_Proxy::OnMsgHandleInputEventAck(PP_Instance instance
,
930 PP_TimeTicks timestamp
) {
931 EnterInstanceNoLock
enter(instance
);
932 if (enter
.succeeded())
933 enter
.functions()->ClosePendingUserGesture(instance
, timestamp
);
936 void PPB_Instance_Proxy::OnHostMsgPostMessage(
937 PP_Instance instance
,
938 SerializedVarReceiveInput message
) {
939 EnterInstanceNoLock
enter(instance
);
940 if (enter
.succeeded())
941 enter
.functions()->PostMessage(instance
, message
.Get(dispatcher()));
944 void PPB_Instance_Proxy::OnHostMsgLockMouse(PP_Instance instance
) {
945 // Need to be careful to always issue the callback.
946 pp::CompletionCallback cb
= callback_factory_
.NewCallback(
947 &PPB_Instance_Proxy::MouseLockCompleteInHost
, instance
);
949 EnterInstanceNoLock
enter(instance
, cb
.pp_completion_callback());
950 if (enter
.succeeded())
951 enter
.SetResult(enter
.functions()->LockMouse(instance
, enter
.callback()));
954 void PPB_Instance_Proxy::OnHostMsgUnlockMouse(PP_Instance instance
) {
955 EnterInstanceNoLock
enter(instance
);
956 if (enter
.succeeded())
957 enter
.functions()->UnlockMouse(instance
);
960 void PPB_Instance_Proxy::OnHostMsgGetDocumentURL(
961 PP_Instance instance
,
962 PP_URLComponents_Dev
* components
,
963 SerializedVarReturnValue result
) {
964 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV
))
966 EnterInstanceNoLock
enter(instance
);
967 if (enter
.succeeded()) {
968 PP_Var document_url
= enter
.functions()->GetDocumentURL(instance
,
970 result
.Return(dispatcher(), document_url
);
974 void PPB_Instance_Proxy::OnHostMsgResolveRelativeToDocument(
975 PP_Instance instance
,
976 SerializedVarReceiveInput relative
,
977 SerializedVarReturnValue result
) {
978 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV
))
980 EnterInstanceNoLock
enter(instance
);
981 if (enter
.succeeded()) {
982 result
.Return(dispatcher(),
983 enter
.functions()->ResolveRelativeToDocument(
984 instance
, relative
.Get(dispatcher()), NULL
));
988 void PPB_Instance_Proxy::OnHostMsgDocumentCanRequest(
989 PP_Instance instance
,
990 SerializedVarReceiveInput url
,
992 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV
))
994 EnterInstanceNoLock
enter(instance
);
995 if (enter
.succeeded()) {
996 *result
= enter
.functions()->DocumentCanRequest(instance
,
997 url
.Get(dispatcher()));
1001 void PPB_Instance_Proxy::OnHostMsgDocumentCanAccessDocument(PP_Instance active
,
1004 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV
))
1006 EnterInstanceNoLock
enter(active
);
1007 if (enter
.succeeded())
1008 *result
= enter
.functions()->DocumentCanAccessDocument(active
, target
);
1011 void PPB_Instance_Proxy::OnHostMsgGetPluginInstanceURL(
1012 PP_Instance instance
,
1013 SerializedVarReturnValue result
) {
1014 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV
))
1016 EnterInstanceNoLock
enter(instance
);
1017 if (enter
.succeeded()) {
1018 result
.Return(dispatcher(),
1019 enter
.functions()->GetPluginInstanceURL(instance
, NULL
));
1023 void PPB_Instance_Proxy::OnHostMsgNeedKey(PP_Instance instance
,
1024 SerializedVarReceiveInput key_system
,
1025 SerializedVarReceiveInput session_id
,
1026 SerializedVarReceiveInput init_data
) {
1027 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE
))
1029 EnterInstanceNoLock
enter(instance
);
1030 if (enter
.succeeded()) {
1031 enter
.functions()->NeedKey(instance
,
1032 key_system
.Get(dispatcher()),
1033 session_id
.Get(dispatcher()),
1034 init_data
.Get(dispatcher()));
1038 void PPB_Instance_Proxy::OnHostMsgKeyAdded(
1039 PP_Instance instance
,
1040 SerializedVarReceiveInput key_system
,
1041 SerializedVarReceiveInput session_id
) {
1042 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE
))
1044 EnterInstanceNoLock
enter(instance
);
1045 if (enter
.succeeded()) {
1046 enter
.functions()->KeyAdded(instance
,
1047 key_system
.Get(dispatcher()),
1048 session_id
.Get(dispatcher()));
1052 void PPB_Instance_Proxy::OnHostMsgKeyMessage(
1053 PP_Instance instance
,
1054 SerializedVarReceiveInput key_system
,
1055 SerializedVarReceiveInput session_id
,
1056 SerializedVarReceiveInput message
,
1057 SerializedVarReceiveInput default_url
) {
1058 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE
))
1060 EnterInstanceNoLock
enter(instance
);
1061 if (enter
.succeeded()) {
1062 enter
.functions()->KeyMessage(instance
,
1063 key_system
.Get(dispatcher()),
1064 session_id
.Get(dispatcher()),
1065 message
.Get(dispatcher()),
1066 default_url
.Get(dispatcher()));
1070 void PPB_Instance_Proxy::OnHostMsgKeyError(
1071 PP_Instance instance
,
1072 SerializedVarReceiveInput key_system
,
1073 SerializedVarReceiveInput session_id
,
1074 int32_t media_error
,
1075 int32_t system_error
) {
1076 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE
))
1078 EnterInstanceNoLock
enter(instance
);
1079 if (enter
.succeeded()) {
1080 enter
.functions()->KeyError(instance
,
1081 key_system
.Get(dispatcher()),
1082 session_id
.Get(dispatcher()),
1088 void PPB_Instance_Proxy::OnHostMsgDeliverBlock(
1089 PP_Instance instance
,
1090 PP_Resource decrypted_block
,
1091 const std::string
& serialized_block_info
) {
1092 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE
))
1094 PP_DecryptedBlockInfo block_info
;
1095 if (!DeserializeBlockInfo(serialized_block_info
, &block_info
))
1098 EnterInstanceNoLock
enter(instance
);
1099 if (enter
.succeeded())
1100 enter
.functions()->DeliverBlock(instance
, decrypted_block
, &block_info
);
1103 void PPB_Instance_Proxy::OnHostMsgDecoderInitializeDone(
1104 PP_Instance instance
,
1105 PP_DecryptorStreamType decoder_type
,
1106 uint32_t request_id
,
1108 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE
))
1110 EnterInstanceNoLock
enter(instance
);
1111 if (enter
.succeeded()) {
1112 enter
.functions()->DecoderInitializeDone(instance
,
1119 void PPB_Instance_Proxy::OnHostMsgDecoderDeinitializeDone(
1120 PP_Instance instance
,
1121 PP_DecryptorStreamType decoder_type
,
1122 uint32_t request_id
) {
1123 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE
))
1125 EnterInstanceNoLock
enter(instance
);
1126 if (enter
.succeeded())
1127 enter
.functions()->DecoderDeinitializeDone(instance
,
1132 void PPB_Instance_Proxy::OnHostMsgDecoderResetDone(
1133 PP_Instance instance
,
1134 PP_DecryptorStreamType decoder_type
,
1135 uint32_t request_id
) {
1136 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE
))
1138 EnterInstanceNoLock
enter(instance
);
1139 if (enter
.succeeded())
1140 enter
.functions()->DecoderResetDone(instance
, decoder_type
, request_id
);
1143 void PPB_Instance_Proxy::OnHostMsgDeliverFrame(
1144 PP_Instance instance
,
1145 PP_Resource decrypted_frame
,
1146 const std::string
& serialized_frame_info
) {
1147 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE
))
1149 PP_DecryptedFrameInfo frame_info
;
1150 if (!DeserializeBlockInfo(serialized_frame_info
, &frame_info
))
1153 EnterInstanceNoLock
enter(instance
);
1154 if (enter
.succeeded())
1155 enter
.functions()->DeliverFrame(instance
, decrypted_frame
, &frame_info
);
1158 void PPB_Instance_Proxy::OnHostMsgDeliverSamples(
1159 PP_Instance instance
,
1160 PP_Resource audio_frames
,
1161 const std::string
& serialized_block_info
) {
1162 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE
))
1164 PP_DecryptedBlockInfo block_info
;
1165 if (!DeserializeBlockInfo(serialized_block_info
, &block_info
))
1168 EnterInstanceNoLock
enter(instance
);
1169 if (enter
.succeeded())
1170 enter
.functions()->DeliverSamples(instance
, audio_frames
, &block_info
);
1173 void PPB_Instance_Proxy::OnHostMsgSetCursor(
1174 PP_Instance instance
,
1176 const ppapi::HostResource
& custom_image
,
1177 const PP_Point
& hot_spot
) {
1178 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV
))
1180 EnterInstanceNoLock
enter(instance
);
1181 if (enter
.succeeded()) {
1182 enter
.functions()->SetCursor(
1183 instance
, static_cast<PP_MouseCursor_Type
>(type
),
1184 custom_image
.host_resource(), &hot_spot
);
1188 void PPB_Instance_Proxy::OnHostMsgSetTextInputType(PP_Instance instance
,
1189 PP_TextInput_Type type
) {
1190 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV
))
1192 EnterInstanceNoLock
enter(instance
);
1193 if (enter
.succeeded())
1194 enter
.functions()->SetTextInputType(instance
, type
);
1197 void PPB_Instance_Proxy::OnHostMsgUpdateCaretPosition(
1198 PP_Instance instance
,
1199 const PP_Rect
& caret
,
1200 const PP_Rect
& bounding_box
) {
1201 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV
))
1203 EnterInstanceNoLock
enter(instance
);
1204 if (enter
.succeeded())
1205 enter
.functions()->UpdateCaretPosition(instance
, caret
, bounding_box
);
1208 void PPB_Instance_Proxy::OnHostMsgCancelCompositionText(PP_Instance instance
) {
1209 EnterInstanceNoLock
enter(instance
);
1210 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV
))
1212 if (enter
.succeeded())
1213 enter
.functions()->CancelCompositionText(instance
);
1216 void PPB_Instance_Proxy::OnHostMsgUpdateSurroundingText(
1217 PP_Instance instance
,
1218 const std::string
& text
,
1221 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV
))
1223 EnterInstanceNoLock
enter(instance
);
1224 if (enter
.succeeded()) {
1225 enter
.functions()->UpdateSurroundingText(instance
, text
.c_str(), caret
,
1229 #endif // !defined(OS_NACL)
1231 void PPB_Instance_Proxy::OnPluginMsgMouseLockComplete(PP_Instance instance
,
1233 // Save the mouse callback on the instance data.
1234 InstanceData
* data
= static_cast<PluginDispatcher
*>(dispatcher())->
1235 GetInstanceData(instance
);
1237 return; // Instance was probably deleted.
1238 if (!TrackedCallback::IsPending(data
->mouse_lock_callback
)) {
1242 data
->mouse_lock_callback
->Run(result
);
1245 #if !defined(OS_NACL)
1246 void PPB_Instance_Proxy::MouseLockCompleteInHost(int32_t result
,
1247 PP_Instance instance
) {
1248 dispatcher()->Send(new PpapiMsg_PPBInstance_MouseLockComplete(
1249 API_ID_PPB_INSTANCE
, instance
, result
));
1251 #endif // !defined(OS_NACL)
1253 void PPB_Instance_Proxy::CancelAnyPendingRequestSurroundingText(
1254 PP_Instance instance
) {
1255 InstanceData
* data
= static_cast<PluginDispatcher
*>(dispatcher())->
1256 GetInstanceData(instance
);
1258 return; // Instance was probably deleted.
1259 data
->should_do_request_surrounding_text
= false;
1262 } // namespace proxy
1263 } // namespace ppapi