Skip to content

Commit

Permalink
PR Chromium 126.2.70 to 127.3.50 (#27)
Browse files Browse the repository at this point in the history
* Upgrade to 127.3.5+g114ea2a+chromium-127.0.6533.120

* Change Cef.IsInitialized from bool to bool?

* InitializeCefInternal() missing fix

* Update ChromiumWebBrowser.cs
  • Loading branch information
SLT-World authored Aug 28, 2024
1 parent be8cbf6 commit 65efa93
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
6 changes: 3 additions & 3 deletions CefSharp.Wpf.HwndHost/CefSharp.Wpf.HwndHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<RootNamespace>CefSharp.Wpf.HwndHost</RootNamespace>
<CefSharpAnyCpuSupport>true</CefSharpAnyCpuSupport>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>126.2.70</Version>
<Version>127.3.50</Version>
<Authors>The CefSharp Authors</Authors>
<Description>The CefSharp Chromium-based browser component. The CefSharp.Wpf.HwndHost.ChromiumWebBrowser control is a drop in replacement for the CefSharp.Wpf.ChromiumWebBrowser that's rougly equivilent to hosting the WinForms version in WPF.</Description>
<Copyright>Copyright © The CefSharp Authors</Copyright>
Expand All @@ -23,11 +23,11 @@
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<PackageReference Include="CefSharp.Common" Version="126.2.70" />
<PackageReference Include="CefSharp.Common" Version="127.3.50" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
<PackageReference Include="CefSharp.Common.NETCore" Version="126.2.70" />
<PackageReference Include="CefSharp.Common.NETCore" Version="127.3.50" />
</ItemGroup>

<ItemGroup>
Expand Down
29 changes: 19 additions & 10 deletions CefSharp.Wpf.HwndHost/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class ChromiumWebBrowser : System.Windows.Interop.HwndHost, IWebBrowserIn
"The ChromiumWebBrowser instance creates the underlying Chromium Embedded Framework (CEF) browser instance in an async fashion. " +
"The undelying CefBrowser instance is not yet initialized. Use the IsBrowserInitializedChanged event and check " +
"the IsBrowserInitialized property to determine when the browser has been initialized.";
private const string CefInitializeFailedErrorMessage = "Cef.Initialize() failed.Check the log file see https://github.com/cefsharp/CefSharp/wiki/Trouble-Shooting#log-file for details.";
private const string CefIsInitializedFalseErrorMessage = "Cef.IsInitialized was false!.Check the log file for errors!. See https://github.com/cefsharp/CefSharp/wiki/Trouble-Shooting#log-file for details.";

[DllImport("user32.dll", EntryPoint = "CreateWindowEx", CharSet = CharSet.Unicode)]
private static extern IntPtr CreateWindowEx(int dwExStyle,
Expand Down Expand Up @@ -629,16 +631,7 @@ public ChromiumWebBrowser(string initialAddress)
[MethodImpl(MethodImplOptions.NoInlining)]
private void NoInliningConstructor()
{
//Initialize CEF if it hasn't already been initialized
if (!Cef.IsInitialized)
{
var settings = new CefSettings();

if (!Cef.Initialize(settings))
{
throw new InvalidOperationException("Cef::Initialize() failed");
}
}
InitializeCefInternal();

//Add this ChromiumWebBrowser instance to a list of IDisposable objects
// that if still alive at the time Cef.Shutdown is called will be disposed of
Expand Down Expand Up @@ -1716,6 +1709,22 @@ public IBrowser GetBrowser()
return browser;
}

private static void InitializeCefInternal()
{
if (Cef.IsInitialized == null)
{
if (!Cef.Initialize(new CefSettings()))
{
throw new InvalidOperationException(CefInitializeFailedErrorMessage);
}
}

if (Cef.IsInitialized == false)
{
throw new InvalidOperationException(CefIsInitializedFalseErrorMessage);
}
}

/// <summary>
/// Check is browserisinitialized
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
image: Visual Studio 2019

version: 126.2.70-CI{build}
version: 127.3.50-CI{build}

clone_depth: 10

Expand Down

0 comments on commit 65efa93

Please sign in to comment.