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

Unified Diff: chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.cc

Issue 2914433002: arc: Use the MIME type returned by the container to handle content URLs (Closed)
Patch Set: Comment drop. Created 3 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
Index: chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.cc
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.cc b/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.cc
index 77bcfeb059b48412225f16d1ec23118b0943a431..b1de0ee18e1091e475108b0c9237fcc81712f098 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.cc
@@ -104,6 +104,26 @@ void ArcFileSystemOperationRunner::GetFileSize(
file_system_instance->GetFileSize(url.spec(), callback);
}
+void ArcFileSystemOperationRunner::GetMimeType(
+ const GURL& url,
+ const GetMimeTypeCallback& callback) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ if (should_defer_) {
+ deferred_operations_.emplace_back(
+ base::Bind(&ArcFileSystemOperationRunner::GetMimeType,
+ weak_ptr_factory_.GetWeakPtr(), url, callback));
+ return;
+ }
+ auto* file_system_instance = ARC_GET_INSTANCE_FOR_METHOD(
+ arc_bridge_service()->file_system(), GetMimeType);
+ if (!file_system_instance) {
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::BindOnce(callback, base::nullopt));
+ return;
+ }
+ file_system_instance->GetMimeType(url.spec(), callback);
+}
+
void ArcFileSystemOperationRunner::OpenFileToRead(
const GURL& url,
const OpenFileToReadCallback& callback) {

Powered by Google App Engine
This is Rietveld 408576698