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_resource.h" | 19 #include "ppapi/proxy/flash_resource.h" |
19 #include "ppapi/proxy/gamepad_resource.h" | 20 #include "ppapi/proxy/gamepad_resource.h" |
20 #include "ppapi/proxy/host_dispatcher.h" | 21 #include "ppapi/proxy/host_dispatcher.h" |
21 #include "ppapi/proxy/plugin_dispatcher.h" | 22 #include "ppapi/proxy/plugin_dispatcher.h" |
22 #include "ppapi/proxy/plugin_proxy_delegate.h" | 23 #include "ppapi/proxy/plugin_proxy_delegate.h" |
23 #include "ppapi/proxy/ppapi_messages.h" | 24 #include "ppapi/proxy/ppapi_messages.h" |
24 #include "ppapi/proxy/ppb_flash_proxy.h" | 25 #include "ppapi/proxy/ppb_flash_proxy.h" |
25 #include "ppapi/proxy/serialized_var.h" | 26 #include "ppapi/proxy/serialized_var.h" |
26 #include "ppapi/shared_impl/ppapi_globals.h" | 27 #include "ppapi/shared_impl/ppapi_globals.h" |
27 #include "ppapi/shared_impl/ppb_url_util_shared.h" | 28 #include "ppapi/shared_impl/ppb_url_util_shared.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetScreenSize( | 315 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetScreenSize( |
315 API_ID_PPB_INSTANCE, instance, &result, size)); | 316 API_ID_PPB_INSTANCE, instance, &result, size)); |
316 return result; | 317 return result; |
317 } | 318 } |
318 | 319 |
319 thunk::PPB_Flash_API* PPB_Instance_Proxy::GetFlashAPI() { | 320 thunk::PPB_Flash_API* PPB_Instance_Proxy::GetFlashAPI() { |
320 InterfaceProxy* ip = dispatcher()->GetInterfaceProxy(API_ID_PPB_FLASH); | 321 InterfaceProxy* ip = dispatcher()->GetInterfaceProxy(API_ID_PPB_FLASH); |
321 return static_cast<PPB_Flash_Proxy*>(ip); | 322 return static_cast<PPB_Flash_Proxy*>(ip); |
322 } | 323 } |
323 | 324 |
| 325 // TODO(raymes): We can most likely cut down this boilerplate for grabbing |
| 326 // singleton resource APIs. |
324 thunk::PPB_Flash_Functions_API* PPB_Instance_Proxy::GetFlashFunctionsAPI( | 327 thunk::PPB_Flash_Functions_API* PPB_Instance_Proxy::GetFlashFunctionsAPI( |
325 PP_Instance instance) { | 328 PP_Instance instance) { |
326 #if !defined(OS_NACL) && !defined(NACL_WIN64) | 329 #if !defined(OS_NACL) && !defined(NACL_WIN64) |
327 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 330 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
328 GetInstanceData(instance); | 331 GetInstanceData(instance); |
329 if (!data) | 332 if (!data) |
330 return NULL; | 333 return NULL; |
331 | 334 |
332 if (!data->flash_resource.get()) { | 335 if (!data->flash_resource.get()) { |
333 Connection connection( | 336 Connection connection( |
334 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(), | 337 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(), |
335 dispatcher()); | 338 dispatcher()); |
336 data->flash_resource = new FlashResource(connection, instance); | 339 data->flash_resource = new FlashResource(connection, instance); |
337 } | 340 } |
338 return data->flash_resource.get(); | 341 return data->flash_resource.get(); |
339 #else | 342 #else |
340 // Flash functions aren't implemented for nacl. | 343 // Flash functions aren't implemented for nacl. |
341 NOTIMPLEMENTED(); | 344 NOTIMPLEMENTED(); |
342 return NULL; | 345 return NULL; |
343 #endif // !defined(OS_NACL) && !defined(NACL_WIN64) | 346 #endif // !defined(OS_NACL) && !defined(NACL_WIN64) |
344 } | 347 } |
345 | 348 |
| 349 thunk::PPB_Flash_Clipboard_API* PPB_Instance_Proxy::GetFlashClipboardAPI( |
| 350 PP_Instance instance) { |
| 351 #if !defined(OS_NACL) && !defined(NACL_WIN64) |
| 352 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
| 353 GetInstanceData(instance); |
| 354 if (!data) |
| 355 return NULL; |
| 356 |
| 357 if (!data->flash_clipboard_resource.get()) { |
| 358 Connection connection( |
| 359 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(), |
| 360 dispatcher()); |
| 361 data->flash_clipboard_resource = |
| 362 new FlashClipboardResource(connection, instance); |
| 363 } |
| 364 return data->flash_clipboard_resource.get(); |
| 365 #else |
| 366 // Flash functions aren't implemented for nacl. |
| 367 NOTIMPLEMENTED(); |
| 368 return NULL; |
| 369 #endif // !defined(OS_NACL) && !defined(NACL_WIN64) |
| 370 } |
| 371 |
346 thunk::PPB_Gamepad_API* PPB_Instance_Proxy::GetGamepadAPI( | 372 thunk::PPB_Gamepad_API* PPB_Instance_Proxy::GetGamepadAPI( |
347 PP_Instance instance) { | 373 PP_Instance instance) { |
348 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 374 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
349 GetInstanceData(instance); | 375 GetInstanceData(instance); |
350 if (!data) | 376 if (!data) |
351 return NULL; | 377 return NULL; |
352 | 378 |
353 if (!data->gamepad_resource.get()) { | 379 if (!data->gamepad_resource.get()) { |
354 Connection connection( | 380 Connection connection( |
355 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(), | 381 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(), |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 PP_Instance instance) { | 1179 PP_Instance instance) { |
1154 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 1180 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
1155 GetInstanceData(instance); | 1181 GetInstanceData(instance); |
1156 if (!data) | 1182 if (!data) |
1157 return; // Instance was probably deleted. | 1183 return; // Instance was probably deleted. |
1158 data->should_do_request_surrounding_text = false; | 1184 data->should_do_request_surrounding_text = false; |
1159 } | 1185 } |
1160 | 1186 |
1161 } // namespace proxy | 1187 } // namespace proxy |
1162 } // namespace ppapi | 1188 } // namespace ppapi |
OLD | NEW |