blob: cd455a8ae678cfa6eb0a1c9fb8a1c1acf266db43 [file] [log] [blame]
Sorin Jianucfe1ea02020-07-27 20:47:281// Copyright 2020 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
5#ifndef COMPONENTS_UPDATE_CLIENT_CRX_DOWNLOADER_FACTORY_H_
6#define COMPONENTS_UPDATE_CLIENT_CRX_DOWNLOADER_FACTORY_H_
7
8#include "base/memory/ref_counted.h"
9
10namespace update_client {
11
12class CrxDownloader;
13class NetworkFetcherFactory;
14
15// Creates instances of |CrxDownloader|. Callers of update client can implement
16// a factory that provides a different download stack for CRXs. Currently,
17// the factory is injected using a |Configurator| function.
18class CrxDownloaderFactory
19 : public base::RefCountedThreadSafe<CrxDownloaderFactory> {
20 public:
21 CrxDownloaderFactory(const CrxDownloaderFactory&) = delete;
22 CrxDownloaderFactory& operator=(const CrxDownloaderFactory&) = delete;
23
24 virtual scoped_refptr<CrxDownloader> MakeCrxDownloader(
25 bool background_download_enabled) const = 0;
26
27 protected:
28 friend class base::RefCountedThreadSafe<CrxDownloaderFactory>;
29
30 CrxDownloaderFactory() = default;
31 virtual ~CrxDownloaderFactory() = default;
32};
33
34scoped_refptr<CrxDownloaderFactory> MakeCrxDownloaderFactory(
35 scoped_refptr<NetworkFetcherFactory> network_fetcher_factory);
36
37} // namespace update_client
38
39#endif // COMPONENTS_UPDATE_CLIENT_CRX_DOWNLOADER_FACTORY_H_