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

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

Issue 2467213002: arc: Implement Read and GetFileSize for ARC content file system (Closed)
Patch Set: Created 4 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: chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util.cc
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util.cc b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util.cc
index 07a160b4081ac01ce8212d5581230ada1b33787c..ef4c5fe4c4e5a8268ff3cf0e98dac07962a16f8e 100644
--- a/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util.cc
@@ -5,11 +5,31 @@
#include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_async_file_util.h"
#include "base/threading/thread_task_runner_handle.h"
+#include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h"
+#include "chrome/browser/chromeos/arc/fileapi/intent_helper_util.h"
+#include "content/public/browser/browser_thread.h"
#include "net/base/net_errors.h"
#include "storage/browser/blob/shareable_file_reference.h"
namespace arc {
+namespace {
+
+void OnGetFileSize(const storage::AsyncFileUtil::GetFileInfoCallback& callback,
+ int64_t size) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ base::File::Info info;
+ base::File::Error error = base::File::FILE_OK;
+ if (size == -1) {
+ error = base::File::FILE_ERROR_FAILED;
+ } else {
+ info.size = size;
+ }
+ callback.Run(error, info);
+}
+
+} // namespace
+
ArcContentFileSystemAsyncFileUtil::ArcContentFileSystemAsyncFileUtil() =
default;
@@ -52,10 +72,9 @@ void ArcContentFileSystemAsyncFileUtil::GetFileInfo(
const storage::FileSystemURL& url,
int fields,
const GetFileInfoCallback& callback) {
- NOTIMPLEMENTED();
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE,
- base::Bind(callback, base::File::FILE_ERROR_FAILED, base::File::Info()));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ intent_helper_util::GetFileSizeOnIOThread(
+ FileSystemUrlToArcUrl(url), base::Bind(&OnGetFileSize, callback));
}
void ArcContentFileSystemAsyncFileUtil::ReadDirectory(

Powered by Google App Engine
This is Rietveld 408576698