Skip to content

Commit 4525b51

Browse files
committed
RequestContext.cpp - LoadExtension resolve issues with CefPostTask
For the x86 version we define and undefine CEF_INCLUDE_BASE_INTERNAL_CEF_BIND_INTERNAL_WIN_H_ as the /clr compliation option attempts to be helpful and convers all the __fastcall versions to __stdcall which already exist, so we just use the standard calling convention and ignore the optimised ones. The original error is warning C4561: '__fastcall' incompatible with the '/clr' option: converting to '__stdcall' (compiling source file RequestContext.cpp)
1 parent 627d049 commit 4525b51

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

CefSharp.Core/RequestContext.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,18 @@
66
#include "RequestContext.h"
77

88
#include "include\cef_parser.h"
9+
10+
//For the x86 version we define and undefine CEF_INCLUDE_BASE_INTERNAL_CEF_BIND_INTERNAL_WIN_H_
11+
//as the /clr compliation option attempts to be helpful and convers all the __fastcall versions
12+
//to __stdcall which already exist, so we just use the standard calling convention and ignore
13+
//the optimised ones. The original error is
14+
//warning C4561: '__fastcall' incompatible with the '/clr' option: converting to '__stdcall'
15+
//(compiling source file RequestContext.cpp)
16+
#define CEF_INCLUDE_BASE_INTERNAL_CEF_BIND_INTERNAL_WIN_H_
917
#include "include\base\cef_bind.h"
10-
#include "include\wrapper\cef_closure_task.h"
18+
#undef CEF_INCLUDE_BASE_INTERNAL_CEF_BIND_INTERNAL_WIN_H_
1119

20+
#include "include\wrapper\cef_closure_task.h"
1221

1322
#include "CookieManager.h"
1423
#include "SchemeHandlerFactoryWrapper.h"

CefSharp.WinForms.Example/BrowserForm.cs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -565,38 +565,33 @@ private void LoadExtensionsToolStripMenuItemClick(object sender, EventArgs e)
565565
throw new DirectoryNotFoundException("Unable to locate example extensions folder - " + dir);
566566
}
567567

568-
Cef.UIThreadTaskFactory.StartNew(() =>
568+
var extensionHandler = new ExtensionHandler
569569
{
570-
var extensionHandler = new ExtensionHandler
570+
LoadExtensionPopup = (url) =>
571571
{
572-
LoadExtensionPopup = (url) =>
572+
BeginInvoke(new Action(() =>
573573
{
574-
BeginInvoke(new Action(() =>
575-
{
576-
var extensionForm = new Form();
574+
var extensionForm = new Form();
577575

578-
var extensionBrowser = new ChromiumWebBrowser(url);
576+
var extensionBrowser = new ChromiumWebBrowser(url);
579577
//extensionBrowser.IsBrowserInitializedChanged += (s, args) =>
580578
//{
581579
// extensionBrowser.ShowDevTools();
582580
//};
583581

584582
extensionForm.Controls.Add(extensionBrowser);
585583

586-
extensionForm.Show(this);
587-
}));
588-
},
589-
GetActiveBrowser = (extension, isIncognito) =>
590-
{
584+
extensionForm.Show(this);
585+
}));
586+
},
587+
GetActiveBrowser = (extension, isIncognito) =>
588+
{
591589
//Return the active browser for which the extension will act upon
592590
return control.Browser.GetBrowser();
593-
}
594-
};
595-
596-
//requestContext.LoadExtensionFromDirectory(Path.Combine(dir, "set_page_color"), new ExtensionHandler());
591+
}
592+
};
597593

598594
requestContext.LoadExtensionsFromDirectory(dir, extensionHandler);
599-
});
600595
}
601596
else
602597
{

0 commit comments

Comments
 (0)