Index: content/browser/renderer_host/file_utilities_message_filter.cc |
diff --git a/content/browser/renderer_host/file_utilities_message_filter.cc b/content/browser/renderer_host/file_utilities_message_filter.cc |
index e72916cde00582316531f63c31951cc34c500f73..0f8370aca6021d88304d56da2bdf24664b9ce129 100644 |
--- a/content/browser/renderer_host/file_utilities_message_filter.cc |
+++ b/content/browser/renderer_host/file_utilities_message_filter.cc |
@@ -31,6 +31,7 @@ bool FileUtilitiesMessageFilter::OnMessageReceived(const IPC::Message& message, |
IPC_MESSAGE_HANDLER(FileUtilitiesMsg_GetFileSize, OnGetFileSize) |
IPC_MESSAGE_HANDLER(FileUtilitiesMsg_GetFileModificationTime, |
OnGetFileModificationTime) |
+ IPC_MESSAGE_HANDLER(FileUtilitiesMsg_GetFileInfo, OnGetFileInfo) |
IPC_MESSAGE_HANDLER(FileUtilitiesMsg_OpenFile, OnOpenFile) |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP() |
@@ -71,6 +72,24 @@ void FileUtilitiesMessageFilter::OnGetFileModificationTime( |
*result = file_info.last_modified; |
} |
+void FileUtilitiesMessageFilter::OnGetFileInfo( |
+ const FilePath& path, |
+ base::PlatformFileInfo* result, |
+ base::PlatformFileError* status) { |
+ *result = base::PlatformFileInfo(); |
+ *status = base::PLATFORM_FILE_OK; |
+ |
+ // Get file metadata only when the child process has been granted |
+ // permission to read the file. |
+ if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( |
+ process_id_, path)) { |
+ return; |
+ } |
+ |
+ if (!file_util::GetFileInfo(path, result)) |
+ *status = base::PLATFORM_FILE_ERROR_FAILED; |
+} |
+ |
void FileUtilitiesMessageFilter::OnOpenFile( |
const FilePath& path, |
int mode, |