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

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

Issue 2511973003: Use ArcFileSystemInstance to access files on ARC. (Closed)
Patch Set: Fix unit_tests build, and rename file_system_util. 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_file_system_instance_util.cc
diff --git a/chrome/browser/chromeos/arc/fileapi/intent_helper_util.cc b/chrome/browser/chromeos/arc/fileapi/arc_file_system_instance_util.cc
similarity index 60%
rename from chrome/browser/chromeos/arc/fileapi/intent_helper_util.cc
rename to chrome/browser/chromeos/arc/fileapi/arc_file_system_instance_util.cc
index 4b66f75bc38f5641bf45f1efed5fbc781a13e407..56d317360a5395ed8d275dba258bf7461a857d81 100644
--- a/chrome/browser/chromeos/arc/fileapi/intent_helper_util.cc
+++ b/chrome/browser/chromeos/arc/fileapi/arc_file_system_instance_util.cc
@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/arc/fileapi/intent_helper_util.h"
+#include "chrome/browser/chromeos/arc/fileapi/arc_file_system_instance_util.h"
#include "components/arc/arc_bridge_service.h"
#include "content/public/browser/browser_thread.h"
namespace arc {
-namespace intent_helper_util {
+namespace file_system_instance_util {
namespace {
void OnGetFileSize(
- const mojom::IntentHelperInstance::GetFileSizeCallback& callback,
+ const mojom::FileSystemInstance::GetFileSizeCallback& callback,
int64_t size) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE,
@@ -23,7 +23,7 @@ void OnGetFileSize(
void GetFileSizeOnUIThread(
const GURL& arc_url,
- const mojom::IntentHelperInstance::GetFileSizeCallback& callback) {
+ const mojom::FileSystemInstance::GetFileSizeCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
auto* arc_bridge_service = arc::ArcBridgeService::Get();
if (!arc_bridge_service) {
@@ -31,20 +31,19 @@ void GetFileSizeOnUIThread(
OnGetFileSize(callback, -1);
return;
}
- mojom::IntentHelperInstance* intent_helper_instance =
- arc_bridge_service->intent_helper()->GetInstanceForMethod("GetFileSize",
- 15);
- if (!intent_helper_instance) {
- LOG(ERROR) << "Failed to get IntentHelperInstance.";
+ mojom::FileSystemInstance* file_system_instance =
+ arc_bridge_service->file_system()->GetInstanceForMethod("GetFileSize", 1);
+ if (!file_system_instance) {
+ LOG(ERROR) << "Failed to get FileSystemInstance.";
OnGetFileSize(callback, -1);
return;
}
- intent_helper_instance->GetFileSize(arc_url.spec(),
- base::Bind(&OnGetFileSize, callback));
+ file_system_instance->GetFileSize(arc_url.spec(),
+ base::Bind(&OnGetFileSize, callback));
}
void OnOpenFileToRead(
- const mojom::IntentHelperInstance::OpenFileToReadCallback& callback,
+ const mojom::FileSystemInstance::OpenFileToReadCallback& callback,
mojo::ScopedHandle handle) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE,
@@ -53,7 +52,7 @@ void OnOpenFileToRead(
void OpenFileToReadOnUIThread(
const GURL& arc_url,
- const mojom::IntentHelperInstance::OpenFileToReadCallback& callback) {
+ const mojom::FileSystemInstance::OpenFileToReadCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
auto* arc_bridge_service = arc::ArcBridgeService::Get();
if (!arc_bridge_service) {
@@ -61,23 +60,23 @@ void OpenFileToReadOnUIThread(
OnOpenFileToRead(callback, mojo::ScopedHandle());
return;
}
- mojom::IntentHelperInstance* intent_helper_instance =
- arc_bridge_service->intent_helper()->GetInstanceForMethod(
- "OpenFileToRead", 15);
- if (!intent_helper_instance) {
- LOG(ERROR) << "Failed to get IntentHelperInstance.";
+ mojom::FileSystemInstance* file_system_instance =
+ arc_bridge_service->file_system()->GetInstanceForMethod("OpenFileToRead",
+ 1);
+ if (!file_system_instance) {
+ LOG(ERROR) << "Failed to get FileSystemInstance.";
OnOpenFileToRead(callback, mojo::ScopedHandle());
return;
}
- intent_helper_instance->OpenFileToRead(
- arc_url.spec(), base::Bind(&OnOpenFileToRead, callback));
+ file_system_instance->OpenFileToRead(arc_url.spec(),
+ base::Bind(&OnOpenFileToRead, callback));
}
} // namespace
void GetFileSizeOnIOThread(
const GURL& arc_url,
- const mojom::IntentHelperInstance::GetFileSizeCallback& callback) {
+ const mojom::FileSystemInstance::GetFileSizeCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
@@ -86,13 +85,13 @@ void GetFileSizeOnIOThread(
void OpenFileToReadOnIOThread(
const GURL& arc_url,
- const mojom::IntentHelperInstance::OpenFileToReadCallback& callback) {
+ const mojom::FileSystemInstance::OpenFileToReadCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::Bind(&OpenFileToReadOnUIThread, arc_url, callback));
}
-} // namespace intent_helper_util
+} // namespace file_system_instance_util
} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698