Commit ae8c3059 authored by Satoshi Niwa's avatar Satoshi Niwa Committed by Commit Bot

Define ARC FileProvider URL constans in...

Define ARC FileProvider URL constans in arc/fileapi/arc_content_file_system_url_util and have other files use them

BUG=b:111816608
TEST=out/Default/unit_tests --gtest_filter="FileManagerPathUtilConvertUrlTest.*"

Change-Id: I4fac43a8f2f1c48389e275dfe56f7bb39efd6ef9
Reviewed-on: https://chromium-review.googlesource.com/c/1295976Reviewed-by: default avatarRyo Hashimoto <hashimoto@chromium.org>
Reviewed-by: default avatarNaoki Fukino <fukino@chromium.org>
Commit-Queue: Satoshi Niwa <niwa@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602206}
parent 241dce66
......@@ -12,6 +12,10 @@
namespace arc {
const char kContentFileSystemMountPointName[] = "arc-content";
const char kIntentHelperFileproviderUrl[] =
"content://org.chromium.arc.intent_helper.fileprovider/";
const char kFileSystemFileproviderUrl[] =
"content://org.chromium.arc.file_system.fileprovider/";
const base::FilePath::CharType kContentFileSystemMountPointPath[] =
FILE_PATH_LITERAL("/special/arc-content");
......
......@@ -19,6 +19,12 @@ namespace arc {
// The name of the ARC content file system mount point.
extern const char kContentFileSystemMountPointName[];
// ARC FileProvider URLs.
// TODO(niwa): Remove kIntentHelperFileproviderUrl once we completely move
// ARC FileProvider to arc.file_system (b/111816608).
extern const char kIntentHelperFileproviderUrl[];
extern const char kFileSystemFileproviderUrl[];
// The path of the ARC content file system mount point.
extern const base::FilePath::CharType kContentFileSystemMountPointPath[];
......
......@@ -16,6 +16,7 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h"
#include "chrome/browser/chromeos/file_manager/app_id.h"
#include "chrome/browser/chromeos/file_manager/fileapi_util.h"
#include "chrome/browser/chromeos/file_manager/path_util.h"
......@@ -40,11 +41,6 @@ namespace {
constexpr char kAppIdSeparator = '/';
constexpr char kIntentHelperFileproviderUrl[] =
"content://org.chromium.arc.intent_helper.fileprovider/";
constexpr char kFileSystemFileproviderUrl[] =
"content://org.chromium.arc.file_system.fileprovider/";
// Converts an Android intent action (see kIntentAction* in
// components/arc/intent_helper/intent_constants.h) to a file task action ID
// (see chrome/browser/chromeos/file_manager/file_tasks.h).
......@@ -122,10 +118,10 @@ arc::mojom::OpenUrlsRequestPtr ConstructOpenUrlsRequest(
// TODO(niwa): Remove this and update path_util to use
// file_system.fileprovider by default once we complete migration.
std::string url_string = content_urls[i].spec();
if (base::StartsWith(url_string, kIntentHelperFileproviderUrl,
if (base::StartsWith(url_string, arc::kIntentHelperFileproviderUrl,
base::CompareCase::INSENSITIVE_ASCII)) {
url_string.replace(0, strlen(kIntentHelperFileproviderUrl),
kFileSystemFileproviderUrl);
url_string.replace(0, strlen(arc::kIntentHelperFileproviderUrl),
arc::kFileSystemFileproviderUrl);
}
arc::mojom::ContentUrlWithMimeTypePtr url_with_type =
......
......@@ -12,6 +12,7 @@
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/sys_info.h"
#include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h"
#include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root.h"
#include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_root_map.h"
#include "chrome/browser/chromeos/arc/fileapi/chrome_content_provider_url_util.h"
......@@ -44,9 +45,6 @@ constexpr char kTeamDrivesRelativeToDriveMount[] = "team_drives";
constexpr char kComputersRelativeToDriveMount[] = "Computers";
constexpr char kAndroidFilesMountPointName[] = "android_files";
// Sync with the file provider in ARC++ side.
constexpr char kArcFileProviderUrl[] =
"content://org.chromium.arc.intent_helper.fileprovider/";
// Sync with the root name defined with the file provider in ARC++ side.
constexpr base::FilePath::CharType kArcDownloadRoot[] =
FILE_PATH_LITERAL("/download");
......@@ -222,7 +220,9 @@ bool ConvertPathToArcUrl(const base::FilePath& path, GURL* arc_url_out) {
GetDownloadsFolderForProfile(primary_profile);
base::FilePath result_path(kArcDownloadRoot);
if (primary_downloads.AppendRelativePath(path, &result_path)) {
*arc_url_out = GURL(kArcFileProviderUrl)
// TODO(niwa): Switch to using kFileSystemFileproviderUrl once we completely
// move FileProvider to arc.file_system (b/111816608).
*arc_url_out = GURL(arc::kIntentHelperFileproviderUrl)
.Resolve(net::EscapePath(result_path.AsUTF8Unsafe()));
return true;
}
......@@ -231,7 +231,8 @@ bool ConvertPathToArcUrl(const base::FilePath& path, GURL* arc_url_out) {
result_path = base::FilePath(kArcExternalFilesRoot);
if (base::FilePath(kAndroidFilesPath)
.AppendRelativePath(path, &result_path)) {
*arc_url_out = GURL(kArcFileProviderUrl)
// TODO(niwa): Switch to using kFileSystemFileproviderUrl.
*arc_url_out = GURL(arc::kIntentHelperFileproviderUrl)
.Resolve(net::EscapePath(result_path.AsUTF8Unsafe()));
return true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment