chromium/components/component_updater/component_updater_service.h

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

#ifndef COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_
#define COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_

#include <stdint.h>

#include <map>
#include <memory>
#include <string>
#include <vector>

#include "base/functional/callback_forward.h"
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/version.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/update_client/update_client.h"
#include "url/gurl.h"

class ComponentsHandler;
class PluginObserver;

namespace ash {
class SmartDimComponentIntegrationTest;
}

namespace policy {
class ComponentUpdaterPolicyTest;
}

namespace screen_ai {
class ScreenAIDownloaderNonChromeOS;
}

namespace speech {
class SodaInstallerImpl;
}

namespace update_client {
class Configurator;
struct CrxComponent;
struct CrxUpdateItem;
}  // namespace update_client

namespace extensions {
class AutotestPrivateLoadSmartDimComponentFunction;
}

namespace component_updater {

// Called when a non-blocking call in this module completes.
Callback;

class OnDemandUpdater;
class UpdateScheduler;

Configurator;
CrxComponent;
CrxUpdateItem;

struct ComponentInfo {};

struct ComponentRegistration {};

// The component update service is in charge of installing or upgrading select
// parts of chrome. Each part is called a component and managed by instances of
// ComponentRegistration registered using RegisterComponent(). On the
// server, each component is packaged as a CRX which is the same format used to
// package extensions. To the update service each component is identified by
// its public key hash (CrxComponent::pk_hash). If there is an update available
// and its version is bigger than (CrxComponent::version), it will be
// downloaded, verified and unpacked. Then component-specific installer
// ComponentInstaller::Install (of CrxComponent::installer) will be called.
//
// During the normal operation of the component updater some specific
// notifications are fired, like COMPONENT_UPDATER_STARTED and
// COMPONENT_UPDATE_FOUND. See notification_type.h for more details.
//
// All methods are safe to call ONLY from the browser's main sequence.
class ComponentUpdateService {};

ServiceObserver;

class OnDemandUpdater {};

// Creates the component updater.
std::unique_ptr<ComponentUpdateService> ComponentUpdateServiceFactory(
    scoped_refptr<Configurator> config,
    std::unique_ptr<UpdateScheduler> scheduler,
    const std::string& brand);

// Register prefs required by the component update service.
void RegisterComponentUpdateServicePrefs(PrefRegistrySimple* registry);

}  // namespace component_updater

#endif  // COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_