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

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: Rebased to ToT. Created 4 years 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 70%
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 f69eaac816199633723aa9f9e2fa66ecbeebe229..ca461d364a3cb1dd471b5cb56e376421a24b8dc1 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,20 @@
// 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"
+#include "url/gurl.h"
namespace arc {
-namespace intent_helper_util {
+namespace file_system_instance_util {
namespace {
-constexpr uint32_t kGetFileSizeVersion = 15;
-constexpr uint32_t kOpenFileToReadVersion = 15;
+constexpr uint32_t kGetFileSizeVersion = 1;
+constexpr uint32_t kOpenFileToReadVersion = 1;
void OnGetFileSize(const GetFileSizeCallback& callback, int64_t size) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -31,16 +32,16 @@ void GetFileSizeOnUIThread(const GURL& arc_url,
OnGetFileSize(callback, -1);
return;
}
- mojom::IntentHelperInstance* intent_helper_instance =
- arc_bridge_service->intent_helper()->GetInstanceForMethod(
- "GetFileSizeDeprecated", kGetFileSizeVersion);
- if (!intent_helper_instance) {
- LOG(ERROR) << "Failed to get IntentHelperInstance.";
+ mojom::FileSystemInstance* file_system_instance =
+ arc_bridge_service->file_system()->GetInstanceForMethod(
+ "GetFileSize", kGetFileSizeVersion);
+ if (!file_system_instance) {
+ LOG(ERROR) << "Failed to get FileSystemInstance.";
OnGetFileSize(callback, -1);
return;
}
- intent_helper_instance->GetFileSizeDeprecated(
- arc_url.spec(), base::Bind(&OnGetFileSize, callback));
+ file_system_instance->GetFileSize(arc_url.spec(),
+ base::Bind(&OnGetFileSize, callback));
}
void OnOpenFileToRead(const OpenFileToReadCallback& callback,
@@ -59,16 +60,16 @@ void OpenFileToReadOnUIThread(const GURL& arc_url,
OnOpenFileToRead(callback, mojo::ScopedHandle());
return;
}
- mojom::IntentHelperInstance* intent_helper_instance =
- arc_bridge_service->intent_helper()->GetInstanceForMethod(
- "OpenFileToReadDeprecated", kOpenFileToReadVersion);
- if (!intent_helper_instance) {
- LOG(ERROR) << "Failed to get IntentHelperInstance.";
+ mojom::FileSystemInstance* file_system_instance =
+ arc_bridge_service->file_system()->GetInstanceForMethod(
+ "OpenFileToRead", kOpenFileToReadVersion);
+ if (!file_system_instance) {
+ LOG(ERROR) << "Failed to get FileSystemInstance.";
OnOpenFileToRead(callback, mojo::ScopedHandle());
return;
}
- intent_helper_instance->OpenFileToReadDeprecated(
- arc_url.spec(), base::Bind(&OnOpenFileToRead, callback));
+ file_system_instance->OpenFileToRead(arc_url.spec(),
+ base::Bind(&OnOpenFileToRead, callback));
}
} // namespace
@@ -89,6 +90,6 @@ void OpenFileToReadOnIOThread(const GURL& arc_url,
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