| 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 65645e014eff6e375ed097fab7c90b424a689935..b84ff1307bdf858a58aa6453da455b8e65871c76 100644
|
| --- a/content/browser/renderer_host/file_utilities_message_filter.cc
|
| +++ b/content/browser/renderer_host/file_utilities_message_filter.cc
|
| @@ -8,6 +8,10 @@
|
| #include "content/browser/child_process_security_policy_impl.h"
|
| #include "content/common/file_utilities_messages.h"
|
|
|
| +#if defined(OS_ANDROID)
|
| +#include "net/android/content_uri_utils.h"
|
| +#endif
|
| +
|
| namespace content {
|
|
|
| FileUtilitiesMessageFilter::FileUtilitiesMessageFilter(int process_id)
|
| @@ -29,6 +33,9 @@ bool FileUtilitiesMessageFilter::OnMessageReceived(const IPC::Message& message,
|
| bool handled = true;
|
| IPC_BEGIN_MESSAGE_MAP_EX(FileUtilitiesMessageFilter, message, *message_was_ok)
|
| IPC_MESSAGE_HANDLER(FileUtilitiesMsg_GetFileInfo, OnGetFileInfo)
|
| +#if defined(OS_ANDROID)
|
| + IPC_MESSAGE_HANDLER(FileUtilitiesMsg_GetContentUrlInfo, OnGetContentUrlInfo)
|
| +#endif
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| IPC_END_MESSAGE_MAP()
|
| return handled;
|
| @@ -52,4 +59,29 @@ void FileUtilitiesMessageFilter::OnGetFileInfo(
|
| *status = base::PLATFORM_FILE_ERROR_FAILED;
|
| }
|
|
|
| +#if defined(OS_ANDROID)
|
| +void FileUtilitiesMessageFilter::OnGetContentUrlInfo(
|
| + const GURL& content_url,
|
| + base::PlatformFileInfo* result,
|
| + base::PlatformFileError* status) {
|
| + *result = base::PlatformFileInfo();
|
| + *status = base::PLATFORM_FILE_OK;
|
| +
|
| + // Get metadata only when the child process has been granted permission to
|
| + // read the content url.
|
| + if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadContentUrl(
|
| + process_id_, content_url)) {
|
| + return;
|
| + }
|
| +
|
| + // TODO(qinmin): Move the logic to content_uri_utils.h and find a way
|
| + // to extract information other than size.
|
| + int64 size = net::GetContentUrlLengthSync(content_url);
|
| + if (size < 0)
|
| + *status = base::PLATFORM_FILE_ERROR_FAILED;
|
| + result->size = size;
|
| +}
|
| +#endif
|
| +
|
| +
|
| } // namespace content
|
|
|