Commit c3b78856 authored by Nigel Tao's avatar Nigel Tao Committed by Commit Bot

Have external web app's *.json be in a subdir

Specifically, those *.json files live in
"/usr/share/chromium/extensions/web_apps", not one level above that.

This matches what arc_default_app_list.cc does for external ARC apps,
after substituting s/arc/web_apps/.

In the future, we may still merge all of those directories into one, but
we will start with segregrated extensions, ARC apps and web apps.

Change-Id: I79176f00b7c3c19b87468465c2640fde89498da6
Reviewed-on: https://chromium-review.googlesource.com/1166272Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: Nigel Tao <nigeltao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585670}
parent 4096ffa5
...@@ -28,6 +28,13 @@ namespace { ...@@ -28,6 +28,13 @@ namespace {
constexpr char kWebAppManifestUrl[] = "web_app_manifest_url"; constexpr char kWebAppManifestUrl[] = "web_app_manifest_url";
constexpr char kWebAppStartUrl[] = "web_app_start_url"; constexpr char kWebAppStartUrl[] = "web_app_start_url";
#if defined(OS_CHROMEOS)
// The sub-directory of the extensions directory in which to scan for external
// web apps (as opposed to external extensions or external ARC apps).
const base::FilePath::CharType kWebAppsSubDirectory[] =
FILE_PATH_LITERAL("web_apps");
#endif
std::vector<web_app::PendingAppManager::AppInfo> ScanDir(base::FilePath dir) { std::vector<web_app::PendingAppManager::AppInfo> ScanDir(base::FilePath dir) {
base::AssertBlockingAllowed(); base::AssertBlockingAllowed();
base::FilePath::StringType extension(FILE_PATH_LITERAL(".json")); base::FilePath::StringType extension(FILE_PATH_LITERAL(".json"));
...@@ -94,18 +101,14 @@ base::FilePath DetermineScanDir(Profile* profile) { ...@@ -94,18 +101,14 @@ base::FilePath DetermineScanDir(Profile* profile) {
if (chromeos::ProfileHelper::IsPrimaryProfile(profile)) { if (chromeos::ProfileHelper::IsPrimaryProfile(profile)) {
// For manual testing, you can change s/STANDALONE/USER/, as writing to // For manual testing, you can change s/STANDALONE/USER/, as writing to
// "$HOME/.config/chromium/test-user/.config/chromium/External Extensions" // "$HOME/.config/chromium/test-user/.config/chromium/External
// does not require root ACLs, unlike "/usr/share/chromium/extensions". // Extensions/web_apps" does not require root ACLs, unlike
// // "/usr/share/chromium/extensions/web_apps".
// TODO(nigeltao): do we want to append a sub-directory name, analogous to
// the "arc" in "/usr/share/chromium/extensions/arc" as per
// chrome/browser/ui/app_list/arc/arc_default_app_list.cc? Or should we not
// sort "system apps" into directories based on their platform (e.g. ARC,
// PWA, etc.), and instead examine the JSON contents (e.g. an "activity"
// key means ARC, "web_app_start_url" key means PWA, etc.)?
if (!base::PathService::Get(chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, if (!base::PathService::Get(chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS,
&dir)) { &dir)) {
LOG(ERROR) << "ScanForExternalWebApps: base::PathService::Get failed"; LOG(ERROR) << "ScanForExternalWebApps: base::PathService::Get failed";
} else {
dir = dir.Append(kWebAppsSubDirectory);
} }
} }
......
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