chromium/chrome/browser/web_applications/web_app_provider.h

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROVIDER_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROVIDER_H_

#include <memory>

#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/one_shot_event.h"
#include "base/types/pass_key.h"
#include "build/build_config.h"
#include "components/keyed_service/core/keyed_service.h"

class Profile;

namespace content {
class WebContents;
}

namespace web_app {

class AbstractWebAppDatabaseFactory;
class ExtensionsManager;
class ExternallyManagedAppManager;
class FakeWebAppProvider;
class FileUtilsWrapper;
class GeneratedIconFixManager;
class IsolatedWebAppInstallationManager;
class IsolatedWebAppUpdateManager;
class ManifestUpdateManager;
class OsIntegrationManager;
class PreinstalledWebAppManager;
class WebAppAudioFocusIdMap;
class WebAppCommandManager;
class WebAppCommandScheduler;
class WebAppIconManager;
class WebAppInstallFinalizer;
class WebAppInstallManager;
class WebAppOriginAssociationManager;
class WebAppPolicyManager;
class WebAppRegistrar;
class WebAppRegistrarMutable;
class WebAppSyncBridge;
class WebAppTranslationManager;
class WebAppUiManager;
class WebContentsManager;

#if BUILDFLAG(IS_CHROMEOS)
class IsolatedWebAppPolicyManager;
class WebAppRunOnOsLoginManager;
#endif

// WebAppProvider is the heart of Chrome web app code.
//
// Connects Web App features, such as the installation of default and
// policy-managed web apps, with Profiles (as WebAppProvider is a
// Profile-linked KeyedService) and their associated PrefService.
//
// Lifecycle notes:
// - WebAppProvider and its sub-managers are not ready for use until the
//   on_registry_ready() event has fired. Its database must be loaded from
//   disk before it can be interacted with.
//   Example of waiting for on_registry_ready():
//   WebAppProvider* provider = WebAppProvider::GetForWebApps(profile);
//   provider->on_registry_ready().Post(
//       FROM_HERE,
//       base::BindOnce([](WebAppProvider& provider) {
//         ...
//       }, std::ref(*provider));
// - All subsystems are constructed independently of each other in the
//   WebAppProvider constructor.
// - Subsystem construction should have no side effects and start no tasks.
// - Tests can replace any of the subsystems before Start() is called.
// - Similarly, in destruction, subsystems should not refer to each other.
class WebAppProvider : public KeyedService {};

}  // namespace web_app

#endif  // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROVIDER_H_