Skip to content

Commit 7b65866

Browse files
committed
Merge remote-tracking branch 'remotes/upstream/master' into JsBinding_WIP
2 parents e772ae7 + 2ca0f43 commit 7b65866

File tree

3 files changed

+38
-29
lines changed

3 files changed

+38
-29
lines changed

CefSharp.Core/CefSettings.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ namespace CefSharp
106106
void set(String^ value) { StringUtils::AssignNativeFromClr(_cefSettings->cache_path, value); }
107107
}
108108

109+
virtual property bool IgnoreCertificateErrors
110+
{
111+
bool get() { return _cefSettings->ignore_certificate_errors; }
112+
void set(bool value) { _cefSettings->ignore_certificate_errors = value; }
113+
}
114+
109115
virtual property String^ Locale
110116
{
111117
String^ get() { return StringUtils::ToClr(_cefSettings->locale); }

CefSharp.Wpf/ChromiumWebBrowser.cs

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -777,12 +777,18 @@ private void UpdateTooltip(string text)
777777

778778
private void OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
779779
{
780-
managedCefBrowserAdapter.SendFocusEvent(true);
780+
if (managedCefBrowserAdapter != null)
781+
{
782+
managedCefBrowserAdapter.SendFocusEvent(true);
783+
}
781784
}
782785

783786
private void OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
784787
{
785-
managedCefBrowserAdapter.SendFocusEvent(false);
788+
if (managedCefBrowserAdapter != null)
789+
{
790+
managedCefBrowserAdapter.SendFocusEvent(false);
791+
}
786792
}
787793

788794
protected override void OnPreviewKeyDown(KeyEventArgs e)
@@ -842,19 +848,25 @@ protected override void OnMouseMove(MouseEventArgs e)
842848
var point = GetPixelPosition(e);
843849
var modifiers = GetModifiers(e);
844850

845-
managedCefBrowserAdapter.OnMouseMove((int)point.X, (int)point.Y, false, modifiers);
851+
if (managedCefBrowserAdapter != null)
852+
{
853+
managedCefBrowserAdapter.OnMouseMove((int)point.X, (int)point.Y, false, modifiers);
854+
}
846855
}
847856

848857
protected override void OnMouseWheel(MouseWheelEventArgs e)
849858
{
850859
var point = GetPixelPosition(e);
851860

852-
managedCefBrowserAdapter.OnMouseWheel(
853-
(int)point.X,
854-
(int)point.Y,
855-
deltaX: 0,
856-
deltaY: e.Delta
857-
);
861+
if (managedCefBrowserAdapter != null)
862+
{
863+
managedCefBrowserAdapter.OnMouseWheel(
864+
(int)point.X,
865+
(int)point.Y,
866+
deltaX: 0,
867+
deltaY: e.Delta
868+
);
869+
}
858870
}
859871

860872
protected void PopupMouseEnter(object sender, MouseEventArgs e)
@@ -884,7 +896,11 @@ protected override void OnMouseUp(MouseButtonEventArgs e)
884896
protected override void OnMouseLeave(MouseEventArgs e)
885897
{
886898
var modifiers = GetModifiers(e);
887-
managedCefBrowserAdapter.OnMouseMove(0, 0, true, modifiers);
899+
900+
if (managedCefBrowserAdapter != null)
901+
{
902+
managedCefBrowserAdapter.OnMouseMove(0, 0, true, modifiers);
903+
}
888904
}
889905

890906
private void OnMouseButton(MouseButtonEventArgs e)
@@ -913,7 +929,10 @@ private void OnMouseButton(MouseButtonEventArgs e)
913929
var mouseUp = (e.ButtonState == MouseButtonState.Released);
914930
var point = GetPixelPosition(e);
915931

916-
managedCefBrowserAdapter.OnMouseButton((int)point.X, (int)point.Y, mouseButtonType, mouseUp, e.ClickCount, modifiers);
932+
if (managedCefBrowserAdapter != null)
933+
{
934+
managedCefBrowserAdapter.OnMouseButton((int)point.X, (int)point.Y, mouseButtonType, mouseUp, e.ClickCount, modifiers);
935+
}
917936
}
918937

919938
void IWebBrowserInternal.OnInitialized()

README.WPF.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ CefSharp is based on CEF (Chromium Embeddable Framework), which is composed of a
66

77
This is done automatically by the CefSharp.Wpf NuGet package (or the packages it depend on). However, it is only possible to copy these files into *either* the Debug or Release target of your project. Because it is the default when creating a new project, and the target which is normally used when developing .NET applications, I have chosen to place them in the bin\Debug folder for now. This means that if you want to run your application in Release mode, you need to copy these files from bin\Debug to bin\Release for the moment.
88

9-
To be able to use CefSharp.Wpf, you basically just have to add a WebView like this:
9+
To be able to use CefSharp.Wpf, you basically just have to add a ChromiumWebBrowser like this:
1010

1111
``` xml
1212
<Window x:Class="WpfApplication3.MainWindow"
1313
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
1414
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
1515
xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf" Title="MainWindow" Height="350" Width="525">
1616
<Grid>
17-
<cefSharp:WebView x:Name="WebView" />
17+
<cefSharp:ChromiumWebBrowser x:Name="Browser" Address="http://www.google.com.au" />
1818
</Grid>
1919
</Window>
2020
```
@@ -28,23 +28,7 @@ To be able to use CefSharp.Wpf, you basically just have to add a WebView like th
2828
{
2929
InitializeComponent();
3030

31-
WebView.PropertyChanged += OnWebViewPropertyChanged;
32-
3331
Cef.Initialize(new Settings());
3432
}
35-
36-
private void OnWebViewPropertyChanged(object sender, PropertyChangedEventArgs e)
37-
{
38-
switch (e.PropertyName)
39-
{
40-
case "IsBrowserInitialized":
41-
if (WebView.IsBrowserInitialized)
42-
{
43-
WebView.Load("http://10.211.55.2:42000");
44-
}
45-
46-
break;
47-
}
48-
}
4933
}
5034
```

0 commit comments

Comments
 (0)