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

Unified Diff: ppapi/shared_impl/file_type_conversion.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/shared_impl/file_type_conversion.h ('k') | webkit/plugins/ppapi/ppb_file_ref_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/file_type_conversion.cc
diff --git a/ppapi/shared_impl/file_type_conversion.cc b/ppapi/shared_impl/file_type_conversion.cc
index 5185daa704c921f29c23c16fcf57b35f1de3f998..87edeb0cd51b64eadd5ed055492f29b3f04da193 100644
--- a/ppapi/shared_impl/file_type_conversion.cc
+++ b/ppapi/shared_impl/file_type_conversion.cc
@@ -4,8 +4,10 @@
#include "ppapi/shared_impl/file_type_conversion.h"
+#include "base/logging.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_file_io.h"
+#include "ppapi/shared_impl/time_conversion.h"
namespace ppapi {
@@ -73,4 +75,23 @@ bool PepperFileOpenFlagsToPlatformFileFlags(int32_t pp_open_flags,
return true;
}
+void PlatformFileInfoToPepperFileInfo(const base::PlatformFileInfo& info,
+ PP_FileSystemType fs_type,
+ PP_FileInfo* info_out) {
+ DCHECK(info_out);
+ info_out->size = info.size;
+ info_out->creation_time = TimeToPPTime(info.creation_time);
+ info_out->last_access_time = TimeToPPTime(info.last_accessed);
+ info_out->last_modified_time = TimeToPPTime(info.last_modified);
+ info_out->system_type = fs_type;
+ if (info.is_directory) {
+ info_out->type = PP_FILETYPE_DIRECTORY;
+ } else if (info.is_symbolic_link) {
+ DCHECK_EQ(PP_FILESYSTEMTYPE_EXTERNAL, fs_type);
+ info_out->type = PP_FILETYPE_OTHER;
+ } else {
+ info_out->type = PP_FILETYPE_REGULAR;
+ }
+}
+
} // namespace ppapi
« no previous file with comments | « ppapi/shared_impl/file_type_conversion.h ('k') | webkit/plugins/ppapi/ppb_file_ref_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698