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

Unified Diff: net/url_request/url_request_file_job.cc

Issue 739033003: Support content scheme uri for Chrome on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
Index: net/url_request/url_request_file_job.cc
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc
index 7b3b1954c057c0fd5ad1a0009b6c5f3c31657f90..239b9d3621e85545619f3c7534606350ad03fedb 100644
--- a/net/url_request/url_request_file_job.cc
+++ b/net/url_request/url_request_file_job.cc
@@ -41,6 +41,10 @@
#include "net/url_request/url_request_file_dir_job.h"
#include "url/gurl.h"
+#if defined(OS_ANDROID)
+#include "base/android/content_uri_utils.h"
+#endif
+
#if defined(OS_WIN)
#include "base/win/shortcut.h"
#endif
@@ -213,6 +217,15 @@ void URLRequestFileJob::FetchMetaInfo(const base::FilePath& file_path,
meta_info->file_size = file_info.size;
meta_info->is_directory = file_info.is_directory;
}
+#if defined(OS_ANDROID)
+ if (file_path.IsContentUri()) {
+ if (meta_info->file_exists) {
+ meta_info->mime_type = base::GetContentUriMimeType(file_path);
+ meta_info->mime_type_result = !meta_info->mime_type.empty();
+ }
+ return;
+ }
+#endif
// On Windows GetMimeTypeFromFile() goes to the registry. Thus it should be
// done in WorkerPool.
meta_info->mime_type_result = GetMimeTypeFromFile(file_path,

Powered by Google App Engine
This is Rietveld 408576698