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

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: Profile check Created 3 years, 7 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..4e8c0d0bf9c2eb2c7e1fad2fd8388a6b547d9f50 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::Bind(callback, base::Optional<std::string>()));
dcheng 2017/06/01 11:06:44 Let's use base::nullopt instead of base::Optional<
hashimoto 2017/06/01 11:30:16 Sounds good. Done.
+ 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