Skip to content

Commit d659a53

Browse files
committed
Revert "Fix compile errors due to CEF API changes"
This reverts commit 8089a0c.
1 parent 6605de4 commit d659a53

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

MTA10/core/CWebView.cpp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "CAjaxResourceHandler.h"
1313
#include <cef3/include/cef_parser.h>
1414
#include <cef3/include/cef_task.h>
15+
#include <cef3/include/cef_runnable.h>
1516
#include "CWebDevTools.h"
1617

1718
CWebView::CWebView ( unsigned int uiWidth, unsigned int uiHeight, bool bIsLocal, CWebBrowserItem* pWebBrowserRenderItem, bool bTransparent )
@@ -66,7 +67,7 @@ void CWebView::Initialise ()
6667

6768
CefWindowInfo windowInfo;
6869
windowInfo.SetAsWindowless ( g_pCore->GetHookedWindow (), m_bIsTransparent );
69-
70+
7071
CefBrowserHost::CreateBrowser ( windowInfo, this, "", browserSettings, nullptr );
7172
}
7273

@@ -124,7 +125,7 @@ bool CWebView::LoadURL ( const SString& strURL, bool bFilterEnabled, const SStri
124125
request->SetPostData ( postData );
125126
pFrame->LoadRequest ( request );
126127
}
127-
128+
128129
return true;
129130
}
130131

@@ -195,7 +196,7 @@ bool CWebView::SetProperty ( const SString& strKey, const SString& strValue )
195196
{
196197
if ( strKey == "mobile" && ( strValue == "0" || strValue == "1" ) )
197198
{
198-
199+
199200
}
200201
else
201202
return false;
@@ -218,7 +219,7 @@ void CWebView::InjectMouseMove ( int iPosX, int iPosY )
218219
{
219220
if ( !m_pWebView )
220221
return;
221-
222+
222223
CefMouseEvent mouseEvent;
223224
mouseEvent.x = iPosX;
224225
mouseEvent.y = iPosY;
@@ -241,7 +242,7 @@ void CWebView::InjectMouseDown ( eWebBrowserMouseButton mouseButton )
241242
{
242243
if ( !m_pWebView )
243244
return;
244-
245+
245246
CefMouseEvent mouseEvent;
246247
mouseEvent.x = m_vecMousePosition.x;
247248
mouseEvent.y = m_vecMousePosition.y;
@@ -548,7 +549,7 @@ void CWebView::OnPaint ( CefRefPtr<CefBrowser> browser, CefRenderHandler::PaintE
548549
auto sourceData = (const int*)buffer;
549550
auto pitch = LockedRect.Pitch;
550551
551-
for (auto& rect : dirtyRects)
552+
for (auto& rect : dirtyRects)
552553
{
553554
for (int y = rect.y; y < rect.y+rect.height; ++y)
554555
{
@@ -654,7 +655,7 @@ void CWebView::OnLoadEnd ( CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> fr
654655
void CWebView::OnLoadError ( CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefLoadHandler::ErrorCode errorCode, const CefString& errorText, const CefString& failedURL )
655656
{
656657
SString strURL = UTF16ToMbUTF8 ( frame->GetURL () );
657-
658+
658659
// Queue event to run on the main thread
659660
auto func = std::bind ( &CWebBrowserEventsInterface::Events_OnLoadingFailed, m_pEventsInterface, strURL, errorCode, SString ( errorText ) );
660661
g_pCore->GetWebCore ()->AddEventToEventQueue ( func, this, "OnLoadError" );
@@ -672,13 +673,13 @@ bool CWebView::OnBeforeBrowse ( CefRefPtr<CefBrowser> browser, CefRefPtr<CefFram
672673
From documentation:
673674
The |request| object cannot be modified in this callback.
674675
CefLoadHandler::OnLoadingStateChange will be called twice in all cases. If the navigation is allowed CefLoadHandler::OnLoadStart and CefLoadHandler::OnLoadEnd will be called.
675-
If the navigation is canceled CefLoadHandler::OnLoadError will be called with an |errorCode| value of ERR_ABORTED.
676+
If the navigation is canceled CefLoadHandler::OnLoadError will be called with an |errorCode| value of ERR_ABORTED.
676677
*/
677678

678679
CefURLParts urlParts;
679680
if ( !CefParseURL ( request->GetURL(), urlParts ) )
680681
return true; // Cancel if invalid URL (this line will normally not be executed)
681-
682+
682683
bool bResult;
683684
WString scheme = urlParts.scheme.str;
684685
if ( scheme == L"http" || scheme == L"https" )
@@ -796,7 +797,7 @@ void CWebView::OnBeforeClose ( CefRefPtr<CefBrowser> browser )
796797
NotifyPaint ();
797798

798799
m_pWebView = nullptr;
799-
800+
800801
// Remove focused web view reference
801802
if ( g_pCore->GetWebCore ()->GetFocusedWebView () == this )
802803
g_pCore->GetWebCore ()->SetFocusedWebView ( nullptr );
@@ -811,11 +812,11 @@ void CWebView::OnBeforeClose ( CefRefPtr<CefBrowser> browser )
811812
bool CWebView::OnBeforePopup ( CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, const CefString& target_url, const CefString& target_frame_name, CefLifeSpanHandler::WindowOpenDisposition target_disposition, bool user_gesture, const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, CefRefPtr<CefClient>& client, CefBrowserSettings& settings, bool* no_javascript_access )
812813
{
813814
// ATTENTION: This method is called on the IO thread
814-
815+
815816
// Trigger the popup/new tab event
816817
SString strTagetURL = UTF16ToMbUTF8 ( target_url );
817818
SString strOpenerURL = UTF16ToMbUTF8 ( frame->GetURL () );
818-
819+
819820
// Queue event to run on the main thread
820821
auto func = std::bind ( &CWebBrowserEventsInterface::Events_OnPopup, m_pEventsInterface, strTagetURL, strOpenerURL );
821822
g_pCore->GetWebCore ()->AddEventToEventQueue ( func, this, "OnBeforePopup" );
@@ -847,7 +848,7 @@ void CWebView::OnAfterCreated ( CefRefPtr<CefBrowser> browser )
847848
// http://magpcss.org/ceforum/apidocs3/projects/(default)/CefJSDialogHandler.html#OnJSDialog(CefRefPtr%3CCefBrowser%3E,constCefString&,constCefString&,JSDialogType,constCefString&,constCefString&,CefRefPtr%3CCefJSDialogCallback%3E,bool&) //
848849
// //
849850
////////////////////////////////////////////////////////////////////
850-
bool CWebView::OnJSDialog ( CefRefPtr<CefBrowser> browser, const CefString& origin_url, CefJSDialogHandler::JSDialogType dialog_type, const CefString& message_text, const CefString& default_prompt_text, CefRefPtr<CefJSDialogCallback> callback, bool& suppress_message )
851+
bool CWebView::OnJSDialog ( CefRefPtr<CefBrowser> browser, const CefString& origin_url, const CefString& accept_lang, CefJSDialogHandler::JSDialogType dialog_type, const CefString& message_text, const CefString& default_prompt_text, CefRefPtr< CefJSDialogCallback > callback, bool& suppress_message )
851852
{
852853
// TODO: Provide a way to influence Javascript dialogs via Lua
853854
// e.g. addEventHandler("onClientBrowserDialog", browser, function(message, defaultText) continueBrowserDialog("My input") end)
@@ -891,7 +892,7 @@ bool CWebView::OnTooltip ( CefRefPtr<CefBrowser> browser, CefString& title )
891892
// Queue event to run on the main thread
892893
auto func = std::bind ( &CWebBrowserEventsInterface::Events_OnTooltip, m_pEventsInterface, UTF16ToMbUTF8 ( title ) );
893894
g_pCore->GetWebCore ()->AddEventToEventQueue ( func, this, "OnTooltip" );
894-
895+
895896
return true;
896897
}
897898

@@ -906,10 +907,10 @@ bool CWebView::OnConsoleMessage ( CefRefPtr<CefBrowser> browser, const CefString
906907
// Redirect console message to debug window (if development mode is enabled)
907908
if ( g_pCore->GetWebCore ()->IsTestModeEnabled () )
908909
{
909-
g_pCore->GetWebCore ()->AddEventToEventQueue ( [message, source]() {
910-
g_pCore->DebugPrintfColor ( "[BROWSER] Console: %s (%s)", 255, 0, 0, UTF16ToMbUTF8 ( message ).c_str (), UTF16ToMbUTF8 ( source ).c_str () );
910+
g_pCore->GetWebCore ()->AddEventToEventQueue ( [message, source]() {
911+
g_pCore->DebugPrintfColor ( "[BROWSER] Console: %s (%s)", 255, 0, 0, UTF16ToMbUTF8 ( message ).c_str (), UTF16ToMbUTF8 ( source ).c_str () );
911912
}, this, "OnConsoleMessage" );
912-
913+
913914
}
914915

915916
return true;

MTA10/core/CWebView.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class CWebView : public CWebViewInterface, private CefClient, private CefRenderH
5959

6060
bool SetProperty ( const SString& strKey, const SString& strValue );
6161
bool GetProperty ( const SString& strKey, SString& outProperty );
62-
62+
6363
void InjectMouseMove ( int iPosX, int iPosY );
6464
void InjectMouseDown ( eWebBrowserMouseButton mouseButton );
6565
void InjectMouseUp ( eWebBrowserMouseButton mouseButton );
@@ -75,7 +75,7 @@ class CWebView : public CWebViewInterface, private CefClient, private CefRenderH
7575

7676
bool GetFullPathFromLocal ( SString& strPath );
7777
bool VerifyFile ( const SString& strPath );
78-
78+
7979
virtual bool RegisterAjaxHandler ( const SString& strURL ) override;
8080
virtual bool UnregisterAjaxHandler ( const SString& strURL ) override;
8181
virtual bool HasAjaxHandler ( const SString& strURL );
@@ -109,7 +109,7 @@ class CWebView : public CWebViewInterface, private CefClient, private CefRenderH
109109
virtual void OnLoadStart ( CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame ) override;
110110
virtual void OnLoadEnd ( CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, int httpStatusCode ) override;
111111
virtual void OnLoadError ( CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefLoadHandler::ErrorCode errorCode, const CefString& errorText, const CefString& failedURL ) override;
112-
112+
113113
// CefRequestHandler methods
114114
virtual bool OnBeforeBrowse ( CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request, bool isRedirect ) override;
115115
virtual CefRequestHandler::ReturnValue OnBeforeResourceLoad ( CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request, CefRefPtr<CefRequestCallback> callback ) override;
@@ -120,7 +120,7 @@ class CWebView : public CWebViewInterface, private CefClient, private CefRenderH
120120
virtual void OnAfterCreated ( CefRefPtr<CefBrowser> browser) override;
121121

122122
// CefJSDialogHandler methods
123-
virtual bool OnJSDialog ( CefRefPtr<CefBrowser> browser, const CefString& origin_url, CefJSDialogHandler::JSDialogType dialog_type, const CefString& message_text, const CefString& default_prompt_text, CefRefPtr<CefJSDialogCallback> callback, bool& suppress_message ) override;
123+
virtual bool OnJSDialog ( CefRefPtr<CefBrowser> browser, const CefString& origin_url, const CefString& accept_lang, CefJSDialogHandler::JSDialogType dialog_type, const CefString& message_text, const CefString& default_prompt_text, CefRefPtr< CefJSDialogCallback > callback, bool& suppress_message ) override;
124124

125125
// CefDialogHandler methods
126126
virtual bool OnFileDialog ( CefRefPtr<CefBrowser> browser, CefDialogHandler::FileDialogMode mode, const CefString& title, const CefString& default_file_name, const std::vector< CefString >& accept_types, int selected_accept_filter, CefRefPtr< CefFileDialogCallback > callback ) override;
@@ -129,7 +129,7 @@ class CWebView : public CWebViewInterface, private CefClient, private CefRenderH
129129
virtual void OnTitleChange ( CefRefPtr<CefBrowser> browser, const CefString& title ) override;
130130
virtual bool OnTooltip ( CefRefPtr<CefBrowser> browser, CefString& text ) override;
131131
virtual bool OnConsoleMessage ( CefRefPtr<CefBrowser> browser, const CefString& message, const CefString& source, int line ) override;
132-
132+
133133
private:
134134
CefRefPtr<CefBrowser> m_pWebView;
135135
CWebBrowserItem* m_pWebBrowserRenderItem;

0 commit comments

Comments
 (0)