Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: ppapi/proxy/ppb_flash_file_proxy.cc

Issue 7844018: Revert 100748 - This patch tries to remove most of the manual registration for Pepper interfaces,... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_flash_file_proxy.h ('k') | ppapi/proxy/ppb_flash_menu_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_file_proxy.h" 5 #include "ppapi/proxy/ppb_flash_file_proxy.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 &ClearThreadAdapterForInstance, 494 &ClearThreadAdapterForInstance,
495 &OpenModuleLocalFile, 495 &OpenModuleLocalFile,
496 &RenameModuleLocalFile, 496 &RenameModuleLocalFile,
497 &DeleteModuleLocalFileOrDir, 497 &DeleteModuleLocalFileOrDir,
498 &CreateModuleLocalDir, 498 &CreateModuleLocalDir,
499 &QueryModuleLocalFile, 499 &QueryModuleLocalFile,
500 &GetModuleLocalDirContents, 500 &GetModuleLocalDirContents,
501 &FreeDirContents, 501 &FreeDirContents,
502 }; 502 };
503 503
504 InterfaceProxy* CreateFlashFileModuleLocalProxy(Dispatcher* dispatcher) { 504 InterfaceProxy* CreateFlashFileModuleLocalProxy(Dispatcher* dispatcher,
505 return new PPB_Flash_File_ModuleLocal_Proxy(dispatcher); 505 const void* target_interface) {
506 return new PPB_Flash_File_ModuleLocal_Proxy(dispatcher, target_interface);
506 } 507 }
507 508
508 } // namespace 509 } // namespace
509 510
510 PPB_Flash_File_ModuleLocal_Proxy::PPB_Flash_File_ModuleLocal_Proxy( 511 PPB_Flash_File_ModuleLocal_Proxy::PPB_Flash_File_ModuleLocal_Proxy(
511 Dispatcher* dispatcher) 512 Dispatcher* dispatcher,
512 : InterfaceProxy(dispatcher), 513 const void* target_interface)
513 ppb_flash_file_module_local_impl_(NULL) { 514 : InterfaceProxy(dispatcher, target_interface) {
514 if (!dispatcher->IsPlugin()) {
515 ppb_flash_file_module_local_impl_ =
516 static_cast<const PPB_Flash_File_ModuleLocal*>(
517 dispatcher->local_get_interface()(
518 PPB_FLASH_FILE_MODULELOCAL_INTERFACE));
519 }
520 } 515 }
521 516
522 PPB_Flash_File_ModuleLocal_Proxy::~PPB_Flash_File_ModuleLocal_Proxy() { 517 PPB_Flash_File_ModuleLocal_Proxy::~PPB_Flash_File_ModuleLocal_Proxy() {
523 } 518 }
524 519
525 // static 520 // static
526 const InterfaceProxy::Info* PPB_Flash_File_ModuleLocal_Proxy::GetInfo() { 521 const InterfaceProxy::Info* PPB_Flash_File_ModuleLocal_Proxy::GetInfo() {
527 static const Info info = { 522 static const Info info = {
528 &flash_file_modulelocal_interface, 523 &flash_file_modulelocal_interface,
529 PPB_FLASH_FILE_MODULELOCAL_INTERFACE, 524 PPB_FLASH_FILE_MODULELOCAL_INTERFACE,
(...skipping 26 matching lines...) Expand all
556 return handled; 551 return handled;
557 } 552 }
558 553
559 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgOpenFile( 554 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgOpenFile(
560 PP_Instance instance, 555 PP_Instance instance,
561 const std::string& path, 556 const std::string& path,
562 int32_t mode, 557 int32_t mode,
563 IPC::PlatformFileForTransit* file_handle, 558 IPC::PlatformFileForTransit* file_handle,
564 int32_t* result) { 559 int32_t* result) {
565 base::PlatformFile file; 560 base::PlatformFile file;
566 *result = ppb_flash_file_module_local_impl_->OpenFile( 561 *result = ppb_flash_file_module_local_target()->
567 instance, path.c_str(), mode, &file); 562 OpenFile(instance, path.c_str(), mode, &file);
568 *file_handle = PlatformFileToPlatformFileForTransit( 563 *file_handle = PlatformFileToPlatformFileForTransit(
569 dispatcher(), result, file); 564 dispatcher(), result, file);
570 } 565 }
571 566
572 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgRenameFile( 567 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgRenameFile(
573 PP_Instance instance, 568 PP_Instance instance,
574 const std::string& from_path, 569 const std::string& from_path,
575 const std::string& to_path, 570 const std::string& to_path,
576 int32_t* result) { 571 int32_t* result) {
577 *result = ppb_flash_file_module_local_impl_->RenameFile( 572 *result = ppb_flash_file_module_local_target()->
578 instance, from_path.c_str(), to_path.c_str()); 573 RenameFile(instance, from_path.c_str(), to_path.c_str());
579 } 574 }
580 575
581 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgDeleteFileOrDir( 576 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgDeleteFileOrDir(
582 PP_Instance instance, 577 PP_Instance instance,
583 const std::string& path, 578 const std::string& path,
584 PP_Bool recursive, 579 PP_Bool recursive,
585 int32_t* result) { 580 int32_t* result) {
586 *result = ppb_flash_file_module_local_impl_->DeleteFileOrDir( 581 *result = ppb_flash_file_module_local_target()->
587 instance, path.c_str(), recursive); 582 DeleteFileOrDir(instance, path.c_str(), recursive);
588 } 583 }
589 584
590 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgCreateDir(PP_Instance instance, 585 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgCreateDir(PP_Instance instance,
591 const std::string& path, 586 const std::string& path,
592 int32_t* result) { 587 int32_t* result) {
593 *result = ppb_flash_file_module_local_impl_->CreateDir( 588 *result = ppb_flash_file_module_local_target()->
594 instance, path.c_str()); 589 CreateDir(instance, path.c_str());
595 } 590 }
596 591
597 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgQueryFile(PP_Instance instance, 592 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgQueryFile(PP_Instance instance,
598 const std::string& path, 593 const std::string& path,
599 PP_FileInfo* info, 594 PP_FileInfo* info,
600 int32_t* result) { 595 int32_t* result) {
601 *result = ppb_flash_file_module_local_impl_->QueryFile( 596 *result = ppb_flash_file_module_local_target()->
602 instance, path.c_str(), info); 597 QueryFile(instance, path.c_str(), info);
603 } 598 }
604 599
605 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgGetDirContents( 600 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgGetDirContents(
606 PP_Instance instance, 601 PP_Instance instance,
607 const std::string& path, 602 const std::string& path,
608 std::vector<SerializedDirEntry>* entries, 603 std::vector<SerializedDirEntry>* entries,
609 int32_t* result) { 604 int32_t* result) {
610 PP_DirContents_Dev* contents = NULL; 605 PP_DirContents_Dev* contents = NULL;
611 *result = ppb_flash_file_module_local_impl_->GetDirContents( 606 *result = ppb_flash_file_module_local_target()->
612 instance, path.c_str(), &contents); 607 GetDirContents(instance, path.c_str(), &contents);
613 if (*result != PP_OK) 608 if (*result != PP_OK)
614 return; 609 return;
615 610
616 // Convert the list of entries to the serialized version. 611 // Convert the list of entries to the serialized version.
617 entries->resize(contents->count); 612 entries->resize(contents->count);
618 for (int32_t i = 0; i < contents->count; i++) { 613 for (int32_t i = 0; i < contents->count; i++) {
619 (*entries)[i].name.assign(contents->entries[i].name); 614 (*entries)[i].name.assign(contents->entries[i].name);
620 (*entries)[i].is_dir = PP_ToBool(contents->entries[i].is_dir); 615 (*entries)[i].is_dir = PP_ToBool(contents->entries[i].is_dir);
621 } 616 }
622 ppb_flash_file_module_local_impl_->FreeDirContents(instance, contents); 617 ppb_flash_file_module_local_target()->FreeDirContents(instance, contents);
623 } 618 }
624 619
625 // PPB_Flash_File_FileRef ------------------------------------------------------ 620 // PPB_Flash_File_FileRef ------------------------------------------------------
626 621
627 namespace { 622 namespace {
628 623
629 int32_t OpenFileRefFile(PP_Resource file_ref_id, 624 int32_t OpenFileRefFile(PP_Resource file_ref_id,
630 int32_t mode, 625 int32_t mode,
631 PP_FileHandle* file) { 626 PP_FileHandle* file) {
632 Resource* file_ref = 627 Resource* file_ref =
(...skipping 30 matching lines...) Expand all
663 INTERFACE_ID_PPB_FLASH_FILE_FILEREF, 658 INTERFACE_ID_PPB_FLASH_FILE_FILEREF,
664 file_ref->host_resource(), info, &result)); 659 file_ref->host_resource(), info, &result));
665 return result; 660 return result;
666 } 661 }
667 662
668 const PPB_Flash_File_FileRef flash_file_fileref_interface = { 663 const PPB_Flash_File_FileRef flash_file_fileref_interface = {
669 &OpenFileRefFile, 664 &OpenFileRefFile,
670 &QueryFileRefFile, 665 &QueryFileRefFile,
671 }; 666 };
672 667
673 InterfaceProxy* CreateFlashFileFileRefProxy(Dispatcher* dispatcher) { 668 InterfaceProxy* CreateFlashFileFileRefProxy(Dispatcher* dispatcher,
674 return new PPB_Flash_File_FileRef_Proxy(dispatcher); 669 const void* target_interface) {
670 return new PPB_Flash_File_FileRef_Proxy(dispatcher, target_interface);
675 } 671 }
676 672
677 } // namespace 673 } // namespace
678 674
679 PPB_Flash_File_FileRef_Proxy::PPB_Flash_File_FileRef_Proxy( 675 PPB_Flash_File_FileRef_Proxy::PPB_Flash_File_FileRef_Proxy(
680 Dispatcher* dispatcher) 676 Dispatcher* dispatcher,
681 : InterfaceProxy(dispatcher), 677 const void* target_interface)
682 ppb_flash_file_fileref_impl_(NULL) { 678 : InterfaceProxy(dispatcher, target_interface) {
683 if (!dispatcher->IsPlugin()) {
684 ppb_flash_file_fileref_impl_ = static_cast<const PPB_Flash_File_FileRef*>(
685 dispatcher->local_get_interface()(PPB_FLASH_FILE_FILEREF_INTERFACE));
686 }
687 } 679 }
688 680
689 PPB_Flash_File_FileRef_Proxy::~PPB_Flash_File_FileRef_Proxy() { 681 PPB_Flash_File_FileRef_Proxy::~PPB_Flash_File_FileRef_Proxy() {
690 } 682 }
691 683
692 // static 684 // static
693 const InterfaceProxy::Info* PPB_Flash_File_FileRef_Proxy::GetInfo() { 685 const InterfaceProxy::Info* PPB_Flash_File_FileRef_Proxy::GetInfo() {
694 static const Info info = { 686 static const Info info = {
695 &flash_file_fileref_interface, 687 &flash_file_fileref_interface,
696 PPB_FLASH_FILE_FILEREF_INTERFACE, 688 PPB_FLASH_FILE_FILEREF_INTERFACE,
(...skipping 17 matching lines...) Expand all
714 // TODO(brettw) handle bad messages! 706 // TODO(brettw) handle bad messages!
715 return handled; 707 return handled;
716 } 708 }
717 709
718 void PPB_Flash_File_FileRef_Proxy::OnMsgOpenFile( 710 void PPB_Flash_File_FileRef_Proxy::OnMsgOpenFile(
719 const HostResource& host_resource, 711 const HostResource& host_resource,
720 int32_t mode, 712 int32_t mode,
721 IPC::PlatformFileForTransit* file_handle, 713 IPC::PlatformFileForTransit* file_handle,
722 int32_t* result) { 714 int32_t* result) {
723 base::PlatformFile file; 715 base::PlatformFile file;
724 *result = ppb_flash_file_fileref_impl_->OpenFile( 716 *result = ppb_flash_file_module_local_target()->
725 host_resource.host_resource(), mode, &file); 717 OpenFile(host_resource.host_resource(), mode, &file);
726 *file_handle = PlatformFileToPlatformFileForTransit( 718 *file_handle = PlatformFileToPlatformFileForTransit(
727 dispatcher(), result, file); 719 dispatcher(), result, file);
728 } 720 }
729 721
730 void PPB_Flash_File_FileRef_Proxy::OnMsgQueryFile( 722 void PPB_Flash_File_FileRef_Proxy::OnMsgQueryFile(
731 const HostResource& host_resource, 723 const HostResource& host_resource,
732 PP_FileInfo* info, 724 PP_FileInfo* info,
733 int32_t* result) { 725 int32_t* result) {
734 *result = ppb_flash_file_fileref_impl_->QueryFile( 726 *result = ppb_flash_file_module_local_target()->
735 host_resource.host_resource(), info); 727 QueryFile(host_resource.host_resource(), info);
736 } 728 }
737 729
738 } // namespace proxy 730 } // namespace proxy
739 } // namespace ppapi 731 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_flash_file_proxy.h ('k') | ppapi/proxy/ppb_flash_menu_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698