#ifndef WEBLAYER_BROWSER_BROWSER_CONTEXT_IMPL_H_
#define WEBLAYER_BROWSER_BROWSER_CONTEXT_IMPL_H_
#include "base/files/file_path.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "components/keyed_service/core/simple_factory_key.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "weblayer/browser/download_manager_delegate_impl.h"
#include "weblayer/public/profile.h"
namespace user_prefs {
class PrefRegistrySyncable;
}
class PrefService;
namespace weblayer {
class ProfileImpl;
class ResourceContextImpl;
namespace prefs {
extern const char kNoStatePrefetchEnabled[];
extern const char kUkmEnabled[];
}
class BrowserContextImpl : public content::BrowserContext {
public:
BrowserContextImpl(ProfileImpl* profile_impl, const base::FilePath& path);
~BrowserContextImpl() override;
BrowserContextImpl(const BrowserContextImpl&) = delete;
BrowserContextImpl& operator=(const BrowserContextImpl&) = delete;
static base::FilePath GetDefaultDownloadDirectory();
std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
const base::FilePath&) override;
base::FilePath GetPath() override;
bool IsOffTheRecord() override;
variations::VariationsClient* GetVariationsClient() override;
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
content::ResourceContext* GetResourceContext() override;
content::BrowserPluginGuestManager* GetGuestManager() override;
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
content::PlatformNotificationService* GetPlatformNotificationService()
override;
content::PushMessagingService* GetPushMessagingService() override;
content::StorageNotificationService* GetStorageNotificationService() override;
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionControllerDelegate* GetPermissionControllerDelegate()
override;
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
override;
content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override;
content::BackgroundSyncController* GetBackgroundSyncController() override;
content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate()
override;
std::unique_ptr<download::InProgressDownloadManager>
RetrieveInProgressDownloadManager() override;
content::ContentIndexProvider* GetContentIndexProvider() override;
content::ReduceAcceptLanguageControllerDelegate*
GetReduceAcceptLanguageControllerDelegate() override;
content::OriginTrialsControllerDelegate* GetOriginTrialsControllerDelegate()
override;
ProfileImpl* profile_impl() const { return profile_impl_; }
PrefService* pref_service() const { return user_pref_service_.get(); }
SimpleFactoryKey* simple_factory_key() { return &simple_factory_key_; }
private:
class WebLayerVariationsClient;
void CreateUserPrefService();
void RegisterPrefs(user_prefs::PrefRegistrySyncable* pref_registry);
const raw_ptr<ProfileImpl> profile_impl_;
base::FilePath path_;
SimpleFactoryKey simple_factory_key_;
std::unique_ptr<ResourceContextImpl, content::BrowserThread::DeleteOnIOThread>
resource_context_;
DownloadManagerDelegateImpl download_delegate_;
std::unique_ptr<PrefService> user_pref_service_;
std::unique_ptr<WebLayerVariationsClient> weblayer_variations_client_;
};
}
#endif