| 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_flash_proxy.h" | 5 #include "ppapi/proxy/ppb_flash_proxy.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "ppapi/c/dev/ppb_font_dev.h" | 15 #include "ppapi/c/dev/ppb_font_dev.h" |
| 16 #include "ppapi/c/dev/ppb_var_deprecated.h" | 16 #include "ppapi/c/dev/ppb_var_deprecated.h" |
| 17 #include "ppapi/c/pp_errors.h" | 17 #include "ppapi/c/pp_errors.h" |
| 18 #include "ppapi/c/pp_resource.h" | 18 #include "ppapi/c/pp_resource.h" |
| 19 #include "ppapi/c/private/ppb_flash.h" | 19 #include "ppapi/c/private/ppb_flash.h" |
| 20 #include "ppapi/c/private/ppb_flash_print.h" | 20 #include "ppapi/c/private/ppb_flash_print.h" |
| 21 #include "ppapi/proxy/host_dispatcher.h" | 21 #include "ppapi/proxy/host_dispatcher.h" |
| 22 #include "ppapi/proxy/pepper_file_messages.h" | |
| 23 #include "ppapi/proxy/plugin_dispatcher.h" | 22 #include "ppapi/proxy/plugin_dispatcher.h" |
| 24 #include "ppapi/proxy/plugin_globals.h" | 23 #include "ppapi/proxy/plugin_globals.h" |
| 25 #include "ppapi/proxy/plugin_proxy_delegate.h" | 24 #include "ppapi/proxy/plugin_proxy_delegate.h" |
| 26 #include "ppapi/proxy/ppapi_messages.h" | 25 #include "ppapi/proxy/ppapi_messages.h" |
| 27 #include "ppapi/proxy/proxy_module.h" | 26 #include "ppapi/proxy/proxy_module.h" |
| 28 #include "ppapi/proxy/serialized_var.h" | 27 #include "ppapi/proxy/serialized_var.h" |
| 29 #include "ppapi/shared_impl/dir_contents.h" | |
| 30 #include "ppapi/shared_impl/file_type_conversion.h" | |
| 31 #include "ppapi/shared_impl/ppapi_globals.h" | 28 #include "ppapi/shared_impl/ppapi_globals.h" |
| 32 #include "ppapi/shared_impl/proxy_lock.h" | 29 #include "ppapi/shared_impl/proxy_lock.h" |
| 33 #include "ppapi/shared_impl/resource.h" | 30 #include "ppapi/shared_impl/resource.h" |
| 34 #include "ppapi/shared_impl/resource_tracker.h" | 31 #include "ppapi/shared_impl/resource_tracker.h" |
| 35 #include "ppapi/shared_impl/scoped_pp_resource.h" | 32 #include "ppapi/shared_impl/scoped_pp_resource.h" |
| 36 #include "ppapi/shared_impl/time_conversion.h" | 33 #include "ppapi/shared_impl/time_conversion.h" |
| 37 #include "ppapi/shared_impl/var.h" | 34 #include "ppapi/shared_impl/var.h" |
| 38 #include "ppapi/shared_impl/var_tracker.h" | 35 #include "ppapi/shared_impl/var_tracker.h" |
| 39 #include "ppapi/thunk/enter.h" | 36 #include "ppapi/thunk/enter.h" |
| 40 #include "ppapi/thunk/ppb_instance_api.h" | 37 #include "ppapi/thunk/ppb_instance_api.h" |
| 41 #include "ppapi/thunk/ppb_url_request_info_api.h" | 38 #include "ppapi/thunk/ppb_url_request_info_api.h" |
| 42 #include "ppapi/thunk/resource_creation_api.h" | 39 #include "ppapi/thunk/resource_creation_api.h" |
| 43 | 40 |
| 44 using ppapi::thunk::EnterInstanceNoLock; | 41 using ppapi::thunk::EnterInstanceNoLock; |
| 45 using ppapi::thunk::EnterResourceNoLock; | 42 using ppapi::thunk::EnterResourceNoLock; |
| 46 | 43 |
| 47 namespace ppapi { | 44 namespace ppapi { |
| 48 namespace proxy { | 45 namespace proxy { |
| 49 | 46 |
| 50 namespace { | 47 namespace { |
| 51 | 48 |
| 52 // Returns true if |t1| and |t2| are times in the same minute. | 49 // Returns true if |t1| and |t2| are times in the same minute. |
| 53 bool InSameMinute(PP_Time t1, PP_Time t2) { | 50 bool InSameMinute(PP_Time t1, PP_Time t2) { |
| 54 return floor(t1 / 60.0) == floor(t2 / 60.0); | 51 return floor(t1 / 60.0) == floor(t2 / 60.0); |
| 55 } | 52 } |
| 56 | 53 |
| 57 IPC::PlatformFileForTransit PlatformFileToPlatformFileForTransit( | |
| 58 Dispatcher* dispatcher, | |
| 59 int32_t* error, | |
| 60 base::PlatformFile file) { | |
| 61 if (*error != PP_OK) | |
| 62 return IPC::InvalidPlatformFileForTransit(); | |
| 63 IPC::PlatformFileForTransit out_handle = | |
| 64 dispatcher->ShareHandleWithRemote(file, true); | |
| 65 if (out_handle == IPC::InvalidPlatformFileForTransit()) | |
| 66 *error = PP_ERROR_NOACCESS; | |
| 67 return out_handle; | |
| 68 } | |
| 69 | |
| 70 void InvokePrinting(PP_Instance instance) { | 54 void InvokePrinting(PP_Instance instance) { |
| 71 ProxyAutoLock lock; | 55 ProxyAutoLock lock; |
| 72 | 56 |
| 73 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 57 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 74 if (dispatcher) { | 58 if (dispatcher) { |
| 75 dispatcher->Send(new PpapiHostMsg_PPBFlash_InvokePrinting( | 59 dispatcher->Send(new PpapiHostMsg_PPBFlash_InvokePrinting( |
| 76 API_ID_PPB_FLASH, instance)); | 60 API_ID_PPB_FLASH, instance)); |
| 77 } | 61 } |
| 78 } | 62 } |
| 79 | 63 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QuitMessageLoop, | 99 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QuitMessageLoop, |
| 116 OnHostMsgQuitMessageLoop) | 100 OnHostMsgQuitMessageLoop) |
| 117 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset, | 101 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset, |
| 118 OnHostMsgGetLocalTimeZoneOffset) | 102 OnHostMsgGetLocalTimeZoneOffset) |
| 119 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_IsRectTopmost, | 103 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_IsRectTopmost, |
| 120 OnHostMsgIsRectTopmost) | 104 OnHostMsgIsRectTopmost) |
| 121 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_FlashSetFullscreen, | 105 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_FlashSetFullscreen, |
| 122 OnHostMsgFlashSetFullscreen) | 106 OnHostMsgFlashSetFullscreen) |
| 123 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_FlashGetScreenSize, | 107 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_FlashGetScreenSize, |
| 124 OnHostMsgFlashGetScreenSize) | 108 OnHostMsgFlashGetScreenSize) |
| 125 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_OpenFileRef, | |
| 126 OnHostMsgOpenFileRef) | |
| 127 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QueryFileRef, | |
| 128 OnHostMsgQueryFileRef) | |
| 129 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetDeviceID, | 109 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetDeviceID, |
| 130 OnHostMsgGetDeviceID) | 110 OnHostMsgGetDeviceID) |
| 131 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_InvokePrinting, | 111 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_InvokePrinting, |
| 132 OnHostMsgInvokePrinting) | 112 OnHostMsgInvokePrinting) |
| 133 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetSetting, | 113 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetSetting, |
| 134 OnHostMsgGetSetting) | 114 OnHostMsgGetSetting) |
| 135 IPC_MESSAGE_UNHANDLED(handled = false) | 115 IPC_MESSAGE_UNHANDLED(handled = false) |
| 136 IPC_END_MESSAGE_MAP() | 116 IPC_END_MESSAGE_MAP() |
| 137 // TODO(brettw) handle bad messages! | 117 // TODO(brettw) handle bad messages! |
| 138 return handled; | 118 return handled; |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 StringVar *url_string_var(StringVar::FromPPVar(value)); | 330 StringVar *url_string_var(StringVar::FromPPVar(value)); |
| 351 if (!url_string_var) | 331 if (!url_string_var) |
| 352 return PP_FALSE; | 332 return PP_FALSE; |
| 353 std::string url_string(url_string_var->value()); | 333 std::string url_string(url_string_var->value()); |
| 354 PluginGlobals::Get()->plugin_proxy_delegate()->SetActiveURL(url_string); | 334 PluginGlobals::Get()->plugin_proxy_delegate()->SetActiveURL(url_string); |
| 355 return PP_TRUE; | 335 return PP_TRUE; |
| 356 } | 336 } |
| 357 return PP_FALSE; | 337 return PP_FALSE; |
| 358 } | 338 } |
| 359 | 339 |
| 360 bool PPB_Flash_Proxy::CreateThreadAdapterForInstance(PP_Instance instance) { | |
| 361 return true; | |
| 362 } | |
| 363 | |
| 364 void PPB_Flash_Proxy::ClearThreadAdapterForInstance(PP_Instance instance) { | |
| 365 } | |
| 366 | |
| 367 int32_t PPB_Flash_Proxy::OpenFile(PP_Instance, | |
| 368 const char* path, | |
| 369 int32_t mode, | |
| 370 PP_FileHandle* file) { | |
| 371 int flags = 0; | |
| 372 if (!path || | |
| 373 !ppapi::PepperFileOpenFlagsToPlatformFileFlags(mode, &flags) || | |
| 374 !file) | |
| 375 return PP_ERROR_BADARGUMENT; | |
| 376 | |
| 377 base::PlatformFileError error; | |
| 378 IPC::PlatformFileForTransit transit_file; | |
| 379 ppapi::PepperFilePath pepper_path(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL, | |
| 380 FilePath::FromUTF8Unsafe(path)); | |
| 381 | |
| 382 if (PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | |
| 383 new PepperFileMsg_OpenFile(pepper_path, flags, | |
| 384 &error, &transit_file))) { | |
| 385 *file = IPC::PlatformFileForTransitToPlatformFile(transit_file); | |
| 386 } else { | |
| 387 *file = base::kInvalidPlatformFileValue; | |
| 388 error = base::PLATFORM_FILE_ERROR_FAILED; | |
| 389 } | |
| 390 | |
| 391 return ppapi::PlatformFileErrorToPepperError(error); | |
| 392 } | |
| 393 | |
| 394 int32_t PPB_Flash_Proxy::RenameFile(PP_Instance, | |
| 395 const char* from_path, | |
| 396 const char* to_path) { | |
| 397 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED; | |
| 398 ppapi::PepperFilePath pepper_from(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL, | |
| 399 FilePath::FromUTF8Unsafe(from_path)); | |
| 400 ppapi::PepperFilePath pepper_to(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL, | |
| 401 FilePath::FromUTF8Unsafe(to_path)); | |
| 402 | |
| 403 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | |
| 404 new PepperFileMsg_RenameFile(pepper_from, pepper_to, &error)); | |
| 405 | |
| 406 return ppapi::PlatformFileErrorToPepperError(error); | |
| 407 } | |
| 408 | |
| 409 int32_t PPB_Flash_Proxy::DeleteFileOrDir(PP_Instance, | |
| 410 const char* path, | |
| 411 PP_Bool recursive) { | |
| 412 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED; | |
| 413 ppapi::PepperFilePath pepper_path(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL, | |
| 414 FilePath::FromUTF8Unsafe(path)); | |
| 415 | |
| 416 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | |
| 417 new PepperFileMsg_DeleteFileOrDir(pepper_path, | |
| 418 PP_ToBool(recursive), | |
| 419 &error)); | |
| 420 | |
| 421 return ppapi::PlatformFileErrorToPepperError(error); | |
| 422 } | |
| 423 | |
| 424 int32_t PPB_Flash_Proxy::CreateDir(PP_Instance, const char* path) { | |
| 425 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED; | |
| 426 ppapi::PepperFilePath pepper_path(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL, | |
| 427 FilePath::FromUTF8Unsafe(path)); | |
| 428 | |
| 429 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | |
| 430 new PepperFileMsg_CreateDir(pepper_path, &error)); | |
| 431 | |
| 432 return ppapi::PlatformFileErrorToPepperError(error); | |
| 433 } | |
| 434 | |
| 435 int32_t PPB_Flash_Proxy::QueryFile(PP_Instance, | |
| 436 const char* path, | |
| 437 PP_FileInfo* info) { | |
| 438 base::PlatformFileInfo file_info; | |
| 439 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED; | |
| 440 ppapi::PepperFilePath pepper_path(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL, | |
| 441 FilePath::FromUTF8Unsafe(path)); | |
| 442 | |
| 443 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | |
| 444 new PepperFileMsg_QueryFile(pepper_path, &file_info, &error)); | |
| 445 | |
| 446 if (error == base::PLATFORM_FILE_OK) { | |
| 447 info->size = file_info.size; | |
| 448 info->creation_time = TimeToPPTime(file_info.creation_time); | |
| 449 info->last_access_time = TimeToPPTime(file_info.last_accessed); | |
| 450 info->last_modified_time = TimeToPPTime(file_info.last_modified); | |
| 451 info->system_type = PP_FILESYSTEMTYPE_EXTERNAL; | |
| 452 if (file_info.is_directory) | |
| 453 info->type = PP_FILETYPE_DIRECTORY; | |
| 454 else | |
| 455 info->type = PP_FILETYPE_REGULAR; | |
| 456 } | |
| 457 | |
| 458 return ppapi::PlatformFileErrorToPepperError(error); | |
| 459 } | |
| 460 | |
| 461 int32_t PPB_Flash_Proxy::GetDirContents(PP_Instance, | |
| 462 const char* path, | |
| 463 PP_DirContents_Dev** contents) { | |
| 464 ppapi::DirContents entries; | |
| 465 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED; | |
| 466 ppapi::PepperFilePath pepper_path(ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL, | |
| 467 FilePath::FromUTF8Unsafe(path)); | |
| 468 | |
| 469 PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | |
| 470 new PepperFileMsg_GetDirContents(pepper_path, &entries, &error)); | |
| 471 | |
| 472 if (error == base::PLATFORM_FILE_OK) { | |
| 473 // Copy the serialized dir entries to the output struct. | |
| 474 *contents = new PP_DirContents_Dev; | |
| 475 (*contents)->count = static_cast<int32_t>(entries.size()); | |
| 476 (*contents)->entries = new PP_DirEntry_Dev[entries.size()]; | |
| 477 for (size_t i = 0; i < entries.size(); i++) { | |
| 478 const ppapi::DirEntry& source = entries[i]; | |
| 479 PP_DirEntry_Dev* dest = &(*contents)->entries[i]; | |
| 480 std::string name = source.name.AsUTF8Unsafe(); | |
| 481 char* name_copy = new char[name.size() + 1]; | |
| 482 memcpy(name_copy, name.c_str(), name.size() + 1); | |
| 483 dest->name = name_copy; | |
| 484 dest->is_dir = PP_FromBool(source.is_dir); | |
| 485 } | |
| 486 } | |
| 487 | |
| 488 return ppapi::PlatformFileErrorToPepperError(error); | |
| 489 } | |
| 490 | |
| 491 int32_t PPB_Flash_Proxy::CreateTemporaryFile(PP_Instance instance, | |
| 492 PP_FileHandle* file) { | |
| 493 if (!file) | |
| 494 return PP_ERROR_BADARGUMENT; | |
| 495 | |
| 496 base::PlatformFileError error; | |
| 497 IPC::PlatformFileForTransit transit_file; | |
| 498 | |
| 499 if (PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser( | |
| 500 new PepperFileMsg_CreateTemporaryFile(&error, &transit_file))) { | |
| 501 *file = IPC::PlatformFileForTransitToPlatformFile(transit_file); | |
| 502 } else { | |
| 503 error = base::PLATFORM_FILE_ERROR_FAILED; | |
| 504 *file = base::kInvalidPlatformFileValue; | |
| 505 } | |
| 506 | |
| 507 return ppapi::PlatformFileErrorToPepperError(error); | |
| 508 } | |
| 509 | |
| 510 int32_t PPB_Flash_Proxy::OpenFileRef(PP_Instance instance, | |
| 511 PP_Resource file_ref_id, | |
| 512 int32_t mode, | |
| 513 PP_FileHandle* file) { | |
| 514 EnterResourceNoLock<thunk::PPB_FileRef_API> enter(file_ref_id, true); | |
| 515 if (enter.failed()) | |
| 516 return PP_ERROR_BADRESOURCE; | |
| 517 | |
| 518 int32_t result = PP_ERROR_FAILED; | |
| 519 IPC::PlatformFileForTransit transit; | |
| 520 dispatcher()->Send(new PpapiHostMsg_PPBFlash_OpenFileRef( | |
| 521 API_ID_PPB_FLASH, instance, enter.resource()->host_resource(), mode, | |
| 522 &transit, &result)); | |
| 523 *file = IPC::PlatformFileForTransitToPlatformFile(transit); | |
| 524 return result; | |
| 525 } | |
| 526 | |
| 527 int32_t PPB_Flash_Proxy::QueryFileRef(PP_Instance instance, | |
| 528 PP_Resource file_ref_id, | |
| 529 PP_FileInfo* info) { | |
| 530 EnterResourceNoLock<thunk::PPB_FileRef_API> enter(file_ref_id, true); | |
| 531 if (enter.failed()) | |
| 532 return PP_ERROR_BADRESOURCE; | |
| 533 | |
| 534 int32_t result = PP_ERROR_FAILED; | |
| 535 dispatcher()->Send(new PpapiHostMsg_PPBFlash_QueryFileRef( | |
| 536 API_ID_PPB_FLASH, instance, enter.resource()->host_resource(), info, | |
| 537 &result)); | |
| 538 return result; | |
| 539 } | |
| 540 | |
| 541 PP_Bool PPB_Flash_Proxy::FlashIsFullscreen(PP_Instance instance) { | 340 PP_Bool PPB_Flash_Proxy::FlashIsFullscreen(PP_Instance instance) { |
| 542 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> | 341 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> |
| 543 GetInstanceData(instance); | 342 GetInstanceData(instance); |
| 544 if (!data) | 343 if (!data) |
| 545 return PP_FALSE; | 344 return PP_FALSE; |
| 546 return data->flash_fullscreen; | 345 return data->flash_fullscreen; |
| 547 } | 346 } |
| 548 | 347 |
| 549 PP_Bool PPB_Flash_Proxy::FlashSetFullscreen(PP_Instance instance, | 348 PP_Bool PPB_Flash_Proxy::FlashSetFullscreen(PP_Instance instance, |
| 550 PP_Bool fullscreen) { | 349 PP_Bool fullscreen) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 EnterInstanceNoLock enter(instance); | 494 EnterInstanceNoLock enter(instance); |
| 696 if (enter.succeeded()) { | 495 if (enter.succeeded()) { |
| 697 *result = enter.functions()->GetFlashAPI()->FlashGetScreenSize( | 496 *result = enter.functions()->GetFlashAPI()->FlashGetScreenSize( |
| 698 instance, size); | 497 instance, size); |
| 699 } else { | 498 } else { |
| 700 size->width = 0; | 499 size->width = 0; |
| 701 size->height = 0; | 500 size->height = 0; |
| 702 } | 501 } |
| 703 } | 502 } |
| 704 | 503 |
| 705 void PPB_Flash_Proxy::OnHostMsgOpenFileRef( | |
| 706 PP_Instance instance, | |
| 707 const HostResource& host_resource, | |
| 708 int32_t mode, | |
| 709 IPC::PlatformFileForTransit* file_handle, | |
| 710 int32_t* result) { | |
| 711 EnterInstanceNoLock enter(instance); | |
| 712 if (enter.failed()) { | |
| 713 *result = PP_ERROR_BADARGUMENT; | |
| 714 return; | |
| 715 } | |
| 716 | |
| 717 base::PlatformFile file; | |
| 718 *result = enter.functions()->GetFlashAPI()->OpenFileRef( | |
| 719 instance, host_resource.host_resource(), mode, &file); | |
| 720 *file_handle = PlatformFileToPlatformFileForTransit(dispatcher(), | |
| 721 result, file); | |
| 722 } | |
| 723 | |
| 724 void PPB_Flash_Proxy::OnHostMsgQueryFileRef( | |
| 725 PP_Instance instance, | |
| 726 const HostResource& host_resource, | |
| 727 PP_FileInfo* info, | |
| 728 int32_t* result) { | |
| 729 EnterInstanceNoLock enter(instance); | |
| 730 if (enter.failed()) { | |
| 731 *result = PP_ERROR_BADARGUMENT; | |
| 732 return; | |
| 733 } | |
| 734 *result = enter.functions()->GetFlashAPI()->QueryFileRef( | |
| 735 instance, host_resource.host_resource(), info); | |
| 736 } | |
| 737 | |
| 738 void PPB_Flash_Proxy::OnHostMsgGetSetting(PP_Instance instance, | 504 void PPB_Flash_Proxy::OnHostMsgGetSetting(PP_Instance instance, |
| 739 PP_FlashSetting setting, | 505 PP_FlashSetting setting, |
| 740 SerializedVarReturnValue id) { | 506 SerializedVarReturnValue id) { |
| 741 EnterInstanceNoLock enter(instance); | 507 EnterInstanceNoLock enter(instance); |
| 742 if (enter.succeeded()) { | 508 if (enter.succeeded()) { |
| 743 id.Return(dispatcher(), | 509 id.Return(dispatcher(), |
| 744 enter.functions()->GetFlashAPI()->GetSetting( | 510 enter.functions()->GetFlashAPI()->GetSetting( |
| 745 instance, setting)); | 511 instance, setting)); |
| 746 } else { | 512 } else { |
| 747 id.Return(dispatcher(), PP_MakeUndefined()); | 513 id.Return(dispatcher(), PP_MakeUndefined()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 765 // It's rarely used enough that we just request this interface when needed. | 531 // It's rarely used enough that we just request this interface when needed. |
| 766 const PPB_Flash_Print_1_0* print_interface = | 532 const PPB_Flash_Print_1_0* print_interface = |
| 767 static_cast<const PPB_Flash_Print_1_0*>( | 533 static_cast<const PPB_Flash_Print_1_0*>( |
| 768 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); | 534 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); |
| 769 if (print_interface) | 535 if (print_interface) |
| 770 print_interface->InvokePrinting(instance); | 536 print_interface->InvokePrinting(instance); |
| 771 } | 537 } |
| 772 | 538 |
| 773 } // namespace proxy | 539 } // namespace proxy |
| 774 } // namespace ppapi | 540 } // namespace ppapi |
| OLD | NEW |