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

Unified Diff: chrome/browser/chromeos/file_manager/filesystem_api_util.cc

Issue 603373002: Files.app: Always do fallback guessing mime type from file extensions when obtaining empty metadata… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/file_manager/filesystem_api_util.cc
diff --git a/chrome/browser/chromeos/file_manager/filesystem_api_util.cc b/chrome/browser/chromeos/file_manager/filesystem_api_util.cc
index c19fb7ecb9a740c233ee6cae328a83861e2384f0..08c612726c6d3d80995d945760d85dc01eb24a1d 100644
--- a/chrome/browser/chromeos/file_manager/filesystem_api_util.cc
+++ b/chrome/browser/chromeos/file_manager/filesystem_api_util.cc
@@ -35,7 +35,8 @@ void GetMimeTypeAfterGetResourceEntryForDrive(
scoped_ptr<drive::ResourceEntry> entry) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (error != drive::FILE_ERROR_OK || !entry->has_file_specific_info()) {
+ if (error != drive::FILE_ERROR_OK || !entry->has_file_specific_info() ||
+ entry->file_specific_info().content_mime_type().empty()) {
callback.Run(false, std::string());
return;
}
@@ -50,7 +51,7 @@ void GetMimeTypeAfterGetMetadataForProvidedFileSystem(
base::File::Error result) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (result != base::File::FILE_OK) {
+ if (result != base::File::FILE_OK || metadata->mime_type.empty()) {
callback.Run(false, std::string());
return;
}
@@ -177,11 +178,13 @@ void GetNonNativeLocalPathMimeType(
return;
}
- // As a fallback just return success with an empty mime type value.
+ // We don't have a way to obtain metadata other than drive and FSP. Returns an
+ // error with empty MIME type, that leads fallback guessing mime type from
+ // file extensions.
content::BrowserThread::PostTask(
content::BrowserThread::UI,
FROM_HERE,
- base::Bind(callback, true /* success */, std::string()));
+ base::Bind(callback, false /* failure */, std::string()));
}
void IsNonNativeLocalPathDirectory(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698