123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- #pragma once
- #include "CoreMinimal.h"
- #include "Containers/Ticker.h"
- #include "IWebInterfaceBrowserSingleton.h"
- #if WITH_CEF3
- #if PLATFORM_WINDOWS
- #include "Windows/WindowsHWrapper.h"
- #include "Windows/AllowWindowsPlatformTypes.h"
- #include "Windows/AllowWindowsPlatformAtomics.h"
- #endif
- #pragma push_macro("OVERRIDE")
- #undef OVERRIDE
- THIRD_PARTY_INCLUDES_START
- #if PLATFORM_APPLE
- PRAGMA_DISABLE_DEPRECATION_WARNINGS
- #endif
- #include "include/internal/cef_ptr.h"
- #include "include/cef_request_context.h"
- #if PLATFORM_APPLE
- PRAGMA_ENABLE_DEPRECATION_WARNINGS
- #endif
- THIRD_PARTY_INCLUDES_END
- #pragma pop_macro("OVERRIDE")
- #if PLATFORM_WINDOWS
- #include "Windows/HideWindowsPlatformAtomics.h"
- #include "Windows/HideWindowsPlatformTypes.h"
- #endif
- #include "CEF/CEFInterfaceSchemeHandler.h"
- #include "CEF/CEFInterfaceResourceContextHandler.h"
- class CefListValue;
- class FCEFInterfaceBrowserApp;
- class FCEFWebInterfaceBrowserWindow;
- #endif
- class IWebInterfaceBrowserCookieManager;
- class IWebInterfaceBrowserWindow;
- struct FWebInterfaceBrowserWindowInfo;
- struct FWebInterfaceBrowserInitSettings;
- class UMaterialInterface;
- PRAGMA_DISABLE_DEPRECATION_WARNINGS
- class FWebInterfaceBrowserSingleton
- : public IWebInterfaceBrowserSingleton
- , public FTSTickerObjectBase
- {
- public:
-
- FWebInterfaceBrowserSingleton(const FWebInterfaceBrowserInitSettings& WebBrowserInitSettings);
-
- virtual ~FWebInterfaceBrowserSingleton();
-
- static FString GetCurrentLocaleCode();
- virtual FString ApplicationCacheDir() const override;
- public:
-
- virtual TSharedRef<IWebInterfaceBrowserWindowFactory> GetWebBrowserWindowFactory() const override;
- TSharedPtr<IWebInterfaceBrowserWindow> CreateBrowserWindow(
- TSharedPtr<FCEFWebInterfaceBrowserWindow>& BrowserWindowParent,
- TSharedPtr<FWebInterfaceBrowserWindowInfo>& BrowserWindowInfo) override;
- TSharedPtr<IWebInterfaceBrowserWindow> CreateBrowserWindow(const FCreateInterfaceBrowserWindowSettings& Settings) override;
- #if BUILD_EMBEDDED_APP
- TSharedPtr<IWebInterfaceBrowserWindow> CreateNativeBrowserProxy() override;
- #endif
- virtual TSharedPtr<IWebInterfaceBrowserCookieManager> GetCookieManager() const override
- {
- return DefaultCookieManager;
- }
- virtual TSharedPtr<IWebInterfaceBrowserCookieManager> GetCookieManager(TOptional<FString> ContextId) const override;
- virtual bool RegisterContext(const FInterfaceBrowserContextSettings& Settings) override;
- virtual bool UnregisterContext(const FString& ContextId) override;
- virtual bool RegisterSchemeHandlerFactory(FString Scheme, FString Domain, IWebInterfaceBrowserSchemeHandlerFactory* WebBrowserSchemeHandlerFactory) override;
- virtual bool UnregisterSchemeHandlerFactory(IWebInterfaceBrowserSchemeHandlerFactory* WebBrowserSchemeHandlerFactory) override;
- virtual bool IsDevToolsShortcutEnabled() override
- {
- return bDevToolsShortcutEnabled;
- }
- virtual void SetDevToolsShortcutEnabled(bool Value) override
- {
- bDevToolsShortcutEnabled = Value;
- }
- virtual void SetJSBindingToLoweringEnabled(bool bEnabled) override
- {
- bJSBindingsToLoweringEnabled = bEnabled;
- }
- virtual void ClearOldCacheFolders(const FString& CachePathRoot, const FString& CachePrefix) override;
-
- virtual void SetDefaultMaterial(UMaterialInterface* InDefaultMaterial) override
- {
- DefaultMaterial = InDefaultMaterial;
- }
-
- virtual void SetDefaultTranslucentMaterial(UMaterialInterface* InDefaultMaterial) override
- {
- DefaultTranslucentMaterial = InDefaultMaterial;
- }
-
- virtual UMaterialInterface* GetDefaultMaterial() override
- {
- return DefaultMaterial;
- }
-
- virtual UMaterialInterface* GetDefaultTranslucentMaterial() override
- {
- return DefaultTranslucentMaterial;
- }
- public:
-
- virtual bool Tick(float DeltaTime) override;
- #if WITH_CEF3
-
- bool URLRequestAllowsCredentials(const FString& URL);
- #endif
- private:
- TSharedPtr<IWebInterfaceBrowserCookieManager> DefaultCookieManager;
- #if WITH_CEF3
-
- void HandleRenderProcessCreated(CefRefPtr<CefListValue> ExtraInfo);
-
- FString GenerateWebCacheFolderName(const FString &InputPath);
-
- void WaitForTaskQueueFlush();
-
- CefRefPtr<FCEFInterfaceBrowserApp> CEFBrowserApp;
- TMap<FString, CefRefPtr<CefRequestContext>> RequestContexts;
- TMap<FString, CefRefPtr<FCEFInterfaceResourceContextHandler>> RequestResourceHandlers;
- FCefInterfaceSchemeHandlerFactories SchemeHandlerFactories;
- bool bAllowCEF;
- bool bTaskFinished;
- #endif
-
- #if WITH_CEF3
- TArray<TWeakPtr<FCEFWebInterfaceBrowserWindow>> WindowInterfaces;
- #endif
-
- FCriticalSection WindowInterfacesCS;
- TSharedRef<IWebInterfaceBrowserWindowFactory> WebBrowserWindowFactory;
- bool bDevToolsShortcutEnabled;
- bool bJSBindingsToLoweringEnabled;
- bool bAppIsFocused;
- #if WITH_CEF3
-
- bool bCEFInitialized;
- #endif
-
- UMaterialInterface* DefaultMaterial;
-
- UMaterialInterface* DefaultTranslucentMaterial;
- };
- PRAGMA_ENABLE_DEPRECATION_WARNINGS
- #if WITH_CEF3
- class CefCookieManager;
- class FCefWebInterfaceCookieManagerFactory
- {
- public:
- static TSharedRef<IWebInterfaceBrowserCookieManager> Create(
- const CefRefPtr<CefCookieManager>& CookieManager);
- };
- #endif
|