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

Side by Side Diff: webkit/plugins/ppapi/ppb_flash_impl.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
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_impl.h ('k') | no next file » | 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) 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 "webkit/plugins/ppapi/ppb_flash_impl.h" 5 #include "webkit/plugins/ppapi/ppb_flash_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 #endif 522 #endif
523 size_t size = name.size() + 1; 523 size_t size = name.size() + 1;
524 char* name_copy = new char[size]; 524 char* name_copy = new char[size];
525 memcpy(name_copy, name.c_str(), size); 525 memcpy(name_copy, name.c_str(), size);
526 entry.name = name_copy; 526 entry.name = name_copy;
527 entry.is_dir = BoolToPPBool(pepper_contents[i].is_dir); 527 entry.is_dir = BoolToPPBool(pepper_contents[i].is_dir);
528 } 528 }
529 return PP_OK; 529 return PP_OK;
530 } 530 }
531 531
532 int32_t PPB_Flash_Impl::CreateTemporaryFile(PP_Instance instance,
533 PP_FileHandle* file) {
534 if (!file)
535 return PP_ERROR_BADARGUMENT;
536
537 PluginInstance* plugin_instance = HostGlobals::Get()->GetInstance(instance);
538 if (!plugin_instance) {
539 *file = PP_kInvalidFileHandle;
540 return PP_ERROR_FAILED;
541 }
542
543 base::PlatformFileError result =
544 plugin_instance->delegate()->CreateTemporaryFile(file);
545 return ::ppapi::PlatformFileErrorToPepperError(result);
546 }
547
532 int32_t PPB_Flash_Impl::OpenFileRef(PP_Instance pp_instance, 548 int32_t PPB_Flash_Impl::OpenFileRef(PP_Instance pp_instance,
533 PP_Resource file_ref_id, 549 PP_Resource file_ref_id,
534 int32_t mode, 550 int32_t mode,
535 PP_FileHandle* file) { 551 PP_FileHandle* file) {
536 int flags = 0; 552 int flags = 0;
537 if (!::ppapi::PepperFileOpenFlagsToPlatformFileFlags(mode, &flags) || !file) 553 if (!::ppapi::PepperFileOpenFlagsToPlatformFileFlags(mode, &flags) || !file)
538 return PP_ERROR_BADARGUMENT; 554 return PP_ERROR_BADARGUMENT;
539 555
540 EnterResourceNoLock<PPB_FileRef_API> enter(file_ref_id, true); 556 EnterResourceNoLock<PPB_FileRef_API> enter(file_ref_id, true);
541 if (enter.failed()) 557 if (enter.failed())
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } 671 }
656 case PP_FLASH_CLIPBOARD_FORMAT_INVALID: 672 case PP_FLASH_CLIPBOARD_FORMAT_INVALID:
657 break; 673 break;
658 } 674 }
659 675
660 return PP_ERROR_BADARGUMENT; 676 return PP_ERROR_BADARGUMENT;
661 } 677 }
662 678
663 } // namespace ppapi 679 } // namespace ppapi
664 } // namespace webkit 680 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698