blob: a1511783e0a6fb546b7741bc2e08fde293c9476f [file] [log] [blame]
// Copyright 2021 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.
#ifndef ANDROID_WEBVIEW_NONEMBEDDED_COMPONENT_UPDATER_AW_COMPONENT_UPDATER_CONFIGURATOR_H_
#define ANDROID_WEBVIEW_NONEMBEDDED_COMPONENT_UPDATER_AW_COMPONENT_UPDATER_CONFIGURATOR_H_
#include "base/memory/scoped_refptr.h"
#include "base/version.h"
#include "components/component_updater/configurator_impl.h"
#include "components/prefs/pref_service.h"
#include "components/update_client/activity_data_service.h"
#include "components/update_client/configurator.h"
#include "components/update_client/crx_downloader_factory.h"
#include "components/update_client/network.h"
#include "components/update_client/patcher.h"
#include "components/update_client/protocol_handler.h"
#include "components/update_client/unzipper.h"
class PrefService;
namespace base {
class CommandLine;
}
namespace android_webview {
class AwComponentUpdaterConfigurator : public update_client::Configurator {
public:
explicit AwComponentUpdaterConfigurator(const base::CommandLine* cmdline,
PrefService* pref_service);
// update_client::Configurator overrides.
double InitialDelay() const override;
int NextCheckDelay() const override;
int OnDemandDelay() const override;
int UpdateDelay() const override;
std::vector<GURL> UpdateUrl() const override;
std::vector<GURL> PingUrl() const override;
std::string GetProdId() const override;
base::Version GetBrowserVersion() const override;
std::string GetChannel() const override;
std::string GetBrand() const override;
std::string GetLang() const override;
std::string GetOSLongName() const override;
base::flat_map<std::string, std::string> ExtraRequestParams() const override;
std::string GetDownloadPreference() const override;
scoped_refptr<update_client::NetworkFetcherFactory> GetNetworkFetcherFactory()
override;
scoped_refptr<update_client::CrxDownloaderFactory> GetCrxDownloaderFactory()
override;
scoped_refptr<update_client::UnzipperFactory> GetUnzipperFactory() override;
scoped_refptr<update_client::PatcherFactory> GetPatcherFactory() override;
bool EnabledDeltas() const override;
bool EnabledComponentUpdates() const override;
bool EnabledBackgroundDownloader() const override;
bool EnabledCupSigning() const override;
PrefService* GetPrefService() const override;
update_client::ActivityDataService* GetActivityDataService() const override;
bool IsPerUserInstall() const override;
std::unique_ptr<update_client::ProtocolHandlerFactory>
GetProtocolHandlerFactory() const override;
protected:
friend class base::RefCountedThreadSafe<AwComponentUpdaterConfigurator>;
~AwComponentUpdaterConfigurator() override;
private:
component_updater::ConfiguratorImpl configurator_impl_;
PrefService* pref_service_; // This member is not owned by this class.
scoped_refptr<update_client::NetworkFetcherFactory> network_fetcher_factory_;
scoped_refptr<update_client::CrxDownloaderFactory> crx_downloader_factory_;
scoped_refptr<update_client::UnzipperFactory> unzip_factory_;
scoped_refptr<update_client::PatcherFactory> patch_factory_;
};
scoped_refptr<update_client::Configurator> MakeAwComponentUpdaterConfigurator(
const base::CommandLine* cmdline,
PrefService* pref_service);
} // namespace android_webview
#endif // ANDROID_WEBVIEW_NONEMBEDDED_COMPONENT_UPDATER_AW_COMPONENT_UPDATER_CONFIGURATOR_H_