WebView.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright aXiuShen. All Rights Reserved.
  2. #include "WebView.h"
  3. #include "Modules/ModuleManager.h"
  4. #include "Interfaces/IPluginManager.h"
  5. #include "Materials/Material.h"
  6. #ifdef WEBVIEW_CUSTOMIZED_CORE
  7. #include "WebModule.h"
  8. #include "cef3lib.h"
  9. #include "cefcorelib.h"
  10. #if WITH_EDITOR
  11. #include "Editor.h"
  12. #endif
  13. #endif
  14. #define LOCTEXT_NAMESPACE "FWebViewModule"
  15. class FWebViewModule : public IWebViewModule
  16. {
  17. public:
  18. virtual void StartupModule() override;
  19. virtual void ShutdownModule() override;
  20. private:
  21. };
  22. void FWebViewModule::ShutdownModule()
  23. {
  24. // This function may be called during shutdown to clean up your module.
  25. // For modules that support dynamic reloading,
  26. // we call this function before unloading the module.
  27. #ifndef USING_WEBBROWSER
  28. webview::IBrowserInstance::Get().UnLoad();
  29. #endif
  30. }
  31. void FWebViewModule::StartupModule()
  32. {
  33. #ifndef USING_WEBBROWSER
  34. ICEF3LIB::get()->LoadCEF3Modules();
  35. #if WITH_EDITOR
  36. ICefCoreLIB::get()->Load();
  37. #endif
  38. webview::IBrowserInstance::Get().check_brand(ICEF3LIB::get()->Branch());
  39. webview::IBrowserInstance::Get().Load();
  40. #if WITH_EDITOR
  41. FEditorDelegates::PausePIE.AddLambda([](bool) {webview::IBrowserInstance::Get().OnEndPIE(); });
  42. FEditorDelegates::BeginPIE.AddLambda([](bool) {webview::IBrowserInstance::Get().OnBeginPIE(); });
  43. FEditorDelegates::EndPIE.AddLambda([](bool) {webview::IBrowserInstance::Get().OnEndPIE(); });
  44. FEditorDelegates::ResumePIE.AddLambda([](bool) {webview::IBrowserInstance::Get().OnBeginPIE(); });
  45. #endif
  46. #endif
  47. }
  48. #undef LOCTEXT_NAMESPACE
  49. IMPLEMENT_MODULE(FWebViewModule, WebView)