#ifndef ANDROID_WEBVIEW_LIB_AW_MAIN_DELEGATE_H_
#define ANDROID_WEBVIEW_LIB_AW_MAIN_DELEGATE_H_
#include <memory>
#include <variant>
#include "android_webview/browser/aw_feature_list_creator.h"
#include "android_webview/common/aw_content_client.h"
#include "android_webview/common/gfx/aw_gr_context_options_provider.h"
#include "components/memory_system/memory_system.h"
#include "content/public/app/content_main_delegate.h"
namespace content {
class BrowserMainRunner;
}
namespace android_webview {
class AwContentBrowserClient;
class AwContentGpuClient;
class AwContentRendererClient;
class AwMainDelegate : public content::ContentMainDelegate {
public:
AwMainDelegate();
AwMainDelegate(const AwMainDelegate&) = delete;
AwMainDelegate& operator=(const AwMainDelegate&) = delete;
~AwMainDelegate() override;
private:
std::optional<int> BasicStartupComplete() override;
void PreSandboxStartup() override;
std::variant<int, content::MainFunctionParams> RunProcess(
const std::string& process_type,
content::MainFunctionParams main_function_params) override;
void ProcessExiting(const std::string& process_type) override;
bool ShouldCreateFeatureList(InvokedIn invoked_in) override;
bool ShouldInitializeMojo(InvokedIn invoked_in) override;
variations::VariationsIdsProvider* CreateVariationsIdsProvider() override;
std::optional<int> PostEarlyInitialization(InvokedIn invoked_in) override;
content::ContentClient* CreateContentClient() override;
content::ContentBrowserClient* CreateContentBrowserClient() override;
content::ContentGpuClient* CreateContentGpuClient() override;
content::ContentRendererClient* CreateContentRendererClient() override;
bool ShouldInitializePerfetto(InvokedIn invoked_in) override;
void InitializeMemorySystem(const bool is_browser_process);
std::unique_ptr<AwFeatureListCreator> aw_feature_list_creator_;
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
AwContentClient content_client_;
std::unique_ptr<AwContentBrowserClient> content_browser_client_;
std::unique_ptr<AwContentGpuClient> content_gpu_client_;
std::unique_ptr<AwContentRendererClient> content_renderer_client_;
AwGrContextOptionsProvider aw_gr_context_options_provider_;
memory_system::MemorySystem memory_system_;
};
}
#endif