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

Side by Side Diff: webkit/plugins/ppapi/ppb_file_ref_impl.cc

Issue 16140025: Pepper: Refactor FileInfo conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix yzshen's comments. Created 7 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
« no previous file with comments | « ppapi/shared_impl/file_type_conversion.cc ('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_file_ref_impl.h" 5 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
6 6
7 #include "base/files/file_util_proxy.h" 7 #include "base/files/file_util_proxy.h"
8 #include "base/platform_file.h" 8 #include "base/platform_file.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 void IgnoreCloseCallback(base::PlatformFileError error_code) { 92 void IgnoreCloseCallback(base::PlatformFileError error_code) {
93 } 93 }
94 94
95 void PlatformFileInfoToPPFileInfo( 95 void PlatformFileInfoToPPFileInfo(
96 const base::PlatformFileInfo& file_info, 96 const base::PlatformFileInfo& file_info,
97 PP_FileSystemType file_system_type, 97 PP_FileSystemType file_system_type,
98 PP_FileInfo* info) { 98 PP_FileInfo* info) {
99 DCHECK(info); 99 DCHECK(info);
100 100 ::ppapi::PlatformFileInfoToPepperFileInfo(file_info, file_system_type, info);
101 info->size = file_info.size;
102 info->system_type = file_system_type;
103 info->creation_time = ::ppapi::TimeToPPTime(file_info.creation_time);
104 info->last_access_time = ::ppapi::TimeToPPTime(file_info.last_accessed);
105 info->last_modified_time = ::ppapi::TimeToPPTime(file_info.last_modified);
106
107 if (file_info.is_symbolic_link) {
108 // Only external filesystem may have symbolic link files.
109 DCHECK_EQ(PP_FILESYSTEMTYPE_EXTERNAL, file_system_type);
110 info->type = PP_FILETYPE_OTHER;
111 } else if (file_info.is_directory) {
112 info->type = PP_FILETYPE_DIRECTORY;
113 } else {
114 info->type = PP_FILETYPE_REGULAR;
115 }
116 } 101 }
117 102
118 void GetFileInfoCallback( 103 void GetFileInfoCallback(
119 scoped_refptr<base::TaskRunner> task_runner, 104 scoped_refptr<base::TaskRunner> task_runner,
120 base::PlatformFile file, 105 base::PlatformFile file,
121 linked_ptr<PP_FileInfo> info, 106 linked_ptr<PP_FileInfo> info,
122 scoped_refptr<TrackedCallback> callback, 107 scoped_refptr<TrackedCallback> callback,
123 base::PlatformFileError error_code, 108 base::PlatformFileError error_code,
124 const base::PlatformFileInfo& file_info) { 109 const base::PlatformFileInfo& file_info) {
125 base::FileUtilProxy::Close( 110 base::FileUtilProxy::Close(
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 GetFileSystemURL(), 509 GetFileSystemURL(),
525 base::Bind(&DidReadDirectory, 510 base::Bind(&DidReadDirectory,
526 callback, base::Unretained(this), files, file_types), 511 callback, base::Unretained(this), files, file_types),
527 base::Bind(&DidFinishFileOperation, callback))) 512 base::Bind(&DidFinishFileOperation, callback)))
528 return PP_ERROR_FAILED; 513 return PP_ERROR_FAILED;
529 return PP_OK_COMPLETIONPENDING; 514 return PP_OK_COMPLETIONPENDING;
530 } 515 }
531 516
532 } // namespace ppapi 517 } // namespace ppapi
533 } // namespace webkit 518 } // namespace webkit
OLDNEW
« no previous file with comments | « ppapi/shared_impl/file_type_conversion.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698