aw_component_updater_configurator.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ANDROID_WEBVIEW_NONEMBEDDED_COMPONENT_UPDATER_AW_COMPONENT_UPDATER_CONFIGURATOR_H_
  5. #define ANDROID_WEBVIEW_NONEMBEDDED_COMPONENT_UPDATER_AW_COMPONENT_UPDATER_CONFIGURATOR_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "base/memory/scoped_refptr.h"
  8. #include "base/version.h"
  9. #include "components/component_updater/configurator_impl.h"
  10. #include "components/prefs/pref_service.h"
  11. #include "components/update_client/activity_data_service.h"
  12. #include "components/update_client/configurator.h"
  13. #include "components/update_client/crx_downloader_factory.h"
  14. #include "components/update_client/network.h"
  15. #include "components/update_client/patcher.h"
  16. #include "components/update_client/protocol_handler.h"
  17. #include "components/update_client/unzipper.h"
  18. #include "third_party/abseil-cpp/absl/types/optional.h"
  19. class PrefService;
  20. namespace base {
  21. class CommandLine;
  22. }
  23. namespace android_webview {
  24. class AwComponentUpdaterConfigurator : public update_client::Configurator {
  25. public:
  26. explicit AwComponentUpdaterConfigurator(const base::CommandLine* cmdline,
  27. PrefService* pref_service);
  28. // update_client::Configurator overrides.
  29. double InitialDelay() const override;
  30. int NextCheckDelay() const override;
  31. int OnDemandDelay() const override;
  32. int UpdateDelay() const override;
  33. std::vector<GURL> UpdateUrl() const override;
  34. std::vector<GURL> PingUrl() const override;
  35. std::string GetProdId() const override;
  36. base::Version GetBrowserVersion() const override;
  37. std::string GetChannel() const override;
  38. std::string GetLang() const override;
  39. std::string GetOSLongName() const override;
  40. base::flat_map<std::string, std::string> ExtraRequestParams() const override;
  41. std::string GetDownloadPreference() const override;
  42. scoped_refptr<update_client::NetworkFetcherFactory> GetNetworkFetcherFactory()
  43. override;
  44. scoped_refptr<update_client::CrxDownloaderFactory> GetCrxDownloaderFactory()
  45. override;
  46. scoped_refptr<update_client::UnzipperFactory> GetUnzipperFactory() override;
  47. scoped_refptr<update_client::PatcherFactory> GetPatcherFactory() override;
  48. bool EnabledDeltas() const override;
  49. bool EnabledBackgroundDownloader() const override;
  50. bool EnabledCupSigning() const override;
  51. PrefService* GetPrefService() const override;
  52. update_client::ActivityDataService* GetActivityDataService() const override;
  53. bool IsPerUserInstall() const override;
  54. std::unique_ptr<update_client::ProtocolHandlerFactory>
  55. GetProtocolHandlerFactory() const override;
  56. absl::optional<bool> IsMachineExternallyManaged() const override;
  57. update_client::UpdaterStateProvider GetUpdaterStateProvider() const override;
  58. protected:
  59. friend class base::RefCountedThreadSafe<AwComponentUpdaterConfigurator>;
  60. ~AwComponentUpdaterConfigurator() override;
  61. private:
  62. component_updater::ConfiguratorImpl configurator_impl_;
  63. raw_ptr<PrefService>
  64. pref_service_; // This member is not owned by this class.
  65. scoped_refptr<update_client::NetworkFetcherFactory> network_fetcher_factory_;
  66. scoped_refptr<update_client::CrxDownloaderFactory> crx_downloader_factory_;
  67. scoped_refptr<update_client::UnzipperFactory> unzip_factory_;
  68. scoped_refptr<update_client::PatcherFactory> patch_factory_;
  69. };
  70. scoped_refptr<update_client::Configurator> MakeAwComponentUpdaterConfigurator(
  71. const base::CommandLine* cmdline,
  72. PrefService* pref_service);
  73. } // namespace android_webview
  74. #endif // ANDROID_WEBVIEW_NONEMBEDDED_COMPONENT_UPDATER_AW_COMPONENT_UPDATER_CONFIGURATOR_H_