#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CORE_SERVICE_H_
#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CORE_SERVICE_H_
#include <memory>
#include "chrome/browser/download/download_history.h"
#include "components/keyed_service/core/keyed_service.h"
#include "extensions/buildflags/buildflags.h"
class ChromeDownloadManagerDelegate;
class DownloadUIController;
namespace content {
class DownloadManager;
}
namespace extensions {
class ExtensionDownloadsEventRouter;
}
class DownloadCoreService : public KeyedService {
public:
enum class CancelDownloadsTrigger {
kShutdown = 0,
kProfileDeletion = 1,
};
DownloadCoreService();
DownloadCoreService(const DownloadCoreService&) = delete;
DownloadCoreService& operator=(const DownloadCoreService&) = delete;
~DownloadCoreService() override;
virtual ChromeDownloadManagerDelegate* GetDownloadManagerDelegate() = 0;
virtual DownloadUIController* GetDownloadUIController() = 0;
virtual DownloadHistory* GetDownloadHistory() = 0;
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
virtual extensions::ExtensionDownloadsEventRouter*
GetExtensionEventRouter() = 0;
#endif
virtual bool HasCreatedDownloadManager() = 0;
virtual int BlockingShutdownCount() const = 0;
virtual void CancelDownloads(CancelDownloadsTrigger trigger) = 0;
static int BlockingShutdownCountAllProfiles();
static void CancelAllDownloads(CancelDownloadsTrigger trigger);
virtual void SetDownloadManagerDelegateForTesting(
std::unique_ptr<ChromeDownloadManagerDelegate> delegate) = 0;
virtual void SetDownloadHistoryForTesting(
std::unique_ptr<DownloadHistory> download_history) {}
virtual bool IsDownloadUiEnabled() = 0;
#if BUILDFLAG(ENABLE_EXTENSIONS_CORE)
virtual void SetDownloadUiEnabledForTest(bool enabled) {}
#endif
};
#endif