Commit ecee2944 authored by Alexey Baskakov's avatar Alexey Baskakov Committed by Commit Bot

dpwa: Move WebAppProvider to web_applications:web_applications GN source set.

This CL introduces no behavior changes.

WebAppProvider class must not depend on extensions,
only forward declarations are visible.

All extensions-specific code and includes have been isolated in
chrome/browser/web_applications/extensions/bookmark_app_provider.cc
file.

In long term, the whole chrome/browser/web_applications/extensions/
code directory must be deleted (see README.md in that folder)

This is a preparation CL to delete web_applications_on_extensions
GN source set.

TBR=ccameron@chromium.org

Bug: 1065748
Change-Id: I7fa1306694e80dbda8aab7159a075919ec2c42b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2517233Reviewed-by: default avatarAlexey Baskakov <loyso@chromium.org>
Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Commit-Queue: Alexey Baskakov <loyso@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824327}
parent c96f23c3
......@@ -24,7 +24,7 @@ source_set("app_shim") {
deps = [
"//apps",
"//chrome/browser/web_applications:web_applications_on_extensions",
"//chrome/browser/web_applications:web_applications",
"//chrome/browser/web_applications/components",
"//chrome/common",
"//chrome/common:app_mode_app_support",
......
......@@ -52,8 +52,14 @@ source_set("web_applications") {
"web_app_install_task.h",
"web_app_installation_utils.cc",
"web_app_installation_utils.h",
"web_app_migration_manager.h",
"web_app_migration_user_display_mode_clean_up.h",
"web_app_proto_utils.cc",
"web_app_proto_utils.h",
"web_app_provider.cc",
"web_app_provider.h",
"web_app_provider_factory.cc",
"web_app_provider_factory.h",
"web_app_registrar.cc",
"web_app_registrar.h",
"web_app_registry_update.cc",
......@@ -72,12 +78,12 @@ source_set("web_applications") {
"//chrome/browser/web_applications/components",
"//chrome/common",
"//components/content_settings/core/browser",
"//components/keyed_service/content",
"//components/performance_manager",
"//components/pref_registry",
"//components/services/app_service/public/cpp:protocol_handling",
"//components/sync",
"//content/public/browser",
"//extensions/browser",
"//services/metrics/public/cpp:ukm_builders",
"//skia",
]
......@@ -273,18 +279,12 @@ source_set("web_applications_browser_tests") {
}
}
# TODO(crbug.com/877898): Erase this and move WebAppProvider into
# web_applications set.
# TODO(crbug.com/877898): Erase this and move all migration code to
# //chrome/browser/web_applications/extensions:extensions GN source set.
source_set("web_applications_on_extensions") {
sources = [
"web_app_migration_manager.cc",
"web_app_migration_manager.h",
"web_app_migration_user_display_mode_clean_up.cc",
"web_app_migration_user_display_mode_clean_up.h",
"web_app_provider.cc",
"web_app_provider.h",
"web_app_provider_factory.cc",
"web_app_provider_factory.h",
]
deps = [
......
......@@ -16,6 +16,7 @@ source_set("extensions") {
"bookmark_app_icon_manager.h",
"bookmark_app_install_finalizer.cc",
"bookmark_app_install_finalizer.h",
"bookmark_app_provider.cc",
"bookmark_app_registrar.cc",
"bookmark_app_registrar.h",
"bookmark_app_registry_controller.cc",
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <utility>
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_file_handler_manager.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_icon_manager.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_registrar.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_registry_controller.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_shortcut_manager.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_provider_factory.h"
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
namespace web_app {
void WebAppProvider::CreateBookmarkAppsSubsystems(Profile* profile) {
std::unique_ptr<extensions::BookmarkAppRegistrar> registrar =
std::make_unique<extensions::BookmarkAppRegistrar>(profile);
std::unique_ptr<extensions::BookmarkAppRegistryController>
registry_controller =
std::make_unique<extensions::BookmarkAppRegistryController>(
profile, registrar.get());
icon_manager_ = std::make_unique<extensions::BookmarkAppIconManager>(profile);
install_finalizer_ =
std::make_unique<extensions::BookmarkAppInstallFinalizer>(profile);
auto file_handler_manager =
std::make_unique<extensions::BookmarkAppFileHandlerManager>(profile);
auto shortcut_manager =
std::make_unique<extensions::BookmarkAppShortcutManager>(profile);
os_integration_manager_ = std::make_unique<OsIntegrationManager>(
profile, std::move(shortcut_manager), std::move(file_handler_manager));
// Upcast to unified subsystem types:
registrar_ = std::move(registrar);
registry_controller_ = std::move(registry_controller);
}
std::unique_ptr<InstallFinalizer>
WebAppProvider::CreateBookmarkAppInstallFinalizer(Profile* profile) {
return std::make_unique<extensions::BookmarkAppInstallFinalizer>(profile);
}
void WebAppProviderFactory::DependsOnExtensionsSystem() {
DependsOn(
extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
}
} // namespace web_app
......@@ -39,11 +39,9 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "url/gurl.h"
#if defined(OS_CHROMEOS)
......
......@@ -18,12 +18,6 @@
#include "chrome/browser/web_applications/components/web_app_ui_manager.h"
#include "chrome/browser/web_applications/components/web_app_utils.h"
#include "chrome/browser/web_applications/daily_metrics_helper.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_file_handler_manager.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_icon_manager.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_registrar.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_registry_controller.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_shortcut_manager.h"
#include "chrome/browser/web_applications/external_web_app_manager.h"
#include "chrome/browser/web_applications/file_utils_wrapper.h"
#include "chrome/browser/web_applications/manifest_update_manager.h"
......@@ -201,8 +195,7 @@ void WebAppProvider::CreateWebAppsSubsystems(Profile* profile) {
registrar = std::move(mutable_registrar);
}
auto legacy_finalizer =
std::make_unique<extensions::BookmarkAppInstallFinalizer>(profile);
auto legacy_finalizer = CreateBookmarkAppInstallFinalizer(profile);
legacy_finalizer->SetSubsystems(/*registrar=*/nullptr,
/*ui_manager=*/nullptr,
/*registry_controller=*/nullptr,
......@@ -233,29 +226,6 @@ void WebAppProvider::CreateWebAppsSubsystems(Profile* profile) {
icon_manager_ = std::move(icon_manager);
}
void WebAppProvider::CreateBookmarkAppsSubsystems(Profile* profile) {
std::unique_ptr<extensions::BookmarkAppRegistrar> registrar =
std::make_unique<extensions::BookmarkAppRegistrar>(profile);
std::unique_ptr<extensions::BookmarkAppRegistryController>
registry_controller =
std::make_unique<extensions::BookmarkAppRegistryController>(
profile, registrar.get());
icon_manager_ = std::make_unique<extensions::BookmarkAppIconManager>(profile);
install_finalizer_ =
std::make_unique<extensions::BookmarkAppInstallFinalizer>(profile);
auto file_handler_manager =
std::make_unique<extensions::BookmarkAppFileHandlerManager>(profile);
auto shortcut_manager =
std::make_unique<extensions::BookmarkAppShortcutManager>(profile);
os_integration_manager_ = std::make_unique<OsIntegrationManager>(
profile, std::move(shortcut_manager), std::move(file_handler_manager));
// Upcast to unified subsystem types:
registrar_ = std::move(registrar);
registry_controller_ = std::move(registry_controller);
}
void WebAppProvider::ConnectSubsystems() {
DCHECK(!started_);
......
......@@ -104,8 +104,11 @@ class WebAppProvider : public WebAppProviderBase {
void CreateCommonSubsystems(Profile* profile);
// Create extension-independent subsystems.
void CreateWebAppsSubsystems(Profile* profile);
// ... or create legacy extension-based subsystems.
// Create legacy extension-based subsystems.
void CreateBookmarkAppsSubsystems(Profile* profile);
std::unique_ptr<InstallFinalizer> CreateBookmarkAppInstallFinalizer(
Profile* profile);
// Wire together subsystems but do not start them (yet).
void ConnectSubsystems();
......
......@@ -10,8 +10,6 @@
#include "chrome/browser/web_applications/components/web_app_utils.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
namespace web_app {
......@@ -32,8 +30,7 @@ WebAppProviderFactory::WebAppProviderFactory()
"WebAppProvider",
BrowserContextDependencyManager::GetInstance()) {
WebAppProviderBaseFactory::SetInstance(this);
DependsOn(
extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
DependsOnExtensionsSystem();
DependsOn(ModelTypeStoreServiceFactory::GetInstance());
DependsOn(ukm::UkmBackgroundRecorderFactory::GetInstance());
}
......
......@@ -35,13 +35,14 @@ class WebAppProviderFactory : public WebAppProviderBaseFactory {
WebAppProviderFactory();
~WebAppProviderFactory() override;
void DependsOnExtensionsSystem();
// BrowserContextKeyedServiceFactory
KeyedService* BuildServiceInstanceFor(
content::BrowserContext* context) const override;
bool ServiceIsCreatedWithBrowserContext() const override;
content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const override;
};
} // namespace web_app
......
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