Reland: Allow (auto-installed) external web apps
These are the Web App analogs of external extensions, described at
https://developer.chrome.com/apps/external_extensions
On start up, *.json files (often but not necessarily named
external_extensions.json) are scanned in a number of directories. Prior
to this CL, such .json files can install regular extensions (.crx files)
or, on Chrome OS, Android apps. New in this CL is being able to install
Web Apps (sometimes known as Progressive Web Apps or PWAs).
For example, the chrome::DIR_USER_EXTERNAL_EXTENSIONS path (defined in
chrome/common/chrome_paths.h) can correspond to file system directory
like "$HOME/.config/chromium/test-user/.config/chromium/External
Extensions". Placing a foo_bar.json file containing:
{
"web_app_manifest_url": "https://www.chromestatus.com/static/manifest.json",
"web_app_start_url": "https://www.chromestatus.com/features"
}
in that directory will install the Chrome Platform Status web app.
This is a manual roll-forward of
https://chromium-review.googlesource.com/c/chromium/src/+/1127214
after fixing the threading flakiness that lead to the roll-back.
Bug: 855281
Change-Id: Ifc0a7a0a923cfe932ed077a34ababf3dc7df2014
Reviewed-on: https://chromium-review.googlesource.com/1157704
Commit-Queue: Dominick Ng <[email protected]>
Reviewed-by: Dominick Ng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#580557}
diff --git a/chrome/browser/web_applications/web_app_provider.h b/chrome/browser/web_applications/web_app_provider.h
index 6e1de21f..da3efc3 100644
--- a/chrome/browser/web_applications/web_app_provider.h
+++ b/chrome/browser/web_applications/web_app_provider.h
@@ -6,8 +6,11 @@
#define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROVIDER_H_
#include <memory>
+#include <vector>
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/web_applications/components/pending_app_manager.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/prefs/pref_service.h"
@@ -40,9 +43,15 @@
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
private:
+ void ScanForExternalWebApps();
+ void ScanForExternalWebAppsCallback(
+ std::vector<web_app::PendingAppManager::AppInfo>);
+
std::unique_ptr<PendingAppManager> pending_app_manager_;
std::unique_ptr<WebAppPolicyManager> web_app_policy_manager_;
+ base::WeakPtrFactory<WebAppProvider> weak_ptr_factory_{this};
+
DISALLOW_COPY_AND_ASSIGN(WebAppProvider);
};