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 "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/c/pp_time.h" | 9 #include "ppapi/c/pp_time.h" |
10 #include "ppapi/c/pp_var.h" | 10 #include "ppapi/c/pp_var.h" |
11 #include "ppapi/c/ppb_audio_config.h" | 11 #include "ppapi/c/ppb_audio_config.h" |
12 #include "ppapi/c/ppb_instance.h" | 12 #include "ppapi/c/ppb_instance.h" |
13 #include "ppapi/c/ppb_messaging.h" | 13 #include "ppapi/c/ppb_messaging.h" |
14 #include "ppapi/c/ppb_mouse_lock.h" | 14 #include "ppapi/c/ppb_mouse_lock.h" |
15 #include "ppapi/c/private/pp_content_decryptor.h" | 15 #include "ppapi/c/private/pp_content_decryptor.h" |
16 #include "ppapi/proxy/content_decryptor_private_serializer.h" | 16 #include "ppapi/proxy/content_decryptor_private_serializer.h" |
17 #include "ppapi/proxy/enter_proxy.h" | 17 #include "ppapi/proxy/enter_proxy.h" |
18 #include "ppapi/proxy/flash_clipboard_resource.h" | 18 #include "ppapi/proxy/flash_clipboard_resource.h" |
19 #include "ppapi/proxy/flash_resource.h" | 19 #include "ppapi/proxy/flash_resource.h" |
20 #include "ppapi/proxy/gamepad_resource.h" | 20 #include "ppapi/proxy/gamepad_resource.h" |
21 #include "ppapi/proxy/host_dispatcher.h" | 21 #include "ppapi/proxy/host_dispatcher.h" |
22 #include "ppapi/proxy/plugin_dispatcher.h" | 22 #include "ppapi/proxy/plugin_dispatcher.h" |
23 #include "ppapi/proxy/plugin_proxy_delegate.h" | |
24 #include "ppapi/proxy/ppapi_messages.h" | 23 #include "ppapi/proxy/ppapi_messages.h" |
25 #include "ppapi/proxy/ppb_flash_proxy.h" | 24 #include "ppapi/proxy/ppb_flash_proxy.h" |
26 #include "ppapi/proxy/serialized_var.h" | 25 #include "ppapi/proxy/serialized_var.h" |
27 #include "ppapi/shared_impl/ppapi_globals.h" | 26 #include "ppapi/shared_impl/ppapi_globals.h" |
28 #include "ppapi/shared_impl/ppb_url_util_shared.h" | 27 #include "ppapi/shared_impl/ppb_url_util_shared.h" |
29 #include "ppapi/shared_impl/ppb_view_shared.h" | 28 #include "ppapi/shared_impl/ppb_view_shared.h" |
30 #include "ppapi/shared_impl/var.h" | 29 #include "ppapi/shared_impl/var.h" |
31 #include "ppapi/thunk/enter.h" | 30 #include "ppapi/thunk/enter.h" |
32 #include "ppapi/thunk/thunk.h" | 31 #include "ppapi/thunk/thunk.h" |
33 | 32 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 295 } |
297 | 296 |
298 PP_Var PPB_Instance_Proxy::GetFontFamilies(PP_Instance instance) { | 297 PP_Var PPB_Instance_Proxy::GetFontFamilies(PP_Instance instance) { |
299 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 298 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
300 if (!dispatcher) | 299 if (!dispatcher) |
301 return PP_MakeUndefined(); | 300 return PP_MakeUndefined(); |
302 | 301 |
303 // Assume the font families don't change, so we can cache the result globally. | 302 // Assume the font families don't change, so we can cache the result globally. |
304 CR_DEFINE_STATIC_LOCAL(std::string, families, ()); | 303 CR_DEFINE_STATIC_LOCAL(std::string, families, ()); |
305 if (families.empty()) { | 304 if (families.empty()) { |
306 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | 305 PluginGlobals::Get()->GetBrowserSender()->Send( |
307 new PpapiHostMsg_PPBInstance_GetFontFamilies(&families)); | 306 new PpapiHostMsg_PPBInstance_GetFontFamilies(&families)); |
308 } | 307 } |
309 | 308 |
310 return StringVar::StringToPPVar(families); | 309 return StringVar::StringToPPVar(families); |
311 } | 310 } |
312 | 311 |
313 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance, | 312 PP_Bool PPB_Instance_Proxy::SetFullscreen(PP_Instance instance, |
314 PP_Bool fullscreen) { | 313 PP_Bool fullscreen) { |
315 PP_Bool result = PP_FALSE; | 314 PP_Bool result = PP_FALSE; |
316 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetFullscreen( | 315 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SetFullscreen( |
(...skipping 18 matching lines...) Expand all Loading... |
335 // singleton resource APIs. | 334 // singleton resource APIs. |
336 thunk::PPB_Flash_Functions_API* PPB_Instance_Proxy::GetFlashFunctionsAPI( | 335 thunk::PPB_Flash_Functions_API* PPB_Instance_Proxy::GetFlashFunctionsAPI( |
337 PP_Instance instance) { | 336 PP_Instance instance) { |
338 #if !defined(OS_NACL) && !defined(NACL_WIN64) | 337 #if !defined(OS_NACL) && !defined(NACL_WIN64) |
339 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 338 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
340 GetInstanceData(instance); | 339 GetInstanceData(instance); |
341 if (!data) | 340 if (!data) |
342 return NULL; | 341 return NULL; |
343 | 342 |
344 if (!data->flash_resource.get()) { | 343 if (!data->flash_resource.get()) { |
345 Connection connection( | 344 Connection connection(PluginGlobals::Get()->GetBrowserSender(), |
346 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(), | 345 dispatcher()); |
347 dispatcher()); | |
348 data->flash_resource = new FlashResource(connection, instance); | 346 data->flash_resource = new FlashResource(connection, instance); |
349 } | 347 } |
350 return data->flash_resource.get(); | 348 return data->flash_resource.get(); |
351 #else | 349 #else |
352 // Flash functions aren't implemented for nacl. | 350 // Flash functions aren't implemented for nacl. |
353 NOTIMPLEMENTED(); | 351 NOTIMPLEMENTED(); |
354 return NULL; | 352 return NULL; |
355 #endif // !defined(OS_NACL) && !defined(NACL_WIN64) | 353 #endif // !defined(OS_NACL) && !defined(NACL_WIN64) |
356 } | 354 } |
357 | 355 |
358 thunk::PPB_Flash_Clipboard_API* PPB_Instance_Proxy::GetFlashClipboardAPI( | 356 thunk::PPB_Flash_Clipboard_API* PPB_Instance_Proxy::GetFlashClipboardAPI( |
359 PP_Instance instance) { | 357 PP_Instance instance) { |
360 #if !defined(OS_NACL) && !defined(NACL_WIN64) | 358 #if !defined(OS_NACL) && !defined(NACL_WIN64) |
361 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 359 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
362 GetInstanceData(instance); | 360 GetInstanceData(instance); |
363 if (!data) | 361 if (!data) |
364 return NULL; | 362 return NULL; |
365 | 363 |
366 if (!data->flash_clipboard_resource.get()) { | 364 if (!data->flash_clipboard_resource.get()) { |
367 Connection connection( | 365 Connection connection(PluginGlobals::Get()->GetBrowserSender(), |
368 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(), | 366 dispatcher()); |
369 dispatcher()); | |
370 data->flash_clipboard_resource = | 367 data->flash_clipboard_resource = |
371 new FlashClipboardResource(connection, instance); | 368 new FlashClipboardResource(connection, instance); |
372 } | 369 } |
373 return data->flash_clipboard_resource.get(); | 370 return data->flash_clipboard_resource.get(); |
374 #else | 371 #else |
375 // Flash functions aren't implemented for nacl. | 372 // Flash functions aren't implemented for nacl. |
376 NOTIMPLEMENTED(); | 373 NOTIMPLEMENTED(); |
377 return NULL; | 374 return NULL; |
378 #endif // !defined(OS_NACL) && !defined(NACL_WIN64) | 375 #endif // !defined(OS_NACL) && !defined(NACL_WIN64) |
379 } | 376 } |
380 | 377 |
381 thunk::PPB_Gamepad_API* PPB_Instance_Proxy::GetGamepadAPI( | 378 thunk::PPB_Gamepad_API* PPB_Instance_Proxy::GetGamepadAPI( |
382 PP_Instance instance) { | 379 PP_Instance instance) { |
383 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 380 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
384 GetInstanceData(instance); | 381 GetInstanceData(instance); |
385 if (!data) | 382 if (!data) |
386 return NULL; | 383 return NULL; |
387 | 384 |
388 if (!data->gamepad_resource.get()) { | 385 if (!data->gamepad_resource.get()) { |
389 Connection connection( | 386 Connection connection(PluginGlobals::Get()->GetBrowserSender(), |
390 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(), | 387 dispatcher()); |
391 dispatcher()); | |
392 data->gamepad_resource = new GamepadResource(connection, instance); | 388 data->gamepad_resource = new GamepadResource(connection, instance); |
393 } | 389 } |
394 return data->gamepad_resource.get(); | 390 return data->gamepad_resource.get(); |
395 } | 391 } |
396 | 392 |
397 int32_t PPB_Instance_Proxy::RequestInputEvents(PP_Instance instance, | 393 int32_t PPB_Instance_Proxy::RequestInputEvents(PP_Instance instance, |
398 uint32_t event_classes) { | 394 uint32_t event_classes) { |
399 dispatcher()->Send(new PpapiHostMsg_PPBInstance_RequestInputEvents( | 395 dispatcher()->Send(new PpapiHostMsg_PPBInstance_RequestInputEvents( |
400 API_ID_PPB_INSTANCE, instance, false, event_classes)); | 396 API_ID_PPB_INSTANCE, instance, false, event_classes)); |
401 | 397 |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 PP_Instance instance) { | 1188 PP_Instance instance) { |
1193 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 1189 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
1194 GetInstanceData(instance); | 1190 GetInstanceData(instance); |
1195 if (!data) | 1191 if (!data) |
1196 return; // Instance was probably deleted. | 1192 return; // Instance was probably deleted. |
1197 data->should_do_request_surrounding_text = false; | 1193 data->should_do_request_surrounding_text = false; |
1198 } | 1194 } |
1199 | 1195 |
1200 } // namespace proxy | 1196 } // namespace proxy |
1201 } // namespace ppapi | 1197 } // namespace ppapi |
OLD | NEW |