Commit 396edb94 authored by Alexey Baskakov's avatar Alexey Baskakov Committed by Commit Bot

WebApp: Redirect Sync prefs via WebAppProvider.

We want to erase web_app_extension_helpers.h in favor of
web_app_helpers.h.

A plan:
1) Make WebAppProvider a single entry point for all external web_appplications/
clients.
2) Introduce enable_web_app_off_extensions command line switch.
3) Create new App Sync Manager component to utilize upcoming
Unified Sync and Storage (USS) system.
4) Be able to switch between old extension-based bookmark_apps/ and
new off-extensions bookmark_apps2/ implementations inside the WebAppProvider.

TBR=sky@chromium.org

Bug: 860581
Change-Id: Iab19d936fbcf39c011fc1eff1e29125b5ddb5e16
Reviewed-on: https://chromium-review.googlesource.com/1159925
Commit-Queue: Alexey Baskakov <loyso@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580074}
parent 0518deb8
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
#include "chrome/browser/ui/webui/flags_ui.h" #include "chrome/browser/ui/webui/flags_ui.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h" #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
#include "chrome/browser/ui/webui/print_preview/sticky_settings.h" #include "chrome/browser/ui/webui/print_preview/sticky_settings.h"
#include "chrome/browser/web_applications/extensions/web_app_extension_helpers.h" #include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/webauthn/chrome_authenticator_request_delegate.h" #include "chrome/browser/webauthn/chrome_authenticator_request_delegate.h"
#include "chrome/common/buildflags.h" #include "chrome/common/buildflags.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
...@@ -586,7 +586,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { ...@@ -586,7 +586,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
extensions::NtpOverriddenBubbleDelegate::RegisterPrefs(registry); extensions::NtpOverriddenBubbleDelegate::RegisterPrefs(registry);
extensions::RuntimeAPI::RegisterPrefs(registry); extensions::RuntimeAPI::RegisterPrefs(registry);
update_client::RegisterProfilePrefs(registry); update_client::RegisterProfilePrefs(registry);
web_app::RegisterProfilePrefs(registry); web_app::WebAppProvider::RegisterProfilePrefs(registry);
#endif // BUILDFLAG(ENABLE_EXTENSIONS) #endif // BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(ENABLE_DESKTOP_IN_PRODUCT_HELP) #if BUILDFLAG(ENABLE_DESKTOP_IN_PRODUCT_HELP)
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "chrome/browser/web_applications/bookmark_apps/policy/web_app_policy_constants.h" #include "chrome/browser/web_applications/bookmark_apps/policy/web_app_policy_constants.h"
#include "chrome/browser/web_applications/extensions/pending_bookmark_app_manager.h" #include "chrome/browser/web_applications/extensions/pending_bookmark_app_manager.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
namespace web_app { namespace web_app {
...@@ -22,6 +23,12 @@ WebAppPolicyManager::WebAppPolicyManager(PrefService* pref_service, ...@@ -22,6 +23,12 @@ WebAppPolicyManager::WebAppPolicyManager(PrefService* pref_service,
WebAppPolicyManager::~WebAppPolicyManager() = default; WebAppPolicyManager::~WebAppPolicyManager() = default;
// static
void WebAppPolicyManager::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterListPref(prefs::kWebAppInstallForceList);
}
std::vector<PendingAppManager::AppInfo> std::vector<PendingAppManager::AppInfo>
WebAppPolicyManager::GetAppsToInstall() { WebAppPolicyManager::GetAppsToInstall() {
const base::Value* web_apps = const base::Value* web_apps =
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
class PrefService; class PrefService;
namespace user_prefs {
class PrefRegistrySyncable;
}
namespace web_app { namespace web_app {
// Tracks the policy that affects Web Apps and also tracks which Web Apps are // Tracks the policy that affects Web Apps and also tracks which Web Apps are
...@@ -27,6 +31,8 @@ class WebAppPolicyManager { ...@@ -27,6 +31,8 @@ class WebAppPolicyManager {
PendingAppManager* pending_app_manager); PendingAppManager* pending_app_manager);
~WebAppPolicyManager(); ~WebAppPolicyManager();
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
private: private:
std::vector<PendingAppManager::AppInfo> GetAppsToInstall(); std::vector<PendingAppManager::AppInfo> GetAppsToInstall();
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#include "chrome/browser/web_applications/extensions/web_app_extension_helpers.h" #include "chrome/browser/web_applications/extensions/web_app_extension_helpers.h"
#include "chrome/browser/web_applications/components/web_app_helpers.h" #include "chrome/browser/web_applications/components/web_app_helpers.h"
#include "chrome/common/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
namespace web_app { namespace web_app {
...@@ -18,8 +16,4 @@ std::string GetExtensionIdFromApplicationName(const std::string& app_name) { ...@@ -18,8 +16,4 @@ std::string GetExtensionIdFromApplicationName(const std::string& app_name) {
return GetAppIdFromApplicationName(app_name); return GetAppIdFromApplicationName(app_name);
} }
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterListPref(prefs::kWebAppInstallForceList);
}
} // namespace web_app } // namespace web_app
...@@ -7,10 +7,6 @@ ...@@ -7,10 +7,6 @@
#include <string> #include <string>
namespace user_prefs {
class PrefRegistrySyncable;
}
namespace web_app { namespace web_app {
// Compute a deterministic name based on an extension/apps's id. // Compute a deterministic name based on an extension/apps's id.
...@@ -23,8 +19,6 @@ std::string GenerateApplicationNameFromExtensionId(const std::string& id); ...@@ -23,8 +19,6 @@ std::string GenerateApplicationNameFromExtensionId(const std::string& id);
// TODO(loyso): Remove it. // TODO(loyso): Remove it.
std::string GetExtensionIdFromApplicationName(const std::string& app_name); std::string GetExtensionIdFromApplicationName(const std::string& app_name);
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
} // namespace web_app } // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_EXTENSIONS_WEB_APP_EXTENSION_HELPERS_H_ #endif // CHROME_BROWSER_WEB_APPLICATIONS_EXTENSIONS_WEB_APP_EXTENSION_HELPERS_H_
...@@ -28,4 +28,10 @@ WebAppProvider::WebAppProvider(PrefService* pref_service) ...@@ -28,4 +28,10 @@ WebAppProvider::WebAppProvider(PrefService* pref_service)
WebAppProvider::~WebAppProvider() = default; WebAppProvider::~WebAppProvider() = default;
// static
void WebAppProvider::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
WebAppPolicyManager::RegisterProfilePrefs(registry);
}
} // namespace web_app } // namespace web_app
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
class Profile; class Profile;
namespace user_prefs {
class PrefRegistrySyncable;
}
namespace web_app { namespace web_app {
class PendingAppManager; class PendingAppManager;
...@@ -33,6 +37,8 @@ class WebAppProvider : public KeyedService { ...@@ -33,6 +37,8 @@ class WebAppProvider : public KeyedService {
~WebAppProvider() override; ~WebAppProvider() override;
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
private: private:
std::unique_ptr<PendingAppManager> pending_app_manager_; std::unique_ptr<PendingAppManager> pending_app_manager_;
std::unique_ptr<WebAppPolicyManager> web_app_policy_manager_; std::unique_ptr<WebAppPolicyManager> web_app_policy_manager_;
......
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