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

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

Issue 10534045: Add CreateTemporaryFile to PPB_Flash_File_ModuleLocal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
OLDNEW
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 <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 char* name_copy = new char[name.size() + 1]; 795 char* name_copy = new char[name.size() + 1];
796 memcpy(name_copy, name.c_str(), name.size() + 1); 796 memcpy(name_copy, name.c_str(), name.size() + 1);
797 dest->name = name_copy; 797 dest->name = name_copy;
798 dest->is_dir = PP_FromBool(source.is_dir); 798 dest->is_dir = PP_FromBool(source.is_dir);
799 } 799 }
800 } 800 }
801 801
802 return ppapi::PlatformFileErrorToPepperError(error); 802 return ppapi::PlatformFileErrorToPepperError(error);
803 } 803 }
804 804
805 int32_t PPB_Flash_Proxy::CreateTemporaryFile(PP_Instance instance,
806 const char* dir_path,
807 PP_FileHandle* file,
808 std::string* file_name) {
809 if (!dir_path || !file || !file_name)
810 return PP_ERROR_BADARGUMENT;
811
812 base::PlatformFileError error;
813 IPC::PlatformFileForTransit transit_file;
814 ppapi::PepperFilePath pepper_dir_path(
815 ppapi::PepperFilePath::DOMAIN_MODULE_LOCAL,
816 FilePath::FromUTF8Unsafe(dir_path));
817
818 if (PluginGlobals::Get()->plugin_proxy_delegate()->SendToBrowser(
819 new PepperFileMsg_CreateTemporaryFile(pepper_dir_path, &error,
820 &transit_file, file_name))) {
821 *file = IPC::PlatformFileForTransitToPlatformFile(transit_file);
822 } else {
823 error = base::PLATFORM_FILE_ERROR_FAILED;
824 *file = base::kInvalidPlatformFileValue;
825 file_name->clear();
826 }
827
828 return ppapi::PlatformFileErrorToPepperError(error);
829 }
830
805 int32_t PPB_Flash_Proxy::OpenFileRef(PP_Instance instance, 831 int32_t PPB_Flash_Proxy::OpenFileRef(PP_Instance instance,
806 PP_Resource file_ref_id, 832 PP_Resource file_ref_id,
807 int32_t mode, 833 int32_t mode,
808 PP_FileHandle* file) { 834 PP_FileHandle* file) {
809 EnterResourceNoLock<thunk::PPB_FileRef_API> enter(file_ref_id, true); 835 EnterResourceNoLock<thunk::PPB_FileRef_API> enter(file_ref_id, true);
810 if (enter.failed()) 836 if (enter.failed())
811 return PP_ERROR_BADRESOURCE; 837 return PP_ERROR_BADRESOURCE;
812 838
813 int32_t result = PP_ERROR_FAILED; 839 int32_t result = PP_ERROR_FAILED;
814 IPC::PlatformFileForTransit transit; 840 IPC::PlatformFileForTransit transit;
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 // It's rarely used enough that we just request this interface when needed. 1141 // It's rarely used enough that we just request this interface when needed.
1116 const PPB_Flash_Print_1_0* print_interface = 1142 const PPB_Flash_Print_1_0* print_interface =
1117 static_cast<const PPB_Flash_Print_1_0*>( 1143 static_cast<const PPB_Flash_Print_1_0*>(
1118 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0)); 1144 dispatcher()->local_get_interface()(PPB_FLASH_PRINT_INTERFACE_1_0));
1119 if (print_interface) 1145 if (print_interface)
1120 print_interface->InvokePrinting(instance); 1146 print_interface->InvokePrinting(instance);
1121 } 1147 }
1122 1148
1123 } // namespace proxy 1149 } // namespace proxy
1124 } // namespace ppapi 1150 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698