-
-
Notifications
You must be signed in to change notification settings - Fork 566
Expand file tree
/
Copy pathCWebCoreInterface.h
More file actions
94 lines (76 loc) · 3.44 KB
/
Copy pathCWebCoreInterface.h
File metadata and controls
94 lines (76 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* (Shared logic for modifications)
* LICENSE: See LICENSE in the top level directory
* FILE: sdk/core/CWebBrowserInterface.h
* PURPOSE: Webbrowser interface class
*
*****************************************************************************/
#pragma once
#include <unordered_set>
class CWebBrowserItem;
class CWebViewInterface;
class CWebView;
enum class eURLState
{
WEBPAGE_NOT_LISTED,
WEBPAGE_ALLOWED,
WEBPAGE_DISALLOWED
};
enum class eWebFilterType
{
WEBFILTER_HARDCODED,
WEBFILTER_DYNAMIC,
WEBFILTER_USER,
WEBFILTER_REQUEST
};
enum class eWebFilterState
{
WEBFILTER_ALL,
WEBFILTER_ALLOWED,
WEBFILTER_DISALLOWED
};
enum eWebBrowserMouseButton
{
BROWSER_MOUSEBUTTON_LEFT = 0,
BROWSER_MOUSEBUTTON_MIDDLE = 1,
BROWSER_MOUSEBUTTON_RIGHT = 2
};
using WebRequestCallback = std::function<void(bool, const std::unordered_set<SString>&)>;
class CWebCoreInterface
{
public:
virtual ~CWebCoreInterface() {}
virtual bool Initialise(bool gpuEnabled) = 0;
virtual bool IsInitialised() const noexcept = 0;
virtual CWebViewInterface* CreateWebView(unsigned int uiWidth, unsigned int uiHeight, bool bIsLocal, CWebBrowserItem* pWebBrowserRenderItem,
bool bTransparent) = 0;
virtual void DestroyWebView(CWebViewInterface* pWebView) = 0;
virtual void DoPulse() = 0;
virtual void AddEventToEventQueue(std::function<void()> func, CWebView* pWebView, const SString& name) = 0;
virtual void RemoveWebViewEvents(CWebView* pWebView) = 0;
virtual void DoEventQueuePulse() = 0;
virtual void WaitForTask(std::function<void(bool)> task, CWebView* webView) = 0;
virtual eURLState GetDomainState(const SString& strURL, bool bOutputDebug = false) = 0;
virtual SString GetDomainFromURL(const SString& strURL) = 0;
virtual void ResetFilter(bool bResetRequestsOnly = true) = 0;
virtual void RequestPages(const std::vector<SString>& pages, WebRequestCallback* pCallback = nullptr) = 0;
virtual std::unordered_set<SString> AllowPendingPages(bool bRemember) = 0;
virtual std::unordered_set<SString> DenyPendingPages() = 0;
virtual std::unordered_set<SString>& GetPendingRequests() = 0;
virtual bool IsRequestsGUIVisible() = 0;
virtual bool IsTestModeEnabled() = 0;
virtual void SetTestModeEnabled(bool bEnabled) = 0;
virtual CWebViewInterface* GetFocusedWebView() = 0;
virtual void SetFocusedWebView(CWebView* pWebView) = 0;
virtual void ProcessInputMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) = 0;
virtual bool GetRemotePagesEnabled() = 0;
virtual bool GetRemoteJavascriptEnabled() = 0;
virtual void OnFPSLimitChange(std::uint16_t fps) = 0;
virtual bool SetGlobalAudioVolume(float fVolume) = 0;
virtual void WriteCustomList(const SString& strListName, const std::vector<SString>& customList, bool bReset = true) = 0;
virtual void GetFilterEntriesByType(std::vector<std::pair<SString, bool>>& outEntries, eWebFilterType filterType,
eWebFilterState state = eWebFilterState::WEBFILTER_ALL) = 0;
virtual bool GetGPUEnabled() const noexcept = 0;
};