diff --git a/.gitignore b/.gitignore
index ebc7fe0304..e92d3bb6b8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,3 +41,4 @@ x64/Release
Win32/Release
.vs/
/Help
+/tools
diff --git a/CefSharp.BrowserSubprocess.Core/Async/JavascriptAsyncMethodHandler.cpp b/CefSharp.BrowserSubprocess.Core/Async/JavascriptAsyncMethodHandler.cpp
index 790a16c94e..dd9d47e85d 100644
--- a/CefSharp.BrowserSubprocess.Core/Async/JavascriptAsyncMethodHandler.cpp
+++ b/CefSharp.BrowserSubprocess.Core/Async/JavascriptAsyncMethodHandler.cpp
@@ -4,8 +4,8 @@
#include "stdafx.h"
#include "JavascriptAsyncMethodHandler.h"
-#include "../CefSharp.Core/Internals/Messaging/Messages.h"
-#include "../CefSharp.Core/Internals/Serialization/Primitives.h"
+#include "../CefSharp.Core.Runtime/Internals/Messaging/Messages.h"
+#include "../CefSharp.Core.Runtime/Internals/Serialization/Primitives.h"
#include "Serialization/V8Serialization.h"
#include "CefAppUnmanagedWrapper.h"
diff --git a/CefSharp.BrowserSubprocess.Core/BindObjectAsyncHandler.h b/CefSharp.BrowserSubprocess.Core/BindObjectAsyncHandler.h
index 3d6203ad3e..f129cde0de 100644
--- a/CefSharp.BrowserSubprocess.Core/BindObjectAsyncHandler.h
+++ b/CefSharp.BrowserSubprocess.Core/BindObjectAsyncHandler.h
@@ -6,8 +6,8 @@
#include "include/cef_v8.h"
#include "RegisterBoundObjectRegistry.h"
-#include "..\CefSharp.Core\Internals\Messaging\Messages.h"
-#include "..\CefSharp.Core\Internals\Serialization\Primitives.h"
+#include "..\CefSharp.Core.Runtime\Internals\Messaging\Messages.h"
+#include "..\CefSharp.Core.Runtime\Internals\Serialization\Primitives.h"
using namespace System;
using namespace CefSharp::Internals::Messaging;
diff --git a/CefSharp.BrowserSubprocess.Core/CefAppUnmanagedWrapper.cpp b/CefSharp.BrowserSubprocess.Core/CefAppUnmanagedWrapper.cpp
index e35624f08d..c401cf89a6 100644
--- a/CefSharp.BrowserSubprocess.Core/CefAppUnmanagedWrapper.cpp
+++ b/CefSharp.BrowserSubprocess.Core/CefAppUnmanagedWrapper.cpp
@@ -19,8 +19,8 @@
#include "Wrapper\V8Context.h"
#include "Wrapper\Frame.h"
#include "Wrapper\Browser.h"
-#include "..\CefSharp.Core\Internals\Messaging\Messages.h"
-#include "..\CefSharp.Core\Internals\Serialization\Primitives.h"
+#include "..\CefSharp.Core.Runtime\Internals\Messaging\Messages.h"
+#include "..\CefSharp.Core.Runtime\Internals\Serialization\Primitives.h"
using namespace System;
using namespace System::Diagnostics;
diff --git a/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.netcore.filters b/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.netcore.filters
index f16d2fabba..adeeecfd00 100644
--- a/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.netcore.filters
+++ b/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.netcore.filters
@@ -32,10 +32,10 @@
Header Files
-
+
Header Files
-
+
Header Files
@@ -56,10 +56,10 @@
Header Files
-
+
Header Files
-
+
Header Files
@@ -77,7 +77,7 @@
Header Files
-
+
Header Files
@@ -148,7 +148,7 @@
Source Files
-
+
Source Files
@@ -166,7 +166,7 @@
Source Files
-
+
Source Files
diff --git a/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.netcore.vcxproj b/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.netcore.vcxproj
index 504c792576..0871ffc2fa 100644
--- a/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.netcore.vcxproj
+++ b/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.netcore.vcxproj
@@ -174,11 +174,11 @@
-
-
-
-
-
+
+
+
+
+
@@ -207,8 +207,8 @@
-
-
+
+
diff --git a/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj b/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj
index e211929c7c..d16a4876e8 100644
--- a/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj
+++ b/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj
@@ -1,6 +1,7 @@
+
Debug
@@ -167,11 +168,11 @@
-
-
-
-
-
+
+
+
+
+
@@ -208,8 +209,8 @@
-
-
+
+
@@ -247,5 +248,7 @@
-
+
+
+
\ No newline at end of file
diff --git a/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj.filters b/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj.filters
index 71c703e934..90832c8d34 100644
--- a/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj.filters
+++ b/CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj.filters
@@ -32,10 +32,10 @@
Header Files
-
+
Header Files
-
+
Header Files
@@ -56,10 +56,10 @@
Header Files
-
+
Header Files
-
+
Header Files
@@ -77,7 +77,7 @@
Header Files
-
+
Header Files
@@ -154,7 +154,7 @@
Source Files
-
+
Source Files
@@ -172,7 +172,7 @@
Source Files
-
+
Source Files
diff --git a/CefSharp.BrowserSubprocess.Core/JavascriptPostMessageHandler.h b/CefSharp.BrowserSubprocess.Core/JavascriptPostMessageHandler.h
index 81fe6c0ea4..2ea73d8cc0 100644
--- a/CefSharp.BrowserSubprocess.Core/JavascriptPostMessageHandler.h
+++ b/CefSharp.BrowserSubprocess.Core/JavascriptPostMessageHandler.h
@@ -5,8 +5,8 @@
#pragma once
#include "include/cef_v8.h"
-#include "..\CefSharp.Core\Internals\Messaging\Messages.h"
-#include "..\CefSharp.Core\Internals\Serialization\Primitives.h"
+#include "..\CefSharp.Core.Runtime\Internals\Messaging\Messages.h"
+#include "..\CefSharp.Core.Runtime\Internals\Serialization\Primitives.h"
#include "Serialization\V8Serialization.h"
using namespace System;
diff --git a/CefSharp.BrowserSubprocess.Core/JavascriptPromiseHandler.h b/CefSharp.BrowserSubprocess.Core/JavascriptPromiseHandler.h
index 918d9d127b..bfde170538 100644
--- a/CefSharp.BrowserSubprocess.Core/JavascriptPromiseHandler.h
+++ b/CefSharp.BrowserSubprocess.Core/JavascriptPromiseHandler.h
@@ -5,8 +5,8 @@
#pragma once
#include "include/cef_v8.h"
-#include "..\CefSharp.Core\Internals\Messaging\Messages.h"
-#include "..\CefSharp.Core\Internals\Serialization\Primitives.h"
+#include "..\CefSharp.Core.Runtime\Internals\Messaging\Messages.h"
+#include "..\CefSharp.Core.Runtime\Internals\Serialization\Primitives.h"
#include "Serialization\V8Serialization.h"
using namespace System;
diff --git a/CefSharp.BrowserSubprocess.Core/RegisterBoundObjectHandler.h b/CefSharp.BrowserSubprocess.Core/RegisterBoundObjectHandler.h
index acfdbb5ea8..44d51fee12 100644
--- a/CefSharp.BrowserSubprocess.Core/RegisterBoundObjectHandler.h
+++ b/CefSharp.BrowserSubprocess.Core/RegisterBoundObjectHandler.h
@@ -6,8 +6,8 @@
#include "include/cef_v8.h"
#include "RegisterBoundObjectRegistry.h"
-#include "..\CefSharp.Core\Internals\Messaging\Messages.h"
-#include "..\CefSharp.Core\Internals\Serialization\Primitives.h"
+#include "..\CefSharp.Core.Runtime\Internals\Messaging\Messages.h"
+#include "..\CefSharp.Core.Runtime\Internals\Serialization\Primitives.h"
using namespace System;
using namespace CefSharp::Internals::Messaging;
diff --git a/CefSharp.BrowserSubprocess.Core/Resource.rc b/CefSharp.BrowserSubprocess.Core/Resource.rc
index 8e931a3681..9293f18921 100644
--- a/CefSharp.BrowserSubprocess.Core/Resource.rc
+++ b/CefSharp.BrowserSubprocess.Core/Resource.rc
@@ -1,6 +1,6 @@
1 VERSIONINFO
- FILEVERSION 86,0,20
- PRODUCTVERSION 86,0,20
+ FILEVERSION 87,1,11
+ PRODUCTVERSION 87,1,11
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -16,10 +16,10 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "CefSharp.BrowserSubprocess.Core"
- VALUE "FileVersion", "86.0.20"
+ VALUE "FileVersion", "87.1.11"
VALUE "LegalCopyright", "Copyright © 2020 The CefSharp Authors"
VALUE "ProductName", "CefSharp"
- VALUE "ProductVersion", "86.0.20"
+ VALUE "ProductVersion", "87.1.11"
END
END
BLOCK "VarFileInfo"
diff --git a/CefSharp.BrowserSubprocess.Core/Serialization/JsObjectsSerialization.cpp b/CefSharp.BrowserSubprocess.Core/Serialization/JsObjectsSerialization.cpp
index 27b237ae80..64ef5b1424 100644
--- a/CefSharp.BrowserSubprocess.Core/Serialization/JsObjectsSerialization.cpp
+++ b/CefSharp.BrowserSubprocess.Core/Serialization/JsObjectsSerialization.cpp
@@ -4,8 +4,8 @@
#include "stdafx.h"
#include "JsObjectsSerialization.h"
-#include "../CefSharp.Core/Internals/Serialization/Primitives.h"
-#include "../CefSharp.Core/Internals/Serialization/ObjectsSerialization.h"
+#include "../CefSharp.Core.Runtime/Internals/Serialization/Primitives.h"
+#include "../CefSharp.Core.Runtime/Internals/Serialization/ObjectsSerialization.h"
namespace CefSharp
{
diff --git a/CefSharp.BrowserSubprocess.Core/Serialization/V8Serialization.cpp b/CefSharp.BrowserSubprocess.Core/Serialization/V8Serialization.cpp
index a47b1286bf..9773b31fd9 100644
--- a/CefSharp.BrowserSubprocess.Core/Serialization/V8Serialization.cpp
+++ b/CefSharp.BrowserSubprocess.Core/Serialization/V8Serialization.cpp
@@ -1,11 +1,11 @@
-// Copyright © 2015 The CefSharp Authors. All rights reserved.
+// Copyright © 2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#include "Stdafx.h"
#include "V8Serialization.h"
#include "JavascriptCallbackRegistry.h"
-#include "../CefSharp.Core/Internals/Serialization/Primitives.h"
+#include "../CefSharp.Core.Runtime/Internals/Serialization/Primitives.h"
#include
@@ -185,4 +185,4 @@ namespace CefSharp
template CefRefPtr DeserializeV8Object(const CefRefPtr& list, const CefString& index);
}
}
-}
\ No newline at end of file
+}
diff --git a/CefSharp.BrowserSubprocess.Core/Stdafx.h b/CefSharp.BrowserSubprocess.Core/Stdafx.h
index fbdd796040..b450bb08cb 100644
--- a/CefSharp.BrowserSubprocess.Core/Stdafx.h
+++ b/CefSharp.BrowserSubprocess.Core/Stdafx.h
@@ -14,10 +14,10 @@
#include
-#include ".\..\CefSharp.Core\Internals\MCefRefPtr.h"
-#include ".\..\CefSharp.Core\Internals\StringUtils.h"
+#include ".\..\CefSharp.Core.Runtime\Internals\MCefRefPtr.h"
+#include ".\..\CefSharp.Core.Runtime\Internals\StringUtils.h"
#include "vcclr_local.h"
using namespace System;
using namespace CefSharp;
-using namespace CefSharp::Internals;
\ No newline at end of file
+using namespace CefSharp::Internals;
diff --git a/CefSharp.BrowserSubprocess.Core/TypeUtils.cpp b/CefSharp.BrowserSubprocess.Core/TypeUtils.cpp
index e8ea19b9b1..f0355f2321 100644
--- a/CefSharp.BrowserSubprocess.Core/TypeUtils.cpp
+++ b/CefSharp.BrowserSubprocess.Core/TypeUtils.cpp
@@ -5,7 +5,7 @@
#pragma once
#include "Stdafx.h"
-#include ".\..\CefSharp.Core\Internals\StringUtils.h"
+#include ".\..\CefSharp.Core.Runtime\Internals\StringUtils.h"
#include "TypeUtils.h"
using namespace System::Collections::Generic;
diff --git a/CefSharp.BrowserSubprocess.Core/packages.CefSharp.BrowserSubprocess.Core.config b/CefSharp.BrowserSubprocess.Core/packages.CefSharp.BrowserSubprocess.Core.config
index c5acab68f2..913cc77c00 100644
--- a/CefSharp.BrowserSubprocess.Core/packages.CefSharp.BrowserSubprocess.Core.config
+++ b/CefSharp.BrowserSubprocess.Core/packages.CefSharp.BrowserSubprocess.Core.config
@@ -1,4 +1,5 @@
+
\ No newline at end of file
diff --git a/CefSharp.BrowserSubprocess/app.manifest b/CefSharp.BrowserSubprocess/app.manifest
index bfa62ccd9e..851c929ff3 100644
--- a/CefSharp.BrowserSubprocess/app.manifest
+++ b/CefSharp.BrowserSubprocess/app.manifest
@@ -8,7 +8,7 @@
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
+
diff --git a/CefSharp.Core.Runtime.RefAssembly/CefSharp.Core.Runtime.RefAssembly.csproj b/CefSharp.Core.Runtime.RefAssembly/CefSharp.Core.Runtime.RefAssembly.csproj
new file mode 100644
index 0000000000..c64bbc2330
--- /dev/null
+++ b/CefSharp.Core.Runtime.RefAssembly/CefSharp.Core.Runtime.RefAssembly.csproj
@@ -0,0 +1,71 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {6F1CD3B6-DA67-4563-A662-F88E81951A82}
+ Library
+ Properties
+ CefSharp.Core
+ CefSharp.Core.Runtime
+ v4.5.2
+ 512
+
+
+
+
+ 7.1
+
+
+ true
+
+
+ ..\CefSharp.snk
+
+
+ true
+ bin\Debug\
+ DEBUG;TRACE
+ full
+ AnyCPU
+ prompt
+ MinimumRecommendedRules.ruleset
+
+
+ bin\Release\
+ TRACE
+ true
+ pdbonly
+ AnyCPU
+ prompt
+ MinimumRecommendedRules.ruleset
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {a55848cc-10e7-40cb-addb-04740b16dd43}
+ CefSharp
+
+
+
+
+ %WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe
+ ..\GenerateRefAssemblySource.ps1
+
+
+
+
+
diff --git a/CefSharp.Core.RefAssembly/CefSharp.Core.RefAssembly.csproj b/CefSharp.Core.Runtime.RefAssembly/CefSharp.Core.Runtime.RefAssembly.netcore.csproj
similarity index 62%
rename from CefSharp.Core.RefAssembly/CefSharp.Core.RefAssembly.csproj
rename to CefSharp.Core.Runtime.RefAssembly/CefSharp.Core.Runtime.RefAssembly.netcore.csproj
index 9654975c51..2200761f77 100644
--- a/CefSharp.Core.RefAssembly/CefSharp.Core.RefAssembly.csproj
+++ b/CefSharp.Core.Runtime.RefAssembly/CefSharp.Core.Runtime.RefAssembly.netcore.csproj
@@ -1,8 +1,18 @@
-
+
+
+
+
+ obj.netcore\
+ bin.netcore\
+
+
+
+
netcoreapp3.1
CefSharp.Core
- CefSharp.Core
+ CefSharp.Core.Runtime
$(BaseOutputPath)$(PlatformTarget)\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml
false
true
@@ -10,12 +20,25 @@
MinimumRecommendedRules.ruleset
CS1591,CS0436
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
false
-
+
false
@@ -31,21 +54,21 @@
Haven't found a nice way to determine the Platform (resolves as AnyCPU)
-->
-
+
- $(SolutionDir)CefSharp.Core\bin.netcore\x64\$(Configuration)\CefSharp.Core.dll
+ $(SolutionDir)CefSharp.Core.Runtime\bin.netcore\x64\$(Configuration)\CefSharp.Core.Runtime.dll
- $(SolutionDir)CefSharp.Core\bin.netcore\win32\$(Configuration)\CefSharp.Core.dll
+ $(SolutionDir)CefSharp.Core.Runtime\bin.netcore\win32\$(Configuration)\CefSharp.Core.Runtime.dll
false
$(ProjectDir)
- $(GenAPITargetDir)$(AssemblyName).cs
+ $(GenAPITargetDir)$(AssemblyName).netcore.cs
+
+ obj.netcore\
+ bin.netcore\
+
+
+
+
+
+ netcoreapp3.1
+ CefSharp.Core
+ CefSharp.Core
+ $(BaseOutputPath)$(PlatformTarget)$(Configuration)\$(TargetFramework)\$(AssemblyName).xml
+ false
+ true
+ ..\CefSharp.snk
+ MinimumRecommendedRules.ruleset
+ CS1591,CS0436
+ 9.0
+
+
+
+ DEBUG;TRACE;NETCOREAPP
+
+
+
+ TRACE;NETCOREAPP
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+ false
+
+
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/CefSharp.Core/Initializer.cs b/CefSharp.Core/Initializer.cs
new file mode 100644
index 0000000000..e8c02dda0f
--- /dev/null
+++ b/CefSharp.Core/Initializer.cs
@@ -0,0 +1,76 @@
+// Copyright © 2020 The CefSharp Authors. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace CefSharp
+{
+ ///
+ /// CLR Module Initializer
+ /// Used to load libcef.dll if required
+ ///
+ public static class Initializer
+ {
+ //TODO: Internal debugging only for now, needs improving if users are going to
+ //get meaningful data from this.
+ public static (bool Loaded, string Path, string BrowserSubProcessPath, IntPtr LibraryHandle) LibCefLoadStatus;
+
+ [ModuleInitializer]
+ internal static void ModuleInitializer()
+ {
+ var currentFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
+ var libCefPath = Path.Combine(currentFolder, "libcef.dll");
+
+ if (File.Exists(libCefPath))
+ {
+ //We didn't load CEF, it was already next to our calling assembly, the
+ //framework should load it correctly on it's own
+ LibCefLoadStatus = (false, libCefPath, null, IntPtr.Zero);
+ }
+ else
+ {
+ //TODO: This will need changing if we support ARM64
+ var arch = Environment.Is64BitProcess ? "x64" : "x86";
+ var archFolder = $"runtimes\\win-{arch}\\native";
+ libCefPath = Path.Combine(currentFolder, archFolder, "libcef.dll");
+ if (File.Exists(libCefPath))
+ {
+ if (NativeLibrary.TryLoad(libCefPath, out IntPtr handle))
+ {
+ var browserSubProcessPath = Path.Combine(currentFolder, archFolder, "CefSharp.BrowserSubprocess.exe");
+ LibCefLoadStatus = (true, libCefPath, browserSubProcessPath, handle);
+ }
+ }
+ else
+ {
+ LibCefLoadStatus = (false, libCefPath, null, IntPtr.Zero);
+ }
+ }
+ //var assembly = LoadCefSharpCoreRuntime();
+
+ //NativeLibrary.SetDllImportResolver(typeof(CefSharp.Core.CefSettingsBase).Assembly, LibCefImportResolver);
+
+ //CefSharpCoreRuntimeLocation = assembly.Location;
+ }
+
+ //private static IntPtr LibCefImportResolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
+ //{
+ // return IntPtr.Zero;
+ //}
+
+ //public static Assembly LoadCefSharpCoreRuntime()
+ //{
+ // //Load into the same context as CefSharp.Core, if user was to create their own context then
+ // //this should keep thing together.
+ // var currentCtx = AssemblyLoadContext.GetLoadContext(typeof(Initializer).Assembly);
+
+ // var browserSubprocessDllPath = Path.Combine(Path.GetDirectoryName(typeof(Initializer).Assembly.Location), "CefSharp.Core.Runtime.dll");
+ // return currentCtx.LoadFromAssemblyPath(browserSubprocessDllPath);
+ //}
+ }
+}
diff --git a/CefSharp.Core/ManagedCefBrowserAdapter.cpp b/CefSharp.Core/ManagedCefBrowserAdapter.cpp
deleted file mode 100644
index 2e57b8802e..0000000000
--- a/CefSharp.Core/ManagedCefBrowserAdapter.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright © 2014 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#include "Stdafx.h"
-
-#include "ManagedCefBrowserAdapter.h"
-#include "WindowInfo.h"
-#include "Internals\Messaging\Messages.h"
-#include "Internals\CefFrameWrapper.h"
-#include "Internals\CefBrowserWrapper.h"
-#include "Internals\Serialization\Primitives.h"
-#include "Internals\Serialization\JsObjectsSerialization.h"
-
-using namespace CefSharp::Internals::Serialization;
-using namespace CefSharp::Internals::Messaging;
-
-using namespace CefSharp::Internals::Messaging;
-
-bool ManagedCefBrowserAdapter::IsDisposed::get()
-{
- return _isDisposed;
-}
-
-void ManagedCefBrowserAdapter::CreateBrowser(IWindowInfo^ windowInfo, BrowserSettings^ browserSettings, RequestContext^ requestContext, String^ address)
-{
- auto cefWindowInfoWrapper = static_cast(windowInfo);
-
- CefString addressNative = StringUtils::ToNative(address);
-
- if (browserSettings == nullptr)
- {
- throw gcnew ArgumentNullException("browserSettings", "cannot be null");
- }
-
- if (browserSettings->IsDisposed)
- {
- throw gcnew ObjectDisposedException("browserSettings", "browser settings has already been disposed. " +
- "BrowserSettings created by CefSharp are automatically disposed, to control the lifecycle create and set your own instance.");
- }
-
- auto objectRepository = _javaScriptObjectRepository;
-
- //It's no longer possible to change these settings
- objectRepository->Settings->Freeze();
-
- CefRefPtr extraInfo = CefDictionaryValue::Create();
- auto legacyBindingEnabled = false;
-
- if (objectRepository->Settings->LegacyBindingEnabled)
- {
- auto legacyBoundObjects = objectRepository->GetLegacyBoundObjects();
-
- legacyBindingEnabled = objectRepository->HasBoundObjects;
-
- //For legacy binding we only add values if we have bond objects.
- if (legacyBindingEnabled)
- {
- auto listValue = CefListValue::Create();
-
- SerializeJsObjects(legacyBoundObjects, listValue, 0);
-
- extraInfo->SetList("LegacyBindingObjects", listValue);
- }
- }
-
- extraInfo->SetBool("LegacyBindingEnabled", legacyBindingEnabled);
-
- if (!String::IsNullOrEmpty(objectRepository->Settings->JavascriptBindingApiGlobalObjectName))
- {
- auto globalObjName = objectRepository->Settings->JavascriptBindingApiGlobalObjectName;
-
- if (StringCheck::IsFirstCharacterLowercase(globalObjName))
- {
- extraInfo->SetString("JsBindingPropertyNameCamelCase", StringUtils::ToNative(globalObjName));
- }
- else
- {
- extraInfo->SetString("JsBindingPropertyName", StringUtils::ToNative(globalObjName));
- }
- }
-
- if (!CefBrowserHost::CreateBrowser(*cefWindowInfoWrapper->GetWindowInfo(), _clientAdapter.get(), addressNative,
- *browserSettings->_browserSettings, extraInfo, static_cast>(requestContext)))
- {
- throw gcnew InvalidOperationException("CefBrowserHost::CreateBrowser call failed, review the CEF log file for more details.");
- }
-
- delete windowInfo;
-}
-
-#ifndef NETCOREAPP
-// NOTE: This was moved out of OnAfterBrowserCreated to prevent the System.ServiceModel assembly from being loaded when WCF is not enabled.
-__declspec(noinline) void ManagedCefBrowserAdapter::InitializeBrowserProcessServiceHost(IBrowser^ browser)
-{
- _browserProcessServiceHost = gcnew BrowserProcessServiceHost(_javaScriptObjectRepository, Process::GetCurrentProcess()->Id, browser->Identifier, _javascriptCallbackFactory);
- //NOTE: Attempt to solve timing issue where browser is opened and rapidly disposed. In some cases a call to Open throws
- // an exception about the process already being closed. Two relevant issues are #862 and #804.
- if (_browserProcessServiceHost->State == CommunicationState::Created)
- {
- try
- {
- _browserProcessServiceHost->Open();
- }
- catch (Exception^)
- {
- //Ignore exception as it's likely cause when the browser is closing
- }
- }
-}
-
-// NOTE: This was moved out of ~ManagedCefBrowserAdapter to prevent the System.ServiceModel assembly from being loaded when WCF is not enabled.
-__declspec(noinline) void ManagedCefBrowserAdapter::DisposeBrowserProcessServiceHost()
-{
- if (_browserProcessServiceHost != nullptr)
- {
- if (CefSharpSettings::WcfTimeout > TimeSpan::Zero)
- {
- _browserProcessServiceHost->Close(CefSharpSettings::WcfTimeout);
- }
- else
- {
- _browserProcessServiceHost->Abort();
- }
- _browserProcessServiceHost = nullptr;
- }
-}
-#endif
-
-void ManagedCefBrowserAdapter::OnAfterBrowserCreated(IBrowser^ browser)
-{
- if (!_isDisposed)
- {
- _browserWrapper = browser;
- _javascriptCallbackFactory->BrowserAdapter = gcnew WeakReference(this);
-
- //Browser has been initialized, it's now too late to register a sync JSB object if Wcf wasn't enabled
- _javaScriptObjectRepository->IsBrowserInitialized = true;
-
-#ifndef NETCOREAPP
- if (CefSharpSettings::WcfEnabled)
- {
- InitializeBrowserProcessServiceHost(browser);
- }
-#endif
-
- if (_webBrowserInternal != nullptr)
- {
- _webBrowserInternal->OnAfterBrowserCreated(browser);
- }
- }
-}
-
-void ManagedCefBrowserAdapter::Resize(int width, int height)
-{
- HWND browserHwnd = _clientAdapter->GetBrowserHwnd();
- if (browserHwnd)
- {
- if (width == 0 && height == 0)
- {
- // For windowed browsers when the frame window is minimized set the
- // browser window size to 0x0 to reduce resource usage.
- SetWindowPos(browserHwnd, NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
- }
- else
- {
- SetWindowPos(browserHwnd, NULL, 0, 0, width, height, SWP_NOZORDER);
- }
- }
-}
-
-IBrowser^ ManagedCefBrowserAdapter::GetBrowser(int browserId)
-{
- return _clientAdapter->GetBrowserWrapper(browserId);
-}
-
-IJavascriptCallbackFactory^ ManagedCefBrowserAdapter::JavascriptCallbackFactory::get()
-{
- return _javascriptCallbackFactory;
-}
-
-IJavascriptObjectRepositoryInternal^ ManagedCefBrowserAdapter::JavascriptObjectRepository::get()
-{
- return _javaScriptObjectRepository;
-}
-
-IMethodRunnerQueue^ ManagedCefBrowserAdapter::MethodRunnerQueue::get()
-{
- return _methodRunnerQueue;
-}
-
-void ManagedCefBrowserAdapter::MethodInvocationComplete(Object^ sender, MethodInvocationCompleteArgs^ e)
-{
- auto result = e->Result;
- if (result->CallbackId.HasValue)
- {
- _clientAdapter->MethodInvocationComplete(result);
- }
-}
-
-MCefRefPtr ManagedCefBrowserAdapter::GetClientAdapter()
-{
- return _clientAdapter;
-}
diff --git a/CefSharp.Core/ManagedCefBrowserAdapter.h b/CefSharp.Core/ManagedCefBrowserAdapter.h
deleted file mode 100644
index e6bff64e23..0000000000
--- a/CefSharp.Core/ManagedCefBrowserAdapter.h
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright © 2013 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#ifndef CEFSHARP_CORE_MANAGEDCEFBROWSERADAPTER_H_
-#define CEFSHARP_CORE_MANAGEDCEFBROWSERADAPTER_H_
-
-#pragma once
-
-#include "Stdafx.h"
-
-#include "include\cef_client.h"
-
-#include "BrowserSettings.h"
-#include "RequestContext.h"
-#include "Internals/ClientAdapter.h"
-#include "Internals/CefDragDataWrapper.h"
-#include "Internals/RenderClientAdapter.h"
-#include "Internals/JavascriptCallbackFactory.h"
-
-using namespace System::Diagnostics;
-#ifndef NETCOREAPP
-using namespace System::ServiceModel;
-using namespace CefSharp::Internals::Wcf;
-#endif
-using namespace System::Threading;
-using namespace System::Threading::Tasks;
-
-namespace CefSharp
-{
- ///
- public ref class ManagedCefBrowserAdapter : public IBrowserAdapter
- {
- MCefRefPtr _clientAdapter;
-#ifndef NETCOREAPP
- BrowserProcessServiceHost^ _browserProcessServiceHost;
-#endif
- IWebBrowserInternal^ _webBrowserInternal;
- IJavascriptObjectRepositoryInternal^ _javaScriptObjectRepository;
- JavascriptCallbackFactory^ _javascriptCallbackFactory;
- IMethodRunnerQueue^ _methodRunnerQueue;
- IBrowser^ _browserWrapper;
- bool _isDisposed;
-
- private:
- void MethodInvocationComplete(Object^ sender, MethodInvocationCompleteArgs^ e);
-#ifndef NETCOREAPP
- void InitializeBrowserProcessServiceHost(IBrowser^ browser);
- void DisposeBrowserProcessServiceHost();
-#endif
-
- internal:
- MCefRefPtr GetClientAdapter();
-
- public:
- ManagedCefBrowserAdapter(IWebBrowserInternal^ webBrowserInternal, bool offScreenRendering)
- : _isDisposed(false)
- {
- if (offScreenRendering)
- {
- _clientAdapter = new RenderClientAdapter(webBrowserInternal, this);
- }
- else
- {
- _clientAdapter = new ClientAdapter(webBrowserInternal, this);
- }
-
- _webBrowserInternal = webBrowserInternal;
- _javaScriptObjectRepository = gcnew CefSharp::Internals::JavascriptObjectRepository();
- _javascriptCallbackFactory = gcnew CefSharp::Internals::JavascriptCallbackFactory(_clientAdapter->GetPendingTaskRepository());
-
- if (CefSharpSettings::ConcurrentTaskExecution)
- {
- _methodRunnerQueue = gcnew CefSharp::Internals::ConcurrentMethodRunnerQueue(_javaScriptObjectRepository);
- }
- else
- {
- _methodRunnerQueue = gcnew CefSharp::Internals::MethodRunnerQueue(_javaScriptObjectRepository);
- }
-
- _methodRunnerQueue->MethodInvocationComplete += gcnew EventHandler(this, &ManagedCefBrowserAdapter::MethodInvocationComplete);
- }
-
- !ManagedCefBrowserAdapter()
- {
- _clientAdapter = nullptr;
- }
-
- ~ManagedCefBrowserAdapter()
- {
- _isDisposed = true;
-
- // Stop the method runner before releasing browser adapter and browser wrapper (#2529)
- if (_methodRunnerQueue != nullptr)
- {
- _methodRunnerQueue->MethodInvocationComplete -= gcnew EventHandler(this, &ManagedCefBrowserAdapter::MethodInvocationComplete);
- delete _methodRunnerQueue;
- _methodRunnerQueue = nullptr;
- }
-
- // Release the MCefRefPtr reference
- // before calling _browserWrapper->CloseBrowser(true)
- this->!ManagedCefBrowserAdapter();
-
- if (_browserWrapper != nullptr)
- {
- _browserWrapper->CloseBrowser(true);
-
- delete _browserWrapper;
- _browserWrapper = nullptr;
- }
-
-#ifndef NETCOREAPP
- if (CefSharpSettings::WcfEnabled)
- {
- DisposeBrowserProcessServiceHost();
- }
-#endif
-
- _webBrowserInternal = nullptr;
- delete _javaScriptObjectRepository;
- _javaScriptObjectRepository = nullptr;
- }
-
- virtual property bool IsDisposed
- {
- bool get();
- }
-
- virtual void OnAfterBrowserCreated(IBrowser^ browser);
- void CreateBrowser(IWindowInfo^ windowInfo, BrowserSettings^ browserSettings, RequestContext^ requestContext, String^ address);
- virtual void Resize(int width, int height);
-
- virtual IBrowser^ GetBrowser(int browserId);
-
- virtual property IJavascriptCallbackFactory^ JavascriptCallbackFactory
- {
- CefSharp::Internals::IJavascriptCallbackFactory^ get();
- }
-
- virtual property IJavascriptObjectRepositoryInternal^ JavascriptObjectRepository
- {
- CefSharp::Internals::IJavascriptObjectRepositoryInternal^ get();
- }
-
- virtual property IMethodRunnerQueue^ MethodRunnerQueue
- {
- CefSharp::Internals::IMethodRunnerQueue^ get();
- }
- };
-}
-#endif // CEFSHARP_CORE_INTERNALS_CLIENTADAPTER_H_
diff --git a/CefSharp.Core/ModuleInitializerAttribute.cs b/CefSharp.Core/ModuleInitializerAttribute.cs
new file mode 100644
index 0000000000..98f8bd4fca
--- /dev/null
+++ b/CefSharp.Core/ModuleInitializerAttribute.cs
@@ -0,0 +1,7 @@
+namespace System.Runtime.CompilerServices
+{
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
+ public sealed class ModuleInitializerAttribute : Attribute
+ {
+ }
+}
diff --git a/CefSharp.Core/NativeMethodWrapper.cpp b/CefSharp.Core/NativeMethodWrapper.cpp
deleted file mode 100644
index fc88312e12..0000000000
--- a/CefSharp.Core/NativeMethodWrapper.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright © 2014 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#include "Stdafx.h"
-
-#include "NativeMethodWrapper.h"
-
-namespace CefSharp
-{
- void NativeMethodWrapper::MemoryCopy(IntPtr dest, IntPtr src, int numberOfBytes)
- {
- RtlCopyMemory(dest.ToPointer(), src.ToPointer(), numberOfBytes);
- }
-
- bool NativeMethodWrapper::IsFocused(IntPtr handle)
- {
- // Ask Windows which control has the focus and then check if it's one of our children
- auto focusControl = GetFocus();
- return focusControl != 0 && (IsChild((HWND)handle.ToPointer(), focusControl) == 1);
- }
-
- void NativeMethodWrapper::SetWindowPosition(IntPtr handle, int x, int y, int width, int height)
- {
- HWND browserHwnd = static_cast(handle.ToPointer());
- if (browserHwnd)
- {
- if (width == 0 && height == 0)
- {
- // For windowed browsers when the frame window is minimized set the
- // browser window size to 0x0 to reduce resource usage.
- SetWindowPos(browserHwnd, NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
- }
- else
- {
- SetWindowPos(browserHwnd, NULL, x, y, width, height, SWP_NOZORDER);
- }
- }
- }
-
- void NativeMethodWrapper::SetWindowParent(IntPtr child, IntPtr newParent)
- {
- HWND childHwnd = static_cast(child.ToPointer());
- HWND newParentHwnd = static_cast(newParent.ToPointer());
-
- SetParent(childHwnd, newParentHwnd);
- }
-
- void NativeMethodWrapper::RemoveExNoActivateStyle(IntPtr browserHwnd)
- {
- HWND hwnd = static_cast(browserHwnd.ToPointer());
-
- auto exStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
-
- if (exStyle & WS_EX_NOACTIVATE)
- {
- //Remove WS_EX_NOACTIVATE
- SetWindowLongPtr(hwnd, GWL_EXSTYLE, exStyle & ~WS_EX_NOACTIVATE);
- }
- }
-}
diff --git a/CefSharp.Core/NativeMethodWrapper.h b/CefSharp.Core/NativeMethodWrapper.h
deleted file mode 100644
index da6b12041b..0000000000
--- a/CefSharp.Core/NativeMethodWrapper.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright © 2012 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#pragma once
-
-#include "Stdafx.h"
-
-namespace CefSharp
-{
- ///
- public ref class NativeMethodWrapper sealed
- {
- public:
- //Method cannot be called CopyMemory/RtlCopyMemroy as that's a macro name
- //Length is currently int, update if required to handle larger data structures
- //(int is plenty big enough for our current use case)
- static void MemoryCopy(IntPtr dest, IntPtr src, int numberOfBytes);
- static bool IsFocused(IntPtr handle);
- static void SetWindowPosition(IntPtr handle, int x, int y, int width, int height);
- static void SetWindowParent(IntPtr child, IntPtr newParent);
- static void RemoveExNoActivateStyle(IntPtr browserHwnd);
- };
-}
diff --git a/CefSharp.Core/PopupFeatures.h b/CefSharp.Core/PopupFeatures.h
deleted file mode 100644
index 9f08f88426..0000000000
--- a/CefSharp.Core/PopupFeatures.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright © 2016 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#pragma once
-
-#include "Stdafx.h"
-
-namespace CefSharp
-{
- ///
- /// Class representing popup window features.
- ///
- ///
- public ref class PopupFeatures : IPopupFeatures
- {
- private:
- const CefPopupFeatures* _popupFeatures;
-
- internal:
- ///
- /// Constructor.
- ///
- /// The popup features.
- PopupFeatures(const CefPopupFeatures* popupFeatures)
- {
- _popupFeatures = popupFeatures;
- }
-
- public:
- !PopupFeatures()
- {
- _popupFeatures = NULL;
- }
-
- ~PopupFeatures()
- {
- this->!PopupFeatures();
- }
-
- virtual property System::Nullable X
- {
- System::Nullable get() { return _popupFeatures->xSet ? _popupFeatures->x : Nullable(); }
- }
-
- virtual property System::Nullable Y
- {
- System::Nullable get() { return _popupFeatures->ySet ? _popupFeatures->y : Nullable(); }
- }
-
- virtual property System::Nullable Width
- {
- System::Nullable get() { return _popupFeatures->widthSet ? _popupFeatures->width : Nullable(); }
- }
-
- virtual property System::Nullable Height
- {
- System::Nullable get() { return _popupFeatures->heightSet ? _popupFeatures->height : Nullable(); }
- }
-
- virtual property bool MenuBarVisible
- {
- bool get() { return _popupFeatures->menuBarVisible == 1; }
- }
-
- virtual property bool StatusBarVisible
- {
- bool get() { return _popupFeatures->statusBarVisible == 1; }
- }
-
- virtual property bool ToolBarVisible
- {
- bool get() { return _popupFeatures->toolBarVisible == 1; }
- }
-
- virtual property bool ScrollbarsVisible
- {
- bool get() { return _popupFeatures->scrollbarsVisible == 1; }
- }
- };
-}
diff --git a/CefSharp.Core/PostData.h b/CefSharp.Core/PostData.h
deleted file mode 100644
index 9ef820e3fb..0000000000
--- a/CefSharp.Core/PostData.h
+++ /dev/null
@@ -1,234 +0,0 @@
-// Copyright © 2015 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#pragma once
-
-#include "Stdafx.h"
-
-#include "include\cef_request.h"
-
-#include "PostDataElement.h"
-#include "Internals\TypeConversion.h"
-#include "Internals\CefWrapper.h"
-
-using namespace System::Collections::Generic;
-using namespace System::Collections::ObjectModel;
-
-namespace CefSharp
-{
- ///
- /// Form Post Data
- ///
- ///
- public ref class PostData : public IPostData, public CefWrapper
- {
- MCefRefPtr _postData;
- List^ _postDataElements;
-
- internal:
- PostData(CefRefPtr &postData) :
- _postData(postData)
- {
-
- }
-
- ///
- /// Finalizer.
- ///
- !PostData()
- {
- _postData = nullptr;
- }
-
- ///
- /// Destructor.
- ///
- ~PostData()
- {
- this->!PostData();
-
- if (_postDataElements != nullptr)
- {
- //Make sure the unmanaged resources are handled
- for each (IPostDataElement^ element in _postDataElements)
- {
- delete element;
- }
-
- _postDataElements = nullptr;
- }
-
- _disposed = true;
- }
-
- ///
- /// Throw exception if Readonly
- ///
- /// Thrown when an exception error condition occurs.
- void ThrowIfReadOnly()
- {
- if (IsReadOnly)
- {
- throw gcnew Exception(gcnew String(L"This IPostDataWrapper is readonly and cannot be modified."));
- }
- }
-
- operator CefRefPtr()
- {
- if (this == nullptr)
- {
- return NULL;
- }
- return _postData.get();
- }
-
- public:
- ///
- /// Default constructor.
- ///
- PostData()
- {
- _postData = CefPostData::Create();
- }
-
- ///
- /// Returns true if this object is read-only.
- ///
- virtual property bool IsReadOnly
- {
- bool get()
- {
- ThrowIfDisposed();
-
- return _postData->IsReadOnly();
- }
- }
-
- ///
- /// Retrieve the post data elements.
- ///
- virtual property IList^ Elements
- {
- IList^ get()
- {
- ThrowIfDisposed();
-
- if (_postDataElements == nullptr)
- {
- _postDataElements = gcnew List();
-
- auto elementCount = _postData.get() ? _postData->GetElementCount() : 0;
- if (elementCount == 0)
- {
- return gcnew ReadOnlyCollection(_postDataElements);
- }
- CefPostData::ElementVector ev;
-
- _postData->GetElements(ev);
-
- for (CefPostData::ElementVector::iterator it = ev.begin(); it != ev.end(); ++it)
- {
- CefPostDataElement *el = it->get();
-
- _postDataElements->Add(gcnew PostDataElement(el));
- }
- }
-
- return gcnew ReadOnlyCollection(_postDataElements);
- }
- }
-
- ///
- /// Add the specified .
- ///
- /// element to be added.
- /// Returns true if the add succeeds.
- virtual bool AddElement(IPostDataElement^ element)
- {
- ThrowIfDisposed();
-
- ThrowIfReadOnly();
-
- //Access the Elements collection to initialize the underlying _postDataElements collection
- auto elements = Elements;
-
- //If the element has already been added then don't add it again
- if (elements->Contains(element))
- {
- return false;
- }
-
- _postDataElements->Add(element);
-
- auto elementWrapper = (PostDataElement^)element;
-
- return _postData->AddElement(elementWrapper);
- }
-
- ///
- /// Remove the specified .
- ///
- /// element to be removed.
- /// Returns true if the add succeeds.
- virtual bool RemoveElement(IPostDataElement^ element)
- {
- ThrowIfDisposed();
-
- ThrowIfReadOnly();
-
- //Access the Elements collection to initialize the underlying _postDataElements collection
- auto elements = Elements;
-
- if (!elements->Contains(element))
- {
- return false;
- }
-
- _postDataElements->Remove(element);
-
- auto elementWrapper = (PostDataElement^)element;
-
- return _postData->RemoveElement(elementWrapper);
- }
-
- ///
- /// Remove all existing post data elements.
- ///
- virtual void RemoveElements()
- {
- ThrowIfDisposed();
-
- ThrowIfReadOnly();
-
- _postData->RemoveElements();
- }
-
- ///
- /// Create a new instance
- ///
- /// PostDataElement
- virtual IPostDataElement^ CreatePostDataElement()
- {
- auto element = CefPostDataElement::Create();
-
- return gcnew PostDataElement(element);
- }
-
- ///
- /// Returns true if the underlying POST data includes elements that are not
- /// represented by this IPostData object (for example, multi-part file upload
- /// data). Modifying IPostData objects with excluded elements may result in
- /// the request failing.
- ///
- virtual property bool HasExcludedElements
- {
- bool get()
- {
- ThrowIfDisposed();
-
- return _postData->HasExcludedElements();
- }
- }
- };
-}
diff --git a/CefSharp.Core/PostDataElement.h b/CefSharp.Core/PostDataElement.h
deleted file mode 100644
index 696f27309a..0000000000
--- a/CefSharp.Core/PostDataElement.h
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright © 2015 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#pragma once
-
-#include "Stdafx.h"
-
-#include "include\cef_request.h"
-#include "Internals\TypeConversion.h"
-#include "Internals\CefWrapper.h"
-
-using namespace System::Collections::Specialized;
-
-namespace CefSharp
-{
- public ref class PostDataElement : public IPostDataElement, public CefWrapper
- {
- MCefRefPtr _postDataElement;
- internal:
- PostDataElement(CefRefPtr postDataElement) :
- _postDataElement(postDataElement)
- {
-
- }
-
- !PostDataElement()
- {
- _postDataElement = nullptr;
- }
-
- ~PostDataElement()
- {
- this->!PostDataElement();
-
- _disposed = true;
- }
-
- operator CefRefPtr()
- {
- if (this == nullptr)
- {
- return NULL;
- }
- return _postDataElement.get();
- }
-
- public:
- PostDataElement()
- {
- _postDataElement = CefPostDataElement::Create();
- }
-
- virtual property bool IsReadOnly
- {
- bool get()
- {
- ThrowIfDisposed();
-
- return _postDataElement->IsReadOnly();
- }
- }
-
- virtual property String^ File
- {
- String^ get()
- {
- ThrowIfDisposed();
-
- return StringUtils::ToClr(_postDataElement->GetFile());
- }
- void set(String^ val)
- {
- ThrowIfDisposed();
-
- _postDataElement->SetToFile(StringUtils::ToNative(val));
- }
- }
-
- virtual void SetToEmpty()
- {
- ThrowIfDisposed();
-
- _postDataElement->SetToEmpty();
- }
-
- virtual property PostDataElementType Type
- {
- PostDataElementType get()
- {
- ThrowIfDisposed();
-
- return (PostDataElementType)_postDataElement->GetType();
- }
- }
-
- virtual property cli::array^ Bytes
- {
- cli::array^ get()
- {
- ThrowIfDisposed();
-
- auto byteCount = _postDataElement->GetBytesCount();
- if (byteCount == 0)
- {
- return nullptr;
- }
-
- auto bytes = gcnew cli::array(byteCount);
- pin_ptr src = &bytes[0]; // pin pointer to first element in arr
-
- _postDataElement->GetBytes(byteCount, static_cast(src));
-
- return bytes;
- }
- void set(cli::array^ val)
- {
- ThrowIfDisposed();
-
- pin_ptr src = &val[0];
- _postDataElement->SetToBytes(val->Length, static_cast(src));
- }
- }
- };
-}
diff --git a/CefSharp.Core.RefAssembly/Properties/AssemblyInfo.cs b/CefSharp.Core/Properties/AssemblyInfo.cs
similarity index 90%
rename from CefSharp.Core.RefAssembly/Properties/AssemblyInfo.cs
rename to CefSharp.Core/Properties/AssemblyInfo.cs
index 5c33df57cf..004e672505 100644
--- a/CefSharp.Core.RefAssembly/Properties/AssemblyInfo.cs
+++ b/CefSharp.Core/Properties/AssemblyInfo.cs
@@ -4,7 +4,7 @@
using CefSharp;
[assembly:AssemblyTitle("CefSharp.Core")]
-[assembly:AssemblyDescription("CefSharp Core Library (VC++)")]
+[assembly:AssemblyDescription("CefSharp Core Library")]
[assembly:AssemblyCompany(AssemblyInfo.AssemblyCompany)]
[assembly:AssemblyProduct(AssemblyInfo.AssemblyProduct)]
[assembly:AssemblyCopyright(AssemblyInfo.AssemblyCopyright)]
diff --git a/CefSharp.Core/PublicApi.cs b/CefSharp.Core/PublicApi.cs
new file mode 100644
index 0000000000..41ca4bb771
--- /dev/null
+++ b/CefSharp.Core/PublicApi.cs
@@ -0,0 +1,1504 @@
+// Copyright © 2020 The CefSharp Authors. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
+
+//NOTE:Classes in the CefSharp.Core namespace have been hidden from intellisnse so users don't use them directly
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Threading.Tasks;
+using CefSharp.Handler;
+using CefSharp.Internals;
+
+namespace CefSharp.BrowserSubprocess
+{
+ public class SelfHost
+ {
+ ///
+ /// This function should be called from the application entry point function (typically Program.Main)
+ /// to execute a secondary process e.g. gpu, plugin, renderer, utility
+ /// This overload is specifically used for .Net Core. For hosting your own BrowserSubProcess
+ /// it's preferable to use the Main method provided by this class.
+ /// - Pass in command line args
+ /// - To support High DPI Displays you should call Cef.EnableHighDPISupport before any other processing
+ /// or add the relevant entries to your app.manifest
+ ///
+ /// command line args
+ ///
+ /// If called for the browser process (identified by no "type" command-line value) it will return immediately
+ /// with a value of -1. If called for a recognized secondary process it will block until the process should exit
+ /// and then return the process exit code.
+ ///
+ public static int Main(string[] args)
+ {
+ var type = CommandLineArgsParser.GetArgumentValue(args, CefSharpArguments.SubProcessTypeArgument);
+
+ if (string.IsNullOrEmpty(type))
+ {
+ //If --type param missing from command line CEF/Chromium assums
+ //this is the main process (as all subprocesses must have a type param).
+ //Return -1 to indicate this behaviour.
+ return -1;
+ }
+
+ var browserSubprocessDllPath = Path.Combine(Path.GetDirectoryName(typeof(CefSharp.Core.BrowserSettings).Assembly.Location), "CefSharp.BrowserSubprocess.Core.dll");
+#if NETCOREAPP
+ var browserSubprocessDll = System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(browserSubprocessDllPath);
+#else
+ var browserSubprocessDll = System.Reflection.Assembly.LoadFrom(browserSubprocessDllPath);
+#endif
+ var browserSubprocessExecutableType = browserSubprocessDll.GetType("CefSharp.BrowserSubprocess.BrowserSubprocessExecutable");
+ var browserSubprocessExecutable = Activator.CreateInstance(browserSubprocessExecutableType);
+
+ var mainMethod = browserSubprocessExecutableType.GetMethod("MainSelfHost", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
+ var argCount = mainMethod.GetParameters();
+
+ var methodArgs = new object[] {args } ;
+
+ var exitCode = mainMethod.Invoke(null, methodArgs);
+
+ return (int)exitCode;
+ }
+ }
+}
+
+namespace CefSharp.Core
+{
+ public static class ObjectFactory
+ {
+ public static IBrowserSettings CreateBrowserSettings(bool autoDispose)
+ {
+ return new CefSharp.Core.BrowserSettings(autoDispose);
+ }
+
+ public static IWindowInfo CreateWindowInfo()
+ {
+ return new CefSharp.Core.WindowInfo();
+ }
+ }
+}
+
+//TODO: Split out into seperate classes
+namespace CefSharp
+{
+ ///
+ public class BrowserSettings : CefSharp.Core.BrowserSettings
+ {
+ ///
+ public BrowserSettings(bool autoDispose = false) : base(autoDispose)
+ {
+
+ }
+ }
+
+ ///
+ public static class Cef
+ {
+ public static TaskFactory UIThreadTaskFactory
+ {
+ get { return Core.Cef.UIThreadTaskFactory; }
+ }
+ public static TaskFactory IOThreadTaskFactory
+ {
+ get { return Core.Cef.IOThreadTaskFactory; }
+ }
+ public static TaskFactory FileThreadTaskFactory
+ {
+ get { return Core.Cef.FileThreadTaskFactory; }
+ }
+
+ public static void AddDisposable(IDisposable item)
+ {
+ Core.Cef.AddDisposable(item);
+ }
+
+ public static void RemoveDisposable(IDisposable item)
+ {
+ Core.Cef.RemoveDisposable(item);
+ }
+
+ /// Gets a value that indicates whether CefSharp is initialized.
+ /// true if CefSharp is initialized; otherwise, false.
+ public static bool IsInitialized
+ {
+ get { return Core.Cef.IsInitialized; }
+ }
+
+ /// Gets a value that indicates the version of CefSharp currently being used.
+ /// The CefSharp version.
+ public static string CefSharpVersion
+ {
+ get { return Core.Cef.CefSharpVersion; }
+ }
+
+ /// Gets a value that indicates the CEF version currently being used.
+ /// The CEF Version
+ public static string CefVersion
+ {
+ get { return Core.Cef.CefVersion; }
+ }
+
+ /// Gets a value that indicates the Chromium version currently being used.
+ /// The Chromium version.
+ public static string ChromiumVersion
+ {
+ get { return Core.Cef.ChromiumVersion; }
+ }
+
+ ///
+ /// Gets a value that indicates the Git Hash for CEF version currently being used.
+ ///
+ /// The Git Commit Hash
+ public static string CefCommitHash
+ {
+ get { return Core.Cef.CefCommitHash; }
+ }
+
+ ///
+ /// Initializes CefSharp with user-provided settings.
+ /// It's important to note that Initialize and Shutdown MUST be called on your main
+ /// application thread (typically the UI thread). If you call them on different
+ /// threads, your application will hang. See the documentation for Cef.Shutdown() for more details.
+ ///
+ /// CefSharp configuration settings.
+ /// true if successful; otherwise, false.
+ public static bool Initialize(CefSettingsBase cefSettings)
+ {
+ return Core.Cef.Initialize((CefSharp.Core.CefSettingsBase)cefSettings);
+ }
+
+ ///
+ /// Initializes CefSharp with user-provided settings.
+ /// It's important to note that Initialize/Shutdown MUST be called on your main
+ /// application thread (typically the UI thread). If you call them on different
+ /// threads, your application will hang. See the documentation for Cef.Shutdown() for more details.
+ ///
+ /// CefSharp configuration settings.
+ /// Check that all relevant dependencies available, throws exception if any are missing
+ /// true if successful; otherwise, false.
+ public static bool Initialize(CefSettingsBase cefSettings, bool performDependencyCheck)
+ {
+ return Core.Cef.Initialize((CefSharp.Core.CefSettingsBase)cefSettings, performDependencyCheck);
+ }
+
+ ///
+ /// Initializes CefSharp with user-provided settings.
+ /// It's important to note that Initialize/Shutdown MUST be called on your main
+ /// application thread (typically the UI thread). If you call them on different
+ /// threads, your application will hang. See the documentation for Cef.Shutdown() for more details.
+ ///
+ /// CefSharp configuration settings.
+ /// Check that all relevant dependencies available, throws exception if any are missing
+ /// The handler for functionality specific to the browser process. Null if you don't wish to handle these events
+ /// true if successful; otherwise, false.
+ public static bool Initialize(CefSettingsBase cefSettings, bool performDependencyCheck, IBrowserProcessHandler browserProcessHandler)
+ {
+ return Core.Cef.Initialize((CefSharp.Core.CefSettingsBase)cefSettings, performDependencyCheck, browserProcessHandler);
+ }
+
+ ///
+ /// Initializes CefSharp with user-provided settings.
+ /// It's important to note that Initialize/Shutdown MUST be called on your main
+ /// application thread (typically the UI thread). If you call them on different
+ /// threads, your application will hang. See the documentation for Cef.Shutdown() for more details.
+ ///
+ /// CefSharp configuration settings.
+ /// Check that all relevant dependencies available, throws exception if any are missing
+ /// Implement this interface to provide handler implementations. Null if you don't wish to handle these events
+ /// true if successful; otherwise, false.
+ public static bool Initialize(CefSettingsBase cefSettings, bool performDependencyCheck, IApp cefApp)
+ {
+ return Core.Cef.Initialize((CefSharp.Core.CefSettingsBase)cefSettings, performDependencyCheck, cefApp);
+ }
+
+ ///
+ /// Run the CEF message loop. Use this function instead of an application-
+ /// provided message loop to get the best balance between performance and CPU
+ /// usage. This function should only be called on the main application thread and
+ /// only if Cef.Initialize() is called with a
+ /// CefSettings.MultiThreadedMessageLoop value of false. This function will
+ /// block until a quit message is received by the system.
+ ///
+ public static void RunMessageLoop()
+ {
+ Core.Cef.RunMessageLoop();
+ }
+
+ ///
+ /// Quit the CEF message loop that was started by calling Cef.RunMessageLoop().
+ /// This function should only be called on the main application thread and only
+ /// if Cef.RunMessageLoop() was used.
+ ///
+ public static void QuitMessageLoop()
+ {
+ Core.Cef.QuitMessageLoop();
+ }
+
+ ///
+ /// Perform a single iteration of CEF message loop processing.This function is
+ /// provided for cases where the CEF message loop must be integrated into an
+ /// existing application message loop. Use of this function is not recommended
+ /// for most users; use CefSettings.MultiThreadedMessageLoop if possible (the default).
+ /// When using this function care must be taken to balance performance
+ /// against excessive CPU usage. It is recommended to enable the
+ /// CefSettings.ExternalMessagePump option when using
+ /// this function so that IBrowserProcessHandler.OnScheduleMessagePumpWork()
+ /// callbacks can facilitate the scheduling process. This function should only be
+ /// called on the main application thread and only if Cef.Initialize() is called
+ /// with a CefSettings.MultiThreadedMessageLoop value of false. This function
+ /// will not block.
+ ///
+ public static void DoMessageLoopWork()
+ {
+ Core.Cef.DoMessageLoopWork();
+ }
+
+ ///
+ /// This function should be called from the application entry point function to execute a secondary process.
+ /// It can be used to run secondary processes from the browser client executable (default behavior) or
+ /// from a separate executable specified by the CefSettings.browser_subprocess_path value.
+ /// If called for the browser process (identified by no "type" command-line value) it will return immediately with a value of -1.
+ /// If called for a recognized secondary process it will block until the process should exit and then return the process exit code.
+ /// The |application| parameter may be empty. The |windows_sandbox_info| parameter is only used on Windows and may be NULL (see cef_sandbox_win.h for details).
+ ///
+ public static int ExecuteProcess()
+ {
+ return Core.Cef.ExecuteProcess();
+ }
+
+ /// Add an entry to the cross-origin whitelist.
+ /// The origin allowed to be accessed by the target protocol/domain.
+ /// The target protocol allowed to access the source origin.
+ /// The optional target domain allowed to access the source origin.
+ /// If set to true would allow a blah.example.com if the
+ /// was set to example.com
+ ///
+ /// Returns false if is invalid or the whitelist cannot be accessed.
+ ///
+ /// The same-origin policy restricts how scripts hosted from different origins
+ /// (scheme + domain + port) can communicate. By default, scripts can only access
+ /// resources with the same origin. Scripts hosted on the HTTP and HTTPS schemes
+ /// (but no other schemes) can use the "Access-Control-Allow-Origin" header to
+ /// allow cross-origin requests. For example, https://source.example.com can make
+ /// XMLHttpRequest requests on http://target.example.com if the
+ /// http://target.example.com request returns an "Access-Control-Allow-Origin:
+ /// https://source.example.com" response header.
+ ///
+ /// Scripts in separate frames or iframes and hosted from the same protocol and
+ /// domain suffix can execute cross-origin JavaScript if both pages set the
+ /// document.domain value to the same domain suffix. For example,
+ /// scheme://foo.example.com and scheme://bar.example.com can communicate using
+ /// JavaScript if both domains set document.domain="example.com".
+ ///
+ /// This method is used to allow access to origins that would otherwise violate
+ /// the same-origin policy. Scripts hosted underneath the fully qualified
+ /// URL (like http://www.example.com) will be allowed access to
+ /// all resources hosted on the specified and .
+ /// If is non-empty and if false only
+ /// exact domain matches will be allowed. If contains a top-
+ /// level domain component (like "example.com") and is
+ /// true sub-domain matches will be allowed. If is empty and
+ /// if true all domains and IP addresses will be
+ /// allowed.
+ ///
+ /// This method cannot be used to bypass the restrictions on local or display
+ /// isolated schemes. See the comments on for more
+ /// information.
+ ///
+ /// This function may be called on any thread. Returns false if
+ /// is invalid or the whitelist cannot be accessed.
+ ///
+ public static bool AddCrossOriginWhitelistEntry(
+ string sourceOrigin,
+ string targetProtocol,
+ string targetDomain,
+ bool allowTargetSubdomains)
+ {
+ return Core.Cef.AddCrossOriginWhitelistEntry(
+ sourceOrigin,
+ targetProtocol,
+ targetDomain,
+ allowTargetSubdomains);
+ }
+
+ /// Remove entry from cross-origin whitelist
+ /// The origin allowed to be accessed by the target protocol/domain.
+ /// The target protocol allowed to access the source origin.
+ /// The optional target domain allowed to access the source origin.
+ /// If set to true would allow a blah.example.com if the
+ /// was set to example.com
+ ///
+ ///
+ /// Remove an entry from the cross-origin access whitelist. Returns false if
+ /// is invalid or the whitelist cannot be accessed.
+ ///
+ public static bool RemoveCrossOriginWhitelistEntry(string sourceOrigin,
+ string targetProtocol,
+ string targetDomain,
+ bool allowTargetSubdomains)
+
+ {
+ return Core.Cef.RemoveCrossOriginWhitelistEntry(
+ sourceOrigin,
+ targetProtocol,
+ targetDomain,
+ allowTargetSubdomains);
+ }
+
+ /// Remove all entries from the cross-origin access whitelist.
+ ///
+ /// Remove all entries from the cross-origin access whitelist. Returns false if
+ /// the whitelist cannot be accessed.
+ ///
+ public static bool ClearCrossOriginWhitelist()
+ {
+ return Core.Cef.ClearCrossOriginWhitelist();
+ }
+
+ ///
+ /// Returns the global cookie manager. By default data will be stored at CefSettings.CachePath if specified or in memory otherwise.
+ /// Using this method is equivalent to calling Cef.GetGlobalRequestContext().GetCookieManager()
+ /// The cookie managers storage is created in an async fashion, whilst this method may return a cookie manager instance,
+ /// there may be a short delay before you can Get/Write cookies.
+ /// To be sure the cookie manager has been initialized use one of the following
+ /// - Access the ICookieManager after ICompletionCallback.OnComplete has been called
+ /// - Access the ICookieManager instance in IBrowserProcessHandler.OnContextInitialized.
+ /// - Use the ChromiumWebBrowser BrowserInitialized (OffScreen) or IsBrowserInitializedChanged (WinForms/WPF) events.
+ ///
+ /// If non-NULL it will be executed asynchronously on the CEF UI thread after the manager's storage has been initialized.
+ /// A the global cookie manager or null if the RequestContext has not yet been initialized.
+ public static ICookieManager GetGlobalCookieManager(ICompletionCallback callback = null)
+ {
+
+
+ return Core.Cef.GetGlobalCookieManager(callback);
+ }
+
+ ///
+ /// Called prior to calling Cef.Shutdown, this disposes of any remaining
+ /// ChromiumWebBrowser instances. In WPF this is used from Dispatcher.ShutdownStarted
+ /// to release the unmanaged resources held by the ChromiumWebBrowser instances.
+ /// Generally speaking you don't need to call this yourself.
+ ///
+ public static void PreShutdown()
+ {
+ Core.Cef.PreShutdown();
+ }
+
+ ///
+ /// Shuts down CefSharp and the underlying CEF infrastructure. This method is safe to call multiple times; it will only
+ /// shut down CEF on the first call (all subsequent calls will be ignored).
+ /// This method should be called on the main application thread to shut down the CEF browser process before the application exits.
+ /// If you are Using CefSharp.OffScreen then you must call this explicitly before your application exits or it will hang.
+ /// This method must be called on the same thread as Initialize. If you don't call Shutdown explicitly then CefSharp.Wpf and CefSharp.WinForms
+ /// versions will do their best to call Shutdown for you, if your application is having trouble closing then call thus explicitly.
+ ///
+ public static void Shutdown()
+ {
+ Core.Cef.Shutdown();
+ }
+
+ ///
+ /// This method should only be used by advanced users, if you're unsure then use Cef.Shutdown().
+ /// This function should be called on the main application thread to shut down
+ /// the CEF browser process before the application exits. This method simply obtains a lock
+ /// and calls the native CefShutdown method, only IsInitialized is checked. All ChromiumWebBrowser
+ /// instances MUST be Disposed of before calling this method. If calling this method results in a crash
+ /// or hangs then you're likely hanging on to some unmanaged resources or haven't closed all of your browser
+ /// instances
+ ///
+ public static void ShutdownWithoutChecks()
+ {
+ Core.Cef.ShutdownWithoutChecks();
+ }
+
+ ///
+ /// Clear all scheme handler factories registered with the global request context.
+ /// Returns false on error. This function may be called on any thread in the browser process.
+ /// Using this function is equivalent to calling Cef.GetGlobalRequestContext().ClearSchemeHandlerFactories().
+ ///
+ /// Returns false on error.
+ public static bool ClearSchemeHandlerFactories()
+ {
+ return Core.Cef.ClearSchemeHandlerFactories();
+ }
+
+ ///
+ /// Visit web plugin information. Can be called on any thread in the browser process.
+ ///
+ public static void VisitWebPluginInfo(IWebPluginInfoVisitor visitor)
+ {
+ Core.Cef.VisitWebPluginInfo(visitor);
+ }
+
+ ///
+ /// Async returns a list containing Plugin Information
+ /// (Wrapper around CefVisitWebPluginInfo)
+ ///
+ /// Returns List of structs.
+ public static Task> GetPlugins()
+ {
+ return Core.Cef.GetPlugins();
+ }
+
+ ///
+ /// Cause the plugin list to refresh the next time it is accessed regardless of whether it has already been loaded.
+ ///
+ public static void RefreshWebPlugins()
+ {
+ Core.Cef.RefreshWebPlugins();
+ }
+
+ ///
+ /// Unregister an internal plugin. This may be undone the next time RefreshWebPlugins() is called.
+ ///
+ /// Path (directory + file).
+ public static void UnregisterInternalWebPlugin(string path)
+ {
+ Core.Cef.UnregisterInternalWebPlugin(path);
+ }
+
+ ///
+ /// Call during process startup to enable High-DPI support on Windows 7 or newer.
+ /// Older versions of Windows should be left DPI-unaware because they do not
+ /// support DirectWrite and GDI fonts are kerned very badly.
+ ///
+ public static void EnableHighDPISupport()
+ {
+ Core.Cef.EnableHighDPISupport();
+ }
+
+ ///
+ /// Returns true if called on the specified CEF thread.
+ ///
+ /// Returns true if called on the specified thread.
+ public static bool CurrentlyOnThread(CefThreadIds threadId)
+ {
+ return Core.Cef.CurrentlyOnThread(threadId);
+ }
+
+ ///
+ /// Gets the Global Request Context. Make sure to Dispose of this object when finished.
+ /// The earlier possible place to access the IRequestContext is in IBrowserProcessHandler.OnContextInitialized.
+ /// Alternative use the ChromiumWebBrowser BrowserInitialized (OffScreen) or IsBrowserInitializedChanged (WinForms/WPF) events.
+ ///
+ /// Returns the global request context or null if the RequestContext has not been initialized yet.
+ public static IRequestContext GetGlobalRequestContext()
+ {
+ return Core.Cef.GetGlobalRequestContext();
+ }
+
+ ///
+ /// Helper function (wrapper around the CefColorSetARGB macro) which combines
+ /// the 4 color components into an uint32 for use with BackgroundColor property
+ ///
+ /// Alpha
+ /// Red
+ /// Green
+ /// Blue
+ /// Returns the color.
+ public static UInt32 ColorSetARGB(UInt32 a, UInt32 r, UInt32 g, UInt32 b)
+ {
+ return Core.Cef.ColorSetARGB(a, r, g, b);
+ }
+
+ ///
+ /// Crash reporting is configured using an INI-style config file named
+ /// crash_reporter.cfg. This file must be placed next to
+ /// the main application executable. File contents are as follows:
+ ///
+ /// # Comments start with a hash character and must be on their own line.
+ ///
+ /// [Config]
+ /// ProductName=<Value of the "prod" crash key; defaults to "cef">
+ /// ProductVersion=<Value of the "ver" crash key; defaults to the CEF version>
+ /// AppName=<Windows only; App-specific folder name component for storing crash
+ /// information; default to "CEF">
+ /// ExternalHandler=<Windows only; Name of the external handler exe to use
+ /// instead of re-launching the main exe; default to empty>
+ /// ServerURL=<crash server URL; default to empty>
+ /// RateLimitEnabled=<True if uploads should be rate limited; default to true>
+ /// MaxUploadsPerDay=<Max uploads per 24 hours, used if rate limit is enabled;
+ /// default to 5>
+ /// MaxDatabaseSizeInMb=<Total crash report disk usage greater than this value
+ /// will cause older reports to be deleted; default to 20>
+ /// MaxDatabaseAgeInDays=<Crash reports older than this value will be deleted;
+ /// default to 5>
+ ///
+ /// [CrashKeys]
+ /// my_key1=<small|medium|large>
+ /// my_key2=<small|medium|large>
+ ///
+ /// Config section:
+ ///
+ /// If "ProductName" and/or "ProductVersion" are set then the specified values
+ /// will be included in the crash dump metadata.
+ ///
+ /// If "AppName" is set on Windows then crash report information (metrics,
+ /// database and dumps) will be stored locally on disk under the
+ /// "C:\Users\[CurrentUser]\AppData\Local\[AppName]\User Data" folder.
+ ///
+ /// If "ExternalHandler" is set on Windows then the specified exe will be
+ /// launched as the crashpad-handler instead of re-launching the main process
+ /// exe. The value can be an absolute path or a path relative to the main exe
+ /// directory.
+ ///
+ /// If "ServerURL" is set then crashes will be uploaded as a multi-part POST
+ /// request to the specified URL. Otherwise, reports will only be stored locally
+ /// on disk.
+ ///
+ /// If "RateLimitEnabled" is set to true then crash report uploads will be rate
+ /// limited as follows:
+ /// 1. If "MaxUploadsPerDay" is set to a positive value then at most the
+ /// specified number of crashes will be uploaded in each 24 hour period.
+ /// 2. If crash upload fails due to a network or server error then an
+ /// incremental backoff delay up to a maximum of 24 hours will be applied for
+ /// retries.
+ /// 3. If a backoff delay is applied and "MaxUploadsPerDay" is > 1 then the
+ /// "MaxUploadsPerDay" value will be reduced to 1 until the client is
+ /// restarted. This helps to avoid an upload flood when the network or
+ /// server error is resolved.
+ ///
+ /// If "MaxDatabaseSizeInMb" is set to a positive value then crash report storage
+ /// on disk will be limited to that size in megabytes. For example, on Windows
+ /// each dump is about 600KB so a "MaxDatabaseSizeInMb" value of 20 equates to
+ /// about 34 crash reports stored on disk.
+ ///
+ /// If "MaxDatabaseAgeInDays" is set to a positive value then crash reports older
+ /// than the specified age in days will be deleted.
+ ///
+ /// CrashKeys section:
+ ///
+ /// Any number of crash keys can be specified for use by the application. Crash
+ /// key values will be truncated based on the specified size (small = 63 bytes,
+ /// medium = 252 bytes, large = 1008 bytes). The value of crash keys can be set
+ /// from any thread or process using the Cef.SetCrashKeyValue function. These
+ /// key/value pairs will be sent to the crash server along with the crash dump
+ /// file. Medium and large values will be chunked for submission. For example,
+ /// if your key is named "mykey" then the value will be broken into ordered
+ /// chunks and submitted using keys named "mykey-1", "mykey-2", etc.
+ ///
+ /// Returns true if crash reporting is enabled.
+ public static bool CrashReportingEnabled
+ {
+ get { return Core.Cef.CrashReportingEnabled; }
+ }
+
+ ///
+ /// Sets or clears a specific key-value pair from the crash metadata.
+ ///
+ public static void SetCrashKeyValue(string c, string value)
+ {
+ Core.Cef.SetCrashKeyValue(value, value);
+ }
+
+ ///
+ /// Register the Widevine CDM plugin.
+ ///
+ /// The client application is responsible for downloading an appropriate
+ /// platform-specific CDM binary distribution from Google, extracting the
+ /// contents, and building the required directory structure on the local machine.
+ /// The method class can be used
+ /// to implement this functionality in CefSharp. Contact Google via
+ /// https://www.widevine.com/contact.html for details on CDM download.
+ ///
+ ///
+ /// path is a directory that must contain the following files:
+ /// 1. manifest.json file from the CDM binary distribution (see below).
+ /// 2. widevinecdm file from the CDM binary distribution (e.g.
+ /// widevinecdm.dll on Windows).
+ /// 3. widevidecdmadapter file from the CEF binary distribution (e.g.
+ /// widevinecdmadapter.dll on Windows).
+ ///
+ /// If any of these files are missing or if the manifest file has incorrect
+ /// contents the registration will fail and callback will receive an ErrorCode
+ /// value of .
+ ///
+ /// The manifest.json file must contain the following keys:
+ /// A. "os": Supported OS (e.g. "mac", "win" or "linux").
+ /// B. "arch": Supported architecture (e.g. "ia32" or "x64").
+ /// C. "x-cdm-module-versions": Module API version (e.g. "4").
+ /// D. "x-cdm-interface-versions": Interface API version (e.g. "8").
+ /// E. "x-cdm-host-versions": Host API version (e.g. "8").
+ /// F. "version": CDM version (e.g. "1.4.8.903").
+ /// G. "x-cdm-codecs": List of supported codecs (e.g. "vp8,vp9.0,avc1").
+ ///
+ /// A through E are used to verify compatibility with the current Chromium
+ /// version. If the CDM is not compatible the registration will fail and
+ /// callback will receive an ErrorCode value of .
+ ///
+ /// If registration is not supported at the time that Cef.RegisterWidevineCdm() is called then callback
+ /// will receive an ErrorCode value of .
+ ///
+ /// is a directory that contains the Widevine CDM files
+ /// optional callback -
+ /// will be executed asynchronously once registration is complete
+ public static void RegisterWidevineCdm(string path, IRegisterCdmCallback callback = null)
+ {
+ Core.Cef.RegisterWidevineCdm(path, callback);
+ }
+
+ ///
+ /// Register the Widevine CDM plugin.
+ ///
+ /// See for more details.
+ ///
+ /// is a directory that contains the Widevine CDM files
+ /// Returns a Task that can be awaited to receive the response.
+ public static Task RegisterWidevineCdmAsync(string path)
+ {
+ return Core.Cef.RegisterWidevineCdmAsync(path);
+ }
+
+ ///
+ /// Returns the mime type for the specified file extension or an empty string if unknown.
+ ///
+ /// file extension
+ /// Returns the mime type for the specified file extension or an empty string if unknown.
+ public static string GetMimeType(string extension)
+ {
+ return Core.Cef.GetMimeType(extension);
+ }
+
+ ///
+ /// WaitForBrowsersToClose is not enabled by default, call this method
+ /// before Cef.Initialize to enable. If you aren't calling Cef.Initialize
+ /// explicitly then this should be called before creating your first
+ /// ChromiumWebBrowser instance.
+ ///
+ public static void EnableWaitForBrowsersToClose()
+ {
+ Core.Cef.EnableWaitForBrowsersToClose();
+ }
+
+ ///
+ /// Helper method to ensure all ChromiumWebBrowser instances have been
+ /// closed/disposed, should be called before Cef.Shutdown.
+ /// Disposes all remaining ChromiumWebBrowser instances
+ /// then waits for CEF to release its remaining CefBrowser instances.
+ /// Finally a small delay of 50ms to allow for CEF to finish it's cleanup.
+ /// Should only be called when MultiThreadedMessageLoop = true;
+ /// (Hasn't been tested when when CEF integrates into main message loop).
+ ///
+ public static void WaitForBrowsersToClose()
+ {
+ Core.Cef.WaitForBrowsersToClose();
+ }
+ }
+
+ ///
+ public abstract class CefSettingsBase
+ {
+ internal Core.CefSettingsBase settings = new Core.CefSettingsBase();
+
+#if NETCOREAPP
+ public CefSettingsBase() : base()
+ {
+ if(!File.Exists(BrowserSubprocessPath))
+ {
+ var libCefLoadStatus = Initializer.LibCefLoadStatus;
+ if(libCefLoadStatus.Loaded)
+ {
+ BrowserSubprocessPath = libCefLoadStatus.BrowserSubProcessPath;
+ }
+ }
+ }
+#endif
+
+ public static explicit operator CefSharp.Core.CefSettingsBase(CefSettingsBase s)
+ {
+ return s.settings;
+ }
+
+ ///
+ /// Add Customs schemes to this collection.
+ ///
+ public IEnumerable CefCustomSchemes
+ {
+ get { return settings.CefCustomSchemes; }
+ }
+
+ ///
+ /// Add custom command line argumens to this collection, they will be added in OnBeforeCommandLineProcessing. The
+ /// CefSettings.CommandLineArgsDisabled value can be used to start with an empty command-line object. Any values specified in
+ /// CefSettings that equate to command-line arguments will be set before this method is called.
+ ///
+ public CommandLineArgDictionary CefCommandLineArgs
+ {
+ get { return settings.CefCommandLineArgs; }
+ }
+
+ ///
+ /// Set to true to disable configuration of browser process features using standard CEF and Chromium command-line arguments.
+ /// Configuration can still be specified using CEF data structures or by adding to CefCommandLineArgs.
+ ///
+ public bool CommandLineArgsDisabled
+ {
+ get { return settings.CommandLineArgsDisabled; }
+ set { settings.CommandLineArgsDisabled = value; }
+ }
+
+ ///
+ /// Set to true to control browser process main (UI) thread message pump scheduling via the
+ /// IBrowserProcessHandler.OnScheduleMessagePumpWork callback. This option is recommended for use in combination with the
+ /// Cef.DoMessageLoopWork() function in cases where the CEF message loop must be integrated into an existing application message
+ /// loop (see additional comments and warnings on Cef.DoMessageLoopWork). Enabling this option is not recommended for most users;
+ /// leave this option disabled and use either MultiThreadedMessageLoop (the default) if possible.
+ ///
+ public bool ExternalMessagePump
+ {
+ get { return settings.ExternalMessagePump; }
+ set { settings.ExternalMessagePump = value; }
+ }
+
+ ///
+ /// Set to true to have the browser process message loop run in a separate thread. If false than the CefDoMessageLoopWork()
+ /// function must be called from your application message loop. This option is only supported on Windows. The default value is
+ /// true.
+ ///
+ public bool MultiThreadedMessageLoop
+ {
+ get { return settings.MultiThreadedMessageLoop; }
+ set { settings.MultiThreadedMessageLoop = value; }
+ }
+
+ ///
+ /// The path to a separate executable that will be launched for sub-processes. By default the browser process executable is used.
+ /// See the comments on Cef.ExecuteProcess() for details. If this value is non-empty then it must be an absolute path.
+ /// Also configurable using the "browser-subprocess-path" command-line switch.
+ /// Defaults to using the provided CefSharp.BrowserSubprocess.exe instance
+ ///
+ public string BrowserSubprocessPath
+ {
+ get { return settings.BrowserSubprocessPath; }
+ set { settings.BrowserSubprocessPath = value; }
+ }
+
+ ///
+ /// The location where data for the global browser cache will be stored on disk. In this value is non-empty then it must be
+ /// an absolute path that is must be either equal to or a child directory of CefSettings.RootCachePath (if RootCachePath is
+ /// empty it will default to this value). If the value is empty then browsers will be created in "incognito mode" where
+ /// in-memory caches are used for storage and no data is persisted to disk. HTML5 databases such as localStorage will only
+ /// persist across sessions if a cache path is specified. Can be overridden for individual RequestContext instances via the
+ /// RequestContextSettings.CachePath value.
+ ///
+ public string CachePath
+ {
+ get { return settings.CachePath; }
+ set { settings.CachePath = value; }
+ }
+
+ ///
+ /// The root directory that all CefSettings.CachePath and RequestContextSettings.CachePath values must have in common. If this
+ /// value is empty and CefSettings.CachePath is non-empty then it will default to the CefSettings.CachePath value.
+ /// If this value is non-empty then it must be an absolute path. Failure to set this value correctly may result in the sandbox
+ /// blocking read/write access to the CachePath directory. NOTE: CefSharp does not implement the CHROMIUM SANDBOX. A non-empty
+ /// RootCachePath can be used in conjuncation with an empty CefSettings.CachePath in instances where you would like browsers
+ /// attached to the Global RequestContext (the default) created in "incognito mode" and instances created with a custom
+ /// RequestContext using a disk based cache.
+ ///
+ public string RootCachePath
+ {
+ get { return settings.RootCachePath; }
+ set { settings.RootCachePath = value; }
+ }
+
+ ///
+ /// The location where user data such as spell checking dictionary files will be stored on disk. If this value is empty then the
+ /// default user data directory will be used ("Local Settings\Application Data\CEF\User Data" directory under the user
+ /// profile directory on Windows). If this value is non-empty then it must be an absolute path.
+ ///
+ public string UserDataPath
+ {
+ get { return settings.UserDataPath; }
+ set { settings.UserDataPath = value; }
+ }
+
+ ///
+ /// Set to true in order to completely ignore SSL certificate errors. This is NOT recommended.
+ ///
+ public bool IgnoreCertificateErrors
+ {
+ get { return settings.IgnoreCertificateErrors; }
+ set { settings.IgnoreCertificateErrors = value; }
+ }
+
+ ///
+ /// The locale string that will be passed to WebKit. If empty the default locale of "en-US" will be used. Also configurable using
+ /// the "lang" command-line switch.
+ ///
+ public string Locale
+ {
+ get { return settings.Locale; }
+ set { settings.Locale = value; }
+ }
+
+ ///
+ /// The fully qualified path for the locales directory. If this value is empty the locales directory must be located in the
+ /// module directory. If this value is non-empty then it must be an absolute path. Also configurable using the "locales-dir-path"
+ /// command-line switch.
+ ///
+ public string LocalesDirPath
+ {
+ get { return settings.LocalesDirPath; }
+ set { settings.LocalesDirPath = value; }
+ }
+
+ ///
+ /// The fully qualified path for the resources directory. If this value is empty the cef.pak and/or devtools_resources.pak files
+ /// must be located in the module directory. Also configurable using the "resources-dir-path" command-line switch.
+ ///
+ public string ResourcesDirPath
+ {
+ get { return settings.ResourcesDirPath; }
+ set { settings.ResourcesDirPath = value; }
+ }
+
+ ///
+ /// The directory and file name to use for the debug log. If empty a default log file name and location will be used. On Windows
+ /// a "debug.log" file will be written in the main executable directory. Also configurable using the"log-file" command- line
+ /// switch.
+ ///
+ public string LogFile
+ {
+ get { return settings.LogFile; }
+ set { settings.LogFile = value; }
+ }
+
+ ///
+ /// The log severity. Only messages of this severity level or higher will be logged. When set to
+ /// no messages will be written to the log file, but Fatal messages will still be
+ /// output to stderr. Also configurable using the "log-severity" command-line switch with a value of "verbose", "info", "warning",
+ /// "error", "fatal", "error-report" or "disable".
+ ///
+ public CefSharp.LogSeverity LogSeverity
+ {
+ get { return settings.LogSeverity; }
+ set { settings.LogSeverity = value; }
+ }
+
+ ///
+ /// Custom flags that will be used when initializing the V8 JavaScript engine. The consequences of using custom flags may not be
+ /// well tested. Also configurable using the "js-flags" command-line switch.
+ ///
+ public string JavascriptFlags
+ {
+ get { return settings.JavascriptFlags; }
+ set { settings.JavascriptFlags = value; }
+ }
+
+ ///
+ /// Set to true to disable loading of pack files for resources and locales. A resource bundle handler must be provided for the
+ /// browser and render processes via CefApp.GetResourceBundleHandler() if loading of pack files is disabled. Also configurable
+ /// using the "disable-pack-loading" command- line switch.
+ ///
+ public bool PackLoadingDisabled
+ {
+ get { return settings.PackLoadingDisabled; }
+ set { settings.PackLoadingDisabled = value; }
+ }
+
+ ///
+ /// Value that will be inserted as the product portion of the default User-Agent string. If empty the Chromium product version
+ /// will be used. If UserAgent is specified this value will be ignored. Also configurable using the "product-version" command-
+ /// line switch.
+ ///
+ public string ProductVersion
+ {
+ get { return settings.ProductVersion; }
+ set { settings.ProductVersion = value; }
+ }
+
+ ///
+ /// Set to a value between 1024 and 65535 to enable remote debugging on the specified port. For example, if 8080 is specified the
+ /// remote debugging URL will be http://localhost:8080. CEF can be remotely debugged from any CEF or Chrome browser window. Also
+ /// configurable using the "remote-debugging-port" command-line switch.
+ ///
+ public int RemoteDebuggingPort
+ {
+ get { return settings.RemoteDebuggingPort; }
+ set { settings.RemoteDebuggingPort = value; }
+ }
+
+ ///
+ /// The number of stack trace frames to capture for uncaught exceptions. Specify a positive value to enable the
+ /// CefRenderProcessHandler. OnUncaughtException() callback. Specify 0 (default value) and OnUncaughtException() will not be
+ /// called. Also configurable using the "uncaught-exception-stack-size" command-line switch.
+ ///
+ public int UncaughtExceptionStackSize
+ {
+ get { return settings.UncaughtExceptionStackSize; }
+ set { settings.UncaughtExceptionStackSize = value; }
+ }
+
+ ///
+ /// Value that will be returned as the User-Agent HTTP header. If empty the default User-Agent string will be used. Also
+ /// configurable using the "user-agent" command-line switch.
+ ///
+ public string UserAgent
+ {
+ get { return settings.UserAgent; }
+ set { settings.UserAgent = value; }
+ }
+
+ ///
+ /// Set to true (1) to enable windowless (off-screen) rendering support. Do not enable this value if the application does not use
+ /// windowless rendering as it may reduce rendering performance on some systems.
+ ///
+ public bool WindowlessRenderingEnabled
+ {
+ get { return settings.WindowlessRenderingEnabled; }
+ set { settings.WindowlessRenderingEnabled = value; }
+ }
+
+ ///
+ /// To persist session cookies (cookies without an expiry date or validity interval) by default when using the global cookie
+ /// manager set this value to true. Session cookies are generally intended to be transient and most Web browsers do not persist
+ /// them. A CachePath value must also be specified to enable this feature. Also configurable using the "persist-session-cookies"
+ /// command-line switch. Can be overridden for individual RequestContext instances via the
+ /// RequestContextSettings.PersistSessionCookies value.
+ ///
+ public bool PersistSessionCookies
+ {
+ get { return settings.PersistSessionCookies; }
+ set { settings.PersistSessionCookies = value; }
+ }
+
+ ///
+ /// To persist user preferences as a JSON file in the cache path directory set this value to true. A CachePath value must also be
+ /// specified to enable this feature. Also configurable using the "persist-user-preferences" command-line switch. Can be
+ /// overridden for individual RequestContext instances via the RequestContextSettings.PersistUserPreferences value.
+ ///
+ public bool PersistUserPreferences
+ {
+ get { return settings.PersistUserPreferences; }
+ set { settings.PersistUserPreferences = value; }
+ }
+
+ ///
+ /// Comma delimited ordered list of language codes without any whitespace that will be used in the "Accept-Language" HTTP header.
+ /// May be set globally using the CefSettings.AcceptLanguageList value. If both values are empty then "en-US,en" will be used.
+ ///
+ ///
+ public string AcceptLanguageList
+ {
+ get { return settings.AcceptLanguageList; }
+ set { settings.AcceptLanguageList = value; }
+ }
+
+ ///
+ /// Background color used for the browser before a document is loaded and when no document color is specified. The alpha
+ /// component must be either fully opaque (0xFF) or fully transparent (0x00). If the alpha component is fully opaque then the RGB
+ /// components will be used as the background color. If the alpha component is fully transparent for a WinForms browser then the
+ /// default value of opaque white be used. If the alpha component is fully transparent for a windowless (WPF/OffScreen) browser
+ /// then transparent painting will be enabled.
+ ///
+ public UInt32 BackgroundColor
+ {
+ get { return settings.BackgroundColor; }
+ set { settings.BackgroundColor = value; }
+ }
+
+ ///
+ /// GUID string used for identifying the application. This is passed to the system AV function for scanning downloaded files. By
+ /// default, the GUID will be an empty string and the file will be treated as an untrusted file when the GUID is empty.
+ ///
+ public string ApplicationClientIdForFileScanning
+ {
+ get { return settings.ApplicationClientIdForFileScanning; }
+ set { settings.ApplicationClientIdForFileScanning = value; }
+ }
+
+ ///
+ /// Registers a custom scheme using the provided settings.
+ ///
+ /// The CefCustomScheme which provides the details about the scheme.
+ public void RegisterScheme(CefCustomScheme scheme)
+ {
+ settings.RegisterScheme(scheme);
+ }
+
+ ///
+ /// Set command line argument to disable GPU Acceleration. WebGL will use
+ /// software rendering via Swiftshader (https://swiftshader.googlesource.com/SwiftShader#introduction)
+ ///
+ public void DisableGpuAcceleration()
+ {
+ if (!settings.CefCommandLineArgs.ContainsKey("disable-gpu"))
+ {
+ settings.CefCommandLineArgs.Add("disable-gpu");
+ }
+ }
+
+ ///
+ /// Set command line argument to enable Print Preview See
+ /// https://bitbucket.org/chromiumembedded/cef/issues/123/add-support-for-print-preview for details.
+ ///
+ public void EnablePrintPreview()
+ {
+ if (!settings.CefCommandLineArgs.ContainsKey("enable-print-preview"))
+ {
+ settings.CefCommandLineArgs.Add("enable-print-preview");
+ }
+ }
+
+ ///
+ /// Set command line arguments for best OSR (Offscreen and WPF) Rendering performance Swiftshader will be used for WebGL, look at the source
+ /// to determine which flags best suite your requirements. See https://swiftshader.googlesource.com/SwiftShader#introduction for
+ /// details on Swiftshader
+ ///
+ public void SetOffScreenRenderingBestPerformanceArgs()
+ {
+ // Use software rendering and compositing (disable GPU) for increased FPS
+ // and decreased CPU usage.
+ // See https://bitbucket.org/chromiumembedded/cef/issues/1257 for details.
+ if (!settings.CefCommandLineArgs.ContainsKey("disable-gpu"))
+ {
+ settings.CefCommandLineArgs.Add("disable-gpu");
+ }
+
+ if (!settings.CefCommandLineArgs.ContainsKey("disable-gpu-compositing"))
+ {
+ settings.CefCommandLineArgs.Add("disable-gpu-compositing");
+ }
+
+ // Synchronize the frame rate between all processes. This results in
+ // decreased CPU usage by avoiding the generation of extra frames that
+ // would otherwise be discarded. The frame rate can be set at browser
+ // creation time via IBrowserSettings.WindowlessFrameRate or changed
+ // dynamically using IBrowserHost.SetWindowlessFrameRate. In cefclient
+ // it can be set via the command-line using `--off-screen-frame-rate=XX`.
+ // See https://bitbucket.org/chromiumembedded/cef/issues/1368 for details.
+ if (!settings.CefCommandLineArgs.ContainsKey("enable-begin-frame-scheduling"))
+ {
+ settings.CefCommandLineArgs.Add("enable-begin-frame-scheduling");
+ }
+ }
+ }
+
+ ///
+ /// Create instance via
+ /// This is the primary object for bridging the ChromiumWebBrowser implementation and VC++
+ ///
+ public static class ManagedCefBrowserAdapter
+ {
+ public static IBrowserAdapter Create(IWebBrowserInternal webBrowserInternal, bool offScreenRendering)
+ {
+ return new CefSharp.Core.ManagedCefBrowserAdapter(webBrowserInternal, offScreenRendering);
+ }
+ }
+
+ ///
+ public static class NativeMethodWrapper
+ {
+ public static void MemoryCopy(IntPtr dest, IntPtr src, int numberOfBytes)
+ {
+ CefSharp.Core.NativeMethodWrapper.MemoryCopy(dest, src, numberOfBytes);
+ }
+
+ public static bool IsFocused(IntPtr handle)
+ {
+ return CefSharp.Core.NativeMethodWrapper.IsFocused(handle);
+ }
+
+ public static void SetWindowPosition(IntPtr handle, int x, int y, int width, int height)
+ {
+ CefSharp.Core.NativeMethodWrapper.SetWindowPosition(handle, x, y, width, height);
+ }
+
+ public static void SetWindowParent(IntPtr child, IntPtr newParent)
+ {
+ CefSharp.Core.NativeMethodWrapper.SetWindowParent(child, newParent);
+ }
+
+ public static void RemoveExNoActivateStyle(IntPtr browserHwnd)
+ {
+ CefSharp.Core.NativeMethodWrapper.RemoveExNoActivateStyle(browserHwnd);
+ }
+ }
+
+ ///
+ public class PostData : CefSharp.Core.PostData
+ {
+
+ }
+
+ ///
+ public class PostDataElement : CefSharp.Core.PostDataElement
+ {
+
+ }
+
+ ///
+ public class Request : CefSharp.Core.Request
+ {
+
+ }
+
+ ///
+ public class RequestContext : CefSharp.Core.RequestContext
+ {
+ ///
+ public RequestContext() : base()
+ {
+ }
+
+ ///
+ public RequestContext(CefSharp.IRequestContext otherRequestContext) : base(otherRequestContext)
+ {
+
+ }
+
+ ///
+ public RequestContext(CefSharp.IRequestContext otherRequestContext, CefSharp.IRequestContextHandler requestContextHandler) : base(otherRequestContext, requestContextHandler)
+ {
+ }
+
+ ///
+ public RequestContext(CefSharp.IRequestContextHandler requestContextHandler) : base(requestContextHandler)
+ {
+ }
+
+ ///
+ public RequestContext(CefSharp.RequestContextSettings settings) : base(settings.settings)
+ {
+
+ }
+
+ ///
+ public RequestContext(CefSharp.RequestContextSettings settings, CefSharp.IRequestContextHandler requestContextHandler) : base(settings.settings, requestContextHandler)
+ {
+ }
+
+ ///
+ /// Creates a new RequestContextBuilder which can be used to fluently set
+ /// preferences
+ ///
+ /// Returns a new RequestContextBuilder
+ public static RequestContextBuilder Configure()
+ {
+ var builder = new RequestContextBuilder();
+
+ return builder;
+ }
+ }
+
+ ///
+ /// Fluent style builder for creating IRequestContext instances.
+ ///
+ public class RequestContextBuilder
+ {
+ private RequestContextSettings _settings;
+ private IRequestContext _otherContext;
+ private RequestContextHandler _handler;
+
+ void ThrowExceptionIfContextAlreadySet()
+ {
+ if (_otherContext != null)
+ {
+ throw new Exception("A call to WithSharedSettings has already been made, it is no possible to provide custom settings.");
+ }
+ }
+
+ void ThrowExceptionIfCustomSettingSpecified()
+ {
+ if (_settings != null)
+ {
+ throw new Exception("A call to WithCachePath/PersistUserPreferences has already been made, it's not possible to share settings with another RequestContext.");
+ }
+ }
+ ///
+ /// Create the actual RequestContext instance
+ ///
+ /// Returns a new RequestContext instance.
+ public IRequestContext Create()
+ {
+ if (_otherContext != null)
+ {
+ return new CefSharp.Core.RequestContext(_otherContext, _handler);
+ }
+
+ if (_settings != null)
+ {
+ return new CefSharp.Core.RequestContext(_settings.settings, _handler);
+ }
+
+ return new CefSharp.Core.RequestContext(_handler);
+ }
+
+ ///
+ /// Action is called in IRequestContextHandler.OnRequestContextInitialized
+ ///
+ /// called when the context has been initialized.
+ /// Returns RequestContextBuilder instance
+ public RequestContextBuilder OnInitialize(Action action)
+ {
+ if (_handler == null)
+ {
+ _handler = new RequestContextHandler();
+ }
+
+ _handler.OnInitialize(action);
+
+ return this;
+ }
+
+ ///
+ /// Sets the Cache Path
+ ///
+ ///
+ /// The location where cache data for this request context will be stored on
+ /// disk. If this value is non-empty then it must be an absolute path that is
+ /// either equal to or a child directory of CefSettings.RootCachePath.
+ /// If the value is empty then browsers will be created in "incognito mode"
+ /// where in-memory caches are used for storage and no data is persisted to disk.
+ /// HTML5 databases such as localStorage will only persist across sessions if a
+ /// cache path is specified. To share the global browser cache and related
+ /// configuration set this value to match the CefSettings.CachePath value.
+ ///
+ /// Returns RequestContextBuilder instance
+ public RequestContextBuilder WithCachePath(string cachePath)
+ {
+ ThrowExceptionIfContextAlreadySet();
+
+ if (_settings == null)
+ {
+ _settings = new RequestContextSettings();
+ }
+
+ _settings.CachePath = cachePath;
+
+ return this;
+ }
+
+ ///
+ /// Invoke this method tp persist user preferences as a JSON file in the cache path directory.
+ /// Can be set globally using the CefSettings.PersistUserPreferences value.
+ /// This value will be ignored if CachePath is empty or if it matches the CefSettings.CachePath value.
+ ///
+ /// Returns RequestContextBuilder instance
+ public RequestContextBuilder PersistUserPreferences()
+ {
+ ThrowExceptionIfContextAlreadySet();
+
+ if (_settings == null)
+ {
+ _settings = new RequestContextSettings();
+ }
+
+ _settings.PersistUserPreferences = true;
+
+ return this;
+ }
+
+ ///
+ /// Set the value associated with preference name when the RequestContext
+ /// is initialzied. If value is null the preference will be restored to its
+ /// default value. If setting the preference fails no error is throw, you
+ /// must check the CEF Log file.
+ /// Preferences set via the command-line usually cannot be modified.
+ ///
+ /// preference key
+ /// preference value
+ /// Returns RequestContextBuilder instance
+ public RequestContextBuilder WithPreference(string name, object value)
+ {
+ if (_handler == null)
+ {
+ _handler = new RequestContextHandler();
+ }
+
+ _handler.SetPreferenceOnContextInitialized(name, value);
+
+ return this;
+ }
+
+ ///
+ /// Set the Proxy server when the RequestContext is initialzied.
+ /// If value is null the preference will be restored to its
+ /// default value. If setting the preference fails no error is throw, you
+ /// must check the CEF Log file.
+ /// Proxy set via the command-line cannot be modified.
+ ///
+ /// proxy host
+ /// Returns RequestContextBuilder instance
+ public RequestContextBuilder WithProxyServer(string host)
+ {
+ if (_handler == null)
+ {
+ _handler = new RequestContextHandler();
+ }
+
+ _handler.SetProxyOnContextInitialized(host, null);
+
+ return this;
+ }
+
+ ///
+ /// Set the Proxy server when the RequestContext is initialzied.
+ /// If value is null the preference will be restored to its
+ /// default value. If setting the preference fails no error is throw, you
+ /// must check the CEF Log file.
+ /// Proxy set via the command-line cannot be modified.
+ ///
+ /// proxy host
+ /// proxy port (optional)
+ /// Returns RequestContextBuilder instance
+ public RequestContextBuilder WithProxyServer(string host, int? port)
+ {
+ if (_handler == null)
+ {
+ _handler = new RequestContextHandler();
+ }
+
+ _handler.SetProxyOnContextInitialized(host, port);
+
+ return this;
+ }
+
+ ///
+ /// Set the Proxy server when the RequestContext is initialzied.
+ /// If value is null the preference will be restored to its
+ /// default value. If setting the preference fails no error is throw, you
+ /// must check the CEF Log file.
+ /// Proxy set via the command-line cannot be modified.
+ ///
+ /// proxy scheme
+ /// proxy host
+ /// proxy port (optional)
+ /// Returns RequestContextBuilder instance
+ public RequestContextBuilder WithProxyServer(string scheme, string host, int? port)
+ {
+ if (_handler == null)
+ {
+ _handler = new RequestContextHandler();
+ }
+
+ _handler.SetProxyOnContextInitialized(scheme, host, port);
+
+ return this;
+ }
+
+ ///
+ /// Shares storage with other RequestContext
+ ///
+ /// shares storage with this RequestContext
+ /// Returns RequestContextBuilder instance
+ public RequestContextBuilder WithSharedSettings(IRequestContext other)
+ {
+ if (other == null)
+ {
+ throw new ArgumentNullException("other");
+ }
+
+ ThrowExceptionIfCustomSettingSpecified();
+
+ _otherContext = other;
+
+ return this;
+ }
+ }
+
+ ///
+ public class RequestContextSettings
+ {
+ internal Core.RequestContextSettings settings = new Core.RequestContextSettings();
+
+ ///
+ /// To persist session cookies (cookies without an expiry date or validity
+ /// interval) by default when using the global cookie manager set this value to
+ /// true. Session cookies are generally intended to be transient and most
+ /// Web browsers do not persist them. Can be set globally using the
+ /// CefSettings.PersistSessionCookies value. This value will be ignored if
+ /// CachePath is empty or if it matches the CefSettings.CachePath value.
+ ///
+ public bool PersistSessionCookies
+ {
+ get { return settings.PersistSessionCookies; }
+ set { settings.PersistSessionCookies = value; }
+ }
+
+ ///
+ /// To persist user preferences as a JSON file in the cache path directory set
+ /// this value to true. Can be set globally using the
+ /// CefSettings.PersistUserPreferences value. This value will be ignored if
+ /// CachePath is empty or if it matches the CefSettings.CachePath value.
+ ///
+ public bool PersistUserPreferences
+ {
+ get { return settings.PersistUserPreferences; }
+ set { settings.PersistUserPreferences = value; }
+ }
+
+ ///
+ /// The location where cache data for this request context will be stored on
+ /// disk. If this value is non-empty then it must be an absolute path that is
+ /// either equal to or a child directory of CefSettings.RootCachePath.
+ /// If the value is empty then browsers will be created in "incognito mode"
+ /// where in-memory caches are used for storage and no data is persisted to disk.
+ /// HTML5 databases such as localStorage will only persist across sessions if a
+ /// cache path is specified. To share the global browser cache and related
+ /// configuration set this value to match the CefSettings.CachePath value.
+ ///
+ public String CachePath
+ {
+ get { return settings.CachePath; }
+ set { settings.CachePath = value; }
+ }
+
+ ///
+ /// Comma delimited ordered list of language codes without any whitespace that
+ /// will be used in the "Accept-Language" HTTP header. Can be set globally
+ /// using the CefSettings.accept_language_list value or overridden on a per-
+ /// browser basis using the BrowserSettings.AcceptLanguageList value. If
+ /// all values are empty then "en-US,en" will be used. This value will be
+ /// ignored if CachePath matches the CefSettings.CachePath value.
+ ///
+ public String AcceptLanguageList
+ {
+ get { return settings.AcceptLanguageList; }
+ set { settings.AcceptLanguageList = value; }
+ }
+
+ ///
+ /// Set to true to ignore errors related to invalid SSL certificates.
+ /// Enabling this setting can lead to potential security vulnerabilities like
+ /// "man in the middle" attacks. Applications that load content from the
+ /// internet should not enable this setting. Can be set globally using the
+ /// CefSettings.IgnoreCertificateErrors value. This value will be ignored if
+ /// CachePath matches the CefSettings.cache_path value.
+ ///
+ public bool IgnoreCertificateErrors
+ {
+ get { return settings.IgnoreCertificateErrors; }
+ set { settings.IgnoreCertificateErrors = value; }
+ }
+ }
+
+ ///
+ public class UrlRequest : CefSharp.Core.UrlRequest
+ {
+ public UrlRequest(IRequest request, IUrlRequestClient urlRequestClient) : base(request, urlRequestClient)
+ {
+ }
+
+ public UrlRequest(IRequest request, IUrlRequestClient urlRequestClient, IRequestContext requestContext) : base(request, urlRequestClient, requestContext)
+ {
+ }
+ }
+
+ ///
+ public class WindowInfo : CefSharp.Core.WindowInfo
+ {
+
+ }
+
+ public static class DragData
+ {
+ public static IDragData Create()
+ {
+ return Core.DragData.Create();
+ }
+ }
+}
diff --git a/CefSharp.Core/Request.cpp b/CefSharp.Core/Request.cpp
deleted file mode 100644
index ca1e61b845..0000000000
--- a/CefSharp.Core/Request.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-// Copyright © 2010 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#include "Stdafx.h"
-#include "Request.h"
-#include "PostData.h"
-
-using namespace System::Text;
-
-namespace CefSharp
-{
- UrlRequestFlags Request::Flags::get()
- {
- ThrowIfDisposed();
-
- return (UrlRequestFlags)_request->GetFlags();
- }
-
- void Request::Flags::set(UrlRequestFlags flags)
- {
- ThrowIfDisposed();
- ThrowIfReadOnly();
-
- _request->SetFlags((int)flags);
- }
-
- String^ Request::Url::get()
- {
- ThrowIfDisposed();
-
- return StringUtils::ToClr(_request->GetURL());
- }
-
- void Request::Url::set(String^ url)
- {
- if (url == nullptr)
- {
- throw gcnew System::ArgumentException("cannot be null", "url");
- }
-
- ThrowIfDisposed();
- ThrowIfReadOnly();
-
- CefString str = StringUtils::ToNative(url);
- _request->SetURL(str);
- }
-
- String^ Request::Method::get()
- {
- ThrowIfDisposed();
-
- return StringUtils::ToClr(_request->GetMethod());
- }
-
- void Request::Method::set(String^ method)
- {
- if (method == nullptr)
- {
- throw gcnew System::ArgumentException("cannot be null", "method");
- }
-
- ThrowIfDisposed();
- ThrowIfReadOnly();
-
- _request->SetMethod(StringUtils::ToNative(method));
- }
-
- UInt64 Request::Identifier::get()
- {
- ThrowIfDisposed();
-
- return _request->GetIdentifier();
- }
-
- void Request::SetReferrer(String^ referrerUrl, CefSharp::ReferrerPolicy policy)
- {
- ThrowIfDisposed();
- ThrowIfReadOnly();
-
- _request->SetReferrer(StringUtils::ToNative(referrerUrl), (cef_referrer_policy_t)policy);
- }
-
- String^ Request::ReferrerUrl::get()
- {
- ThrowIfDisposed();
-
- return StringUtils::ToClr(_request->GetReferrerURL());
- }
-
- CefSharp::ResourceType Request::ResourceType::get()
- {
- ThrowIfDisposed();
-
- return (CefSharp::ResourceType)_request->GetResourceType();
- }
-
- CefSharp::ReferrerPolicy Request::ReferrerPolicy::get()
- {
- ThrowIfDisposed();
-
- return (CefSharp::ReferrerPolicy)_request->GetReferrerPolicy();
- }
-
- NameValueCollection^ Request::Headers::get()
- {
- ThrowIfDisposed();
-
- CefRequest::HeaderMap hm;
- _request->GetHeaderMap(hm);
-
- auto headers = gcnew HeaderNameValueCollection();
-
- for (CefRequest::HeaderMap::iterator it = hm.begin(); it != hm.end(); ++it)
- {
- String^ name = StringUtils::ToClr(it->first);
- String^ value = StringUtils::ToClr(it->second);
- headers->Add(name, value);
- }
-
- if (_request->IsReadOnly())
- {
- headers->SetReadOnly();
- }
-
- return headers;
- }
-
- void Request::Headers::set(NameValueCollection^ headers)
- {
- ThrowIfDisposed();
- ThrowIfReadOnly();
-
- CefRequest::HeaderMap hm;
-
- for each(String^ key in headers)
- {
- CefString name = StringUtils::ToNative(key);
- for each(String^ element in headers->GetValues(key))
- {
- CefString value = StringUtils::ToNative(element);
- hm.insert(std::make_pair(name, value));
- }
- }
-
- _request->SetHeaderMap(hm);
- }
-
- TransitionType Request::TransitionType::get()
- {
- ThrowIfDisposed();
-
- return (CefSharp::TransitionType) _request->GetTransitionType();
- }
-
- IPostData^ Request::PostData::get()
- {
- ThrowIfDisposed();
-
- if (_postData == nullptr)
- {
- auto postData = _request->GetPostData();
- if (postData.get())
- {
- _postData = gcnew CefSharp::PostData(postData);
- }
- }
- return _postData;
- }
-
- void Request::PostData::set(IPostData^ postData)
- {
- ThrowIfDisposed();
-
- ThrowIfReadOnly();
-
- _request->SetPostData((CefSharp::PostData^)postData);
- }
-
- bool Request::IsReadOnly::get()
- {
- ThrowIfDisposed();
-
- return _request->IsReadOnly();
- }
-
- void Request::InitializePostData()
- {
- ThrowIfDisposed();
-
- ThrowIfReadOnly();
-
- _request->SetPostData(CefPostData::Create());
- }
-
- String^ Request::GetHeaderByName(String^ name)
- {
- ThrowIfDisposed();
-
- return StringUtils::ToClr(_request->GetHeaderByName(StringUtils::ToNative(name)));
- }
-
- void Request::SetHeaderByName(String^ name, String^ value, bool overwrite)
- {
- ThrowIfDisposed();
- ThrowIfReadOnly();
-
- _request->SetHeaderByName(StringUtils::ToNative(name), StringUtils::ToNative(value), overwrite);
- }
-}
diff --git a/CefSharp.Core/Request.h b/CefSharp.Core/Request.h
deleted file mode 100644
index 40e8d500cd..0000000000
--- a/CefSharp.Core/Request.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright © 2010 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#pragma once
-
-#include "Stdafx.h"
-
-#include "include\cef_request.h"
-#include "Internals\CefWrapper.h"
-
-using namespace System::Collections::Specialized;
-
-namespace CefSharp
-{
- public ref class Request : public IRequest, public CefWrapper
- {
- MCefRefPtr _request;
- IPostData^ _postData;
- internal:
- Request(CefRefPtr &cefRequest) :
- _request(cefRequest), _postData(nullptr)
- {
- }
-
- !Request()
- {
- _request = nullptr;
- }
-
- ~Request()
- {
- this->!Request();
-
- delete _postData;
-
- _disposed = true;
- }
-
- operator CefRefPtr()
- {
- if (this == nullptr)
- {
- return NULL;
- }
- return _request.get();
- }
-
- void ThrowIfReadOnly()
- {
- if (_request->IsReadOnly())
- {
- throw gcnew NotSupportedException("IRequest is read-only and cannot be modified. Check IRequest.IsReadOnly to guard against this exception.");
- }
- }
-
- public:
- Request()
- {
- _request = CefRequest::Create();
- }
-
- virtual property UrlRequestFlags Flags { UrlRequestFlags get(); void set(UrlRequestFlags flags); }
- virtual property String^ Url { String^ get(); void set(String^ url); }
- virtual property String^ Method { String^ get(); void set(String^ method); }
- virtual property UInt64 Identifier { UInt64 get(); }
- virtual void SetReferrer(String^ referrerUrl, CefSharp::ReferrerPolicy policy);
- virtual property String^ ReferrerUrl { String^ get(); }
- virtual property ResourceType ResourceType { CefSharp::ResourceType get(); }
- virtual property ReferrerPolicy ReferrerPolicy { CefSharp::ReferrerPolicy get(); }
- virtual property NameValueCollection^ Headers { NameValueCollection^ get(); void set(NameValueCollection^ url); }
- virtual property TransitionType TransitionType { CefSharp::TransitionType get(); }
- virtual property IPostData^ PostData { IPostData^ get(); void set(IPostData^ postData); }
- virtual property bool IsReadOnly { bool get(); }
- virtual void InitializePostData();
-
- virtual String^ GetHeaderByName(String^ name);
- virtual void SetHeaderByName(String^ name, String^ value, bool overwrite);
- };
-}
diff --git a/CefSharp.Core/RequestContext.cpp b/CefSharp.Core/RequestContext.cpp
deleted file mode 100644
index 405476b993..0000000000
--- a/CefSharp.Core/RequestContext.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-// Copyright © 2015 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#include "Stdafx.h"
-#include "RequestContext.h"
-
-#include "include\cef_parser.h"
-
-//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)
-#define CEF_INCLUDE_BASE_INTERNAL_CEF_BIND_INTERNAL_WIN_H_
-#include "include\base\cef_bind.h"
-#undef CEF_INCLUDE_BASE_INTERNAL_CEF_BIND_INTERNAL_WIN_H_
-
-#include "include\wrapper\cef_closure_task.h"
-
-#include "CookieManager.h"
-#include "Internals\CefSchemeHandlerFactoryAdapter.h"
-#include "Internals\CefCompletionCallbackAdapter.h"
-#include "Internals\CefExtensionWrapper.h"
-#include "Internals\CefExtensionHandlerAdapter.h"
-#include "Internals\CefResolveCallbackAdapter.h"
-#include "Internals\TypeConversion.h"
-
-using namespace System::Runtime::InteropServices;
-
-namespace CefSharp
-{
- bool RequestContext::IsSame(IRequestContext^ context)
- {
- ThrowIfDisposed();
-
- auto requestContext = (RequestContext^)context;
-
- return _requestContext->IsSame(requestContext);
- }
-
- bool RequestContext::IsSharingWith(IRequestContext^ context)
- {
- ThrowIfDisposed();
-
- auto requestContext = (RequestContext^)context;
-
- return _requestContext->IsSharingWith(requestContext);
- }
-
- ICookieManager^ RequestContext::GetCookieManager(ICompletionCallback^ callback)
- {
- ThrowIfDisposed();
-
- CefRefPtr wrapper = callback == nullptr ? NULL : new CefCompletionCallbackAdapter(callback);
-
- auto cookieManager = _requestContext->GetCookieManager(wrapper);
- if (cookieManager.get())
- {
- return gcnew CookieManager(cookieManager);
- }
- return nullptr;
- }
-
- bool RequestContext::RegisterSchemeHandlerFactory(String^ schemeName, String^ domainName, ISchemeHandlerFactory^ factory)
- {
- ThrowIfDisposed();
-
- auto wrapper = new CefSchemeHandlerFactoryAdapter(factory);
- return _requestContext->RegisterSchemeHandlerFactory(StringUtils::ToNative(schemeName), StringUtils::ToNative(domainName), wrapper);
- }
-
- bool RequestContext::ClearSchemeHandlerFactories()
- {
- ThrowIfDisposed();
-
- return _requestContext->ClearSchemeHandlerFactories();
- }
-
- void RequestContext::PurgePluginListCache(bool reloadPages)
- {
- ThrowIfDisposed();
-
- _requestContext->PurgePluginListCache(reloadPages);
- }
-
- bool RequestContext::HasPreference(String^ name)
- {
- ThrowIfDisposed();
-
- ThrowIfExecutedOnNonCefUiThread();
-
- return _requestContext->HasPreference(StringUtils::ToNative(name));
- }
-
- Object^ RequestContext::GetPreference(String^ name)
- {
- ThrowIfDisposed();
-
- ThrowIfExecutedOnNonCefUiThread();
-
- return TypeConversion::FromNative(_requestContext->GetPreference(StringUtils::ToNative(name)));
- }
-
- IDictionary^ RequestContext::GetAllPreferences(bool includeDefaults)
- {
- ThrowIfDisposed();
-
- auto preferences = _requestContext->GetAllPreferences(includeDefaults);
-
- return TypeConversion::FromNative(preferences);
- }
-
- bool RequestContext::CanSetPreference(String^ name)
- {
- ThrowIfDisposed();
-
- ThrowIfExecutedOnNonCefUiThread();
-
- return _requestContext->CanSetPreference(StringUtils::ToNative(name));
- }
-
- bool RequestContext::SetPreference(String^ name, Object^ value, [Out] String^ %error)
- {
- ThrowIfDisposed();
-
- ThrowIfExecutedOnNonCefUiThread();
-
- CefString cefError;
-
- auto success = _requestContext->SetPreference(StringUtils::ToNative(name), TypeConversion::ToNative(value), cefError);
-
- error = StringUtils::ToClr(cefError);
-
- return success;
- }
-
- void RequestContext::ClearCertificateExceptions(ICompletionCallback^ callback)
- {
- ThrowIfDisposed();
-
- CefRefPtr wrapper = callback == nullptr ? NULL : new CefCompletionCallbackAdapter(callback);
-
- _requestContext->ClearCertificateExceptions(wrapper);
- }
-
- void RequestContext::ClearHttpAuthCredentials(ICompletionCallback^ callback)
- {
- ThrowIfDisposed();
-
- //TODO: Remove this once CEF Issue has been resolved
- //ClearHttpAuthCredentials crashes when no callback specified
- if (callback == nullptr)
- {
- callback = gcnew CefSharp::Callback::NoOpCompletionCallback();
- }
-
- CefRefPtr wrapper = callback == nullptr ? NULL : new CefCompletionCallbackAdapter(callback);
-
- _requestContext->ClearHttpAuthCredentials(wrapper);
- }
-
- void RequestContext::CloseAllConnections(ICompletionCallback^ callback)
- {
- ThrowIfDisposed();
-
- CefRefPtr wrapper = callback == nullptr ? NULL : new CefCompletionCallbackAdapter(callback);
-
- _requestContext->CloseAllConnections(wrapper);
- }
-
- Task^ RequestContext::ResolveHostAsync(Uri^ origin)
- {
- ThrowIfDisposed();
-
- auto callback = gcnew TaskResolveCallback();
-
- CefRefPtr callbackWrapper = new CefResolveCallbackAdapter(callback);
-
- _requestContext->ResolveHost(StringUtils::ToNative(origin->AbsoluteUri), callbackWrapper);
-
- return callback->Task;
- }
-
- bool RequestContext::DidLoadExtension(String^ extensionId)
- {
- ThrowIfDisposed();
-
- ThrowIfExecutedOnNonCefUiThread();
-
- return _requestContext->DidLoadExtension(StringUtils::ToNative(extensionId));
- }
-
- IExtension^ RequestContext::GetExtension(String^ extensionId)
- {
- ThrowIfDisposed();
-
- ThrowIfExecutedOnNonCefUiThread();
-
- auto extension = _requestContext->GetExtension(StringUtils::ToNative(extensionId));
-
- if (extension.get())
- {
- return gcnew CefExtensionWrapper(extension);
- }
-
- return nullptr;
- }
-
- bool RequestContext::GetExtensions([Out] IList^ %extensionIds)
- {
- ThrowIfDisposed();
-
- ThrowIfExecutedOnNonCefUiThread();
-
- std::vector extensions;
-
- auto success = _requestContext->GetExtensions(extensions);
-
- extensionIds = StringUtils::ToClr(extensions);
-
- return success;
- }
-
- bool RequestContext::HasExtension(String^ extensionId)
- {
- ThrowIfDisposed();
-
- ThrowIfExecutedOnNonCefUiThread();
-
- return _requestContext->HasExtension(StringUtils::ToNative(extensionId));
- }
-
- void RequestContext::LoadExtension(String^ rootDirectory, String^ manifestJson, IExtensionHandler^ handler)
- {
- ThrowIfDisposed();
-
- CefRefPtr manifest;
-
- if (!String::IsNullOrEmpty(manifestJson))
- {
- CefString errorMessage;
- auto value = CefParseJSONAndReturnError(StringUtils::ToNative(manifestJson),
- cef_json_parser_options_t::JSON_PARSER_ALLOW_TRAILING_COMMAS,
- errorMessage);
-
- if (value.get())
- {
- manifest = value->GetDictionary();
- }
- else
- {
- throw gcnew Exception("Unable to parse JSON - ErrorMessage:" + StringUtils::ToClr(errorMessage));
- }
- }
-
- CefRefPtr extensionHandler = handler == nullptr ? NULL : new CefExtensionHandlerAdapter(handler);
-
- if (CefCurrentlyOn(CefThreadId::TID_UI))
- {
- _requestContext->LoadExtension(StringUtils::ToNative(rootDirectory), manifest, extensionHandler);
- }
- else
- {
- CefPostTask(TID_UI, base::Bind(&CefRequestContext::LoadExtension, _requestContext.get(), StringUtils::ToNative(rootDirectory), manifest, extensionHandler));
- }
- }
-}
diff --git a/CefSharp.Core/RequestContext.h b/CefSharp.Core/RequestContext.h
deleted file mode 100644
index 1f377fea76..0000000000
--- a/CefSharp.Core/RequestContext.h
+++ /dev/null
@@ -1,411 +0,0 @@
-// Copyright © 2015 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#ifndef CEFSHARP_CORE_REQUESTCONTEXT_H_
-#define CEFSHARP_CORE_REQUESTCONTEXT_H_
-
-#pragma once
-
-#include "Stdafx.h"
-#include "include\cef_request_context.h"
-
-#include "RequestContextSettings.h"
-#include "RequestContextBuilder.h"
-#include "Internals\CefRequestContextHandlerAdapter.h"
-#include "Internals\CefWrapper.h"
-
-using namespace System::Runtime::InteropServices;
-using namespace System::Threading::Tasks;
-
-namespace CefSharp
-{
- ///
- /// A request context provides request handling for a set of related browser objects.
- /// A request context is specified when creating a new browser object via the CefBrowserHost
- /// static factory methods. Browser objects with different request contexts will never be
- /// hosted in the same render process. Browser objects with the same request context may or
- /// may not be hosted in the same render process depending on the process model.
- /// Browser objects created indirectly via the JavaScript window.open function or targeted
- /// links will share the same render process and the same request context as the source browser.
- /// When running in single-process mode there is only a single render process (the main process)
- /// and so all browsers created in single-process mode will share the same request context.
- /// This will be the first request context passed into a CefBrowserHost static factory method
- /// and all other request context objects will be ignored.
- ///
- public ref class RequestContext : public IRequestContext, public CefWrapper
- {
- private:
- MCefRefPtr _requestContext;
- RequestContextSettings^ _settings;
-
- internal:
- RequestContext(CefRefPtr& context)
- {
- _requestContext = context;
- _settings = nullptr;
- }
-
- operator CefRefPtr()
- {
- if (this == nullptr)
- {
- return NULL;
- }
- return _requestContext.get();
- }
-
- public:
- RequestContext()
- {
- CefRequestContextSettings settings;
- _requestContext = CefRequestContext::CreateContext(settings, NULL);
- }
-
- RequestContext(RequestContextSettings^ settings) : _settings(settings)
- {
- PathCheck::AssertAbsolute(settings->CachePath, "RequestContextSettings.CachePath");
-
- _requestContext = CefRequestContext::CreateContext(settings, NULL);
- }
-
- RequestContext(IRequestContextHandler^ requestContextHandler)
- {
- CefRequestContextSettings settings;
- _requestContext = CefRequestContext::CreateContext(settings, new CefRequestContextHandlerAdapter(requestContextHandler));
- }
-
- RequestContext(RequestContextSettings^ settings, IRequestContextHandler^ requestContextHandler) : _settings(settings)
- {
- PathCheck::AssertAbsolute(settings->CachePath, "RequestContextSettings.CachePath");
-
- _requestContext = CefRequestContext::CreateContext(settings, new CefRequestContextHandlerAdapter(requestContextHandler));
- }
-
- ///Creates a new context object that shares storage with | other | and uses an optional | handler | .
- RequestContext(IRequestContext^ otherRequestContext)
- {
- _requestContext = CefRequestContext::CreateContext((RequestContext^)otherRequestContext, NULL);
- }
-
- RequestContext(IRequestContext^ otherRequestContext, IRequestContextHandler^ requestContextHandler)
- {
- _requestContext = CefRequestContext::CreateContext((RequestContext^)otherRequestContext, new CefRequestContextHandlerAdapter(requestContextHandler));
- }
-
- !RequestContext()
- {
- _requestContext = NULL;
- }
-
- ~RequestContext()
- {
- this->!RequestContext();
-
- delete _settings;
-
- _disposed = true;
- }
-
- ///
- /// Creates a new context object that shares storage with other and uses an
- /// optional handler.
- ///
- /// shares storage with this RequestContext
- /// optional requestContext handler
- /// Returns a new RequestContext
- static IRequestContext^ CreateContext(IRequestContext^ other, IRequestContextHandler^ requestContextHandler)
- {
- auto otherRequestContext = static_cast(other);
- CefRefPtr handler = requestContextHandler == nullptr ? NULL : new CefRequestContextHandlerAdapter(requestContextHandler);
-
- auto newContext = CefRequestContext::CreateContext(otherRequestContext, handler);
- return gcnew RequestContext(newContext);
- }
-
- ///
- /// Creates a new RequestContextBuilder which can be used to fluently set
- /// preferences
- ///
- /// Returns a new RequestContextBuilder
- static RequestContextBuilder^ Configure()
- {
- auto builder = gcnew RequestContextBuilder();
-
- return builder;
- }
-
- ///
- /// Returns true if this object is pointing to the same context object.
- ///
- /// context to compare
- /// Returns true if the same
- virtual bool IsSame(IRequestContext^ context);
-
- ///
- /// Returns true if this object is sharing the same storage as the specified context.
- ///
- /// context to compare
- /// Returns true if same storage
- virtual bool IsSharingWith(IRequestContext^ context);
-
- ///
- /// Returns the default cookie manager for this object. This will be the global
- /// cookie manager if this object is the global request context.
- ///
- /// If callback is non-NULL it will be executed asnychronously on the CEF IO thread
- /// after the manager's storage has been initialized.
- /// Returns the default cookie manager for this object
- virtual ICookieManager^ GetCookieManager(ICompletionCallback^ callback);
-
- ///
- /// Returns true if this object is the global context. The global context is
- /// used by default when creating a browser or URL request with a NULL context
- /// argument.
- ///
- virtual property bool IsGlobal
- {
- bool get()
- {
- ThrowIfDisposed();
- return _requestContext->IsGlobal();
- }
- }
-
- ///
- /// Register a scheme handler factory for the specified schemeName and optional domainName.
- /// An empty domainName value for a standard scheme will cause the factory to match all domain
- /// names. The domainName value will be ignored for non-standard schemes. If schemeName is
- /// a built-in scheme and no handler is returned by factory then the built-in scheme handler
- /// factory will be called. If schemeName is a custom scheme then you must also implement the
- /// IApp.OnRegisterCustomSchemes() method in all processes. This function may be called multiple
- /// times to change or remove the factory that matches the specified schemeName and optional
- /// domainName.
- ///
- /// Scheme Name
- /// Optional domain name
- /// Scheme handler factory
- /// Returns false if an error occurs.
- virtual bool RegisterSchemeHandlerFactory(String^ schemeName, String^ domainName, ISchemeHandlerFactory^ factory);
-
- ///
- /// Clear all registered scheme handler factories.
- ///
- /// Returns false on error.
- virtual bool ClearSchemeHandlerFactories();
-
- ///
- /// Returns the cache path for this object. If empty an "incognito mode"
- /// in-memory cache is being used.
- ///
- virtual property String^ CachePath
- {
- String^ get()
- {
- ThrowIfDisposed();
-
- return StringUtils::ToClr(_requestContext->GetCachePath());
- }
- }
-
- ///
- /// Tells all renderer processes associated with this context to throw away
- /// their plugin list cache. If reloadPages is true they will also reload
- /// all pages with plugins. RequestContextHandler.OnBeforePluginLoad may
- /// be called to rebuild the plugin list cache.
- ///
- /// reload any pages with pluginst
- virtual void PurgePluginListCache(bool reloadPages);
-
- ///
- /// Returns true if a preference with the specified name exists. This method
- /// must be called on the CEF UI thread.
- ///
- /// name of preference
- /// bool if the preference exists
- /// Use Cef.UIThreadTaskFactory to execute this method if required,
- /// and ChromiumWebBrowser.IsBrowserInitializedChanged are both
- /// executed on the CEF UI thread, so can be called directly.
- /// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
- /// application thread will be the CEF UI thread.
- virtual bool HasPreference(String^ name);
-
- ///
- /// Returns the value for the preference with the specified name. Returns
- /// NULL if the preference does not exist. The returned object contains a copy
- /// of the underlying preference value and modifications to the returned object
- /// will not modify the underlying preference value. This method must be called
- /// on the CEF UI thread.
- ///
- /// preference name
- /// Returns the value for the preference with the specified name
- /// Use Cef.UIThreadTaskFactory to execute this method if required,
- /// and ChromiumWebBrowser.IsBrowserInitializedChanged are both
- /// executed on the CEF UI thread, so can be called directly.
- /// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
- /// application thread will be the CEF UI thread.
- virtual Object^ GetPreference(String^ name);
-
- ///
- /// Returns all preferences as a dictionary. The returned
- /// object contains a copy of the underlying preference values and
- /// modifications to the returned object will not modify the underlying
- /// preference values. This method must be called on the browser process UI
- /// thread.
- ///
- /// If true then
- /// preferences currently at their default value will be included.
- /// Preferences (dictionary can have sub dictionaries)
- virtual IDictionary^ GetAllPreferences(bool includeDefaults);
-
- ///
- /// Returns true if the preference with the specified name can be modified
- /// using SetPreference. As one example preferences set via the command-line
- /// usually cannot be modified. This method must be called on the CEF UI thread.
- ///
- /// preference key
- /// Returns true if the preference with the specified name can be modified
- /// using SetPreference
- /// Use Cef.UIThreadTaskFactory to execute this method if required,
- /// and ChromiumWebBrowser.IsBrowserInitializedChanged are both
- /// executed on the CEF UI thread, so can be called directly.
- /// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
- /// application thread will be the CEF UI thread.
- virtual bool CanSetPreference(String^ name);
-
- ///
- /// Set the value associated with preference name. If value is null the
- /// preference will be restored to its default value. If setting the preference
- /// fails then error will be populated with a detailed description of the
- /// problem. This method must be called on the CEF UI thread.
- /// Preferences set via the command-line usually cannot be modified.
- ///
- /// preference key
- /// preference value
- /// out error
- /// Returns true if the value is set successfully and false otherwise.
- /// Use Cef.UIThreadTaskFactory to execute this method if required,
- /// and ChromiumWebBrowser.IsBrowserInitializedChanged are both
- /// executed on the CEF UI thread, so can be called directly.
- /// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
- /// application thread will be the CEF UI thread.
- virtual bool SetPreference(String^ name, Object^ value, [Out] String^ %error);
-
- ///
- /// Clears all certificate exceptions that were added as part of handling
- /// . If you call this it is
- /// recommended that you also call or you risk not
- /// being prompted again for server certificates if you reconnect quickly.
- ///
- /// If is non-NULL it will be executed on the CEF UI thread after
- /// completion. This param is optional
- virtual void ClearCertificateExceptions(ICompletionCallback^ callback);
-
- ///
- /// Clears all HTTP authentication credentials that were added as part of handling
- /// .
- ///
- /// If is non-NULL it will be executed on the CEF UI thread after
- /// completion. This param is optional
- virtual void ClearHttpAuthCredentials(ICompletionCallback^ callback);
-
- ///
- /// Clears all active and idle connections that Chromium currently has.
- /// This is only recommended if you have released all other CEF objects but
- /// don't yet want to call Cef.Shutdown().
- ///
- /// If is non-NULL it will be executed on the CEF UI thread after
- /// completion. This param is optional
- virtual void CloseAllConnections(ICompletionCallback^ callback);
-
- ///
- /// Attempts to resolve origin to a list of associated IP addresses.
- ///
- /// host name to resolve
- /// A task that represents the Resoolve Host operation. The value of the TResult parameter contains ResolveCallbackResult.
- virtual Task^ ResolveHostAsync(Uri^ origin);
-
- ///
- /// Returns true if this context was used to load the extension identified by extensionId. Other contexts sharing the same storage will also have access to the extension (see HasExtension).
- /// This method must be called on the CEF UI thread.
- ///
- /// Returns true if this context was used to load the extension identified by extensionId
- /// Use Cef.UIThreadTaskFactory to execute this method if required,
- /// and ChromiumWebBrowser.IsBrowserInitializedChanged are both
- /// executed on the CEF UI thread, so can be called directly.
- /// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
- /// application thread will be the CEF UI thread.
- virtual bool DidLoadExtension(String^ extensionId);
-
- ///
- /// Returns the extension matching extensionId or null if no matching extension is accessible in this context (see HasExtension).
- /// This method must be called on the CEF UI thread.
- ///
- /// extension Id
- /// Returns the extension matching extensionId or null if no matching extension is accessible in this context
- /// Use Cef.UIThreadTaskFactory to execute this method if required,
- /// and ChromiumWebBrowser.IsBrowserInitializedChanged are both
- /// executed on the CEF UI thread, so can be called directly.
- /// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
- /// application thread will be the CEF UI thread.
- virtual IExtension^ GetExtension(String^ extensionId);
-
- ///
- /// Retrieve the list of all extensions that this context has access to (see HasExtension).
- /// will be populated with the list of extension ID values.
- /// This method must be called on the CEF UI thread.
- ///
- /// output a list of extensions Ids
- /// returns true on success otherwise false
- /// Use Cef.UIThreadTaskFactory to execute this method if required,
- /// and ChromiumWebBrowser.IsBrowserInitializedChanged are both
- /// executed on the CEF UI thread, so can be called directly.
- /// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
- /// application thread will be the CEF UI thread.
- virtual bool GetExtensions([Out] IList^ %extensionIds);
-
- ///
- /// Returns true if this context has access to the extension identified by extensionId.
- /// This may not be the context that was used to load the extension (see DidLoadExtension).
- /// This method must be called on the CEF UI thread.
- ///
- /// extension id
- /// Returns true if this context has access to the extension identified by extensionId
- /// Use Cef.UIThreadTaskFactory to execute this method if required,
- /// and ChromiumWebBrowser.IsBrowserInitializedChanged are both
- /// executed on the CEF UI thread, so can be called directly.
- /// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
- /// application thread will be the CEF UI thread.
- virtual bool HasExtension(String^ extensionId);
-
- ///
- /// Load an extension. If extension resources will be read from disk using the default load implementation then rootDirectoy
- /// should be the absolute path to the extension resources directory and manifestJson should be null.
- /// If extension resources will be provided by the client (e.g. via IRequestHandler and/or IExtensionHandler) then rootDirectory
- /// should be a path component unique to the extension (if not absolute this will be internally prefixed with the PK_DIR_RESOURCES path)
- /// and manifestJson should contain the contents that would otherwise be read from the "manifest.json" file on disk.
- /// The loaded extension will be accessible in all contexts sharing the same storage (HasExtension returns true).
- /// However, only the context on which this method was called is considered the loader (DidLoadExtension returns true) and only the
- /// loader will receive IRequestContextHandler callbacks for the extension. will be
- /// called on load success or will be called on load failure.
- /// If the extension specifies a background script via the "background" manifest key then
- /// will be called to create the background browser. See that method for additional information about background scripts.
- /// For visible extension views the client application should evaluate the manifest to determine the correct extension URL to load and then pass
- /// that URL to the IBrowserHost.CreateBrowser* function after the extension has loaded. For example, the client can look for the "browser_action"
- /// manifest key as documented at https://developer.chrome.com/extensions/browserAction. Extension URLs take the form "chrome-extension:///".
- /// Browsers that host extensions differ from normal browsers as follows: - Can access chrome.* JavaScript APIs if allowed by the manifest.
- /// Visit chrome://extensions-support for the list of extension APIs currently supported by CEF. - Main frame navigation to non-extension
- /// content is blocked.
- /// - Pinch-zooming is disabled.
- /// - returns the hosted extension.
- /// - CefBrowserHost::IsBackgroundHost returns true for background hosts. See https://developer.chrome.com/extensions for extension implementation and usage documentation.
- ///
- /// If extension resources will be read from disk using the default load implementation then rootDirectoy
- /// should be the absolute path to the extension resources directory and manifestJson should be null
- /// If extension resources will be provided by the client then rootDirectory should be a path component unique to the extension
- /// and manifestJson should contain the contents that would otherwise be read from the manifest.json file on disk
- /// handle events related to browser extensions
- virtual void LoadExtension(String^ rootDirectory, String^ manifestJson, IExtensionHandler^ handler);
- };
-}
-#endif // CEFSHARP_CORE_REQUESTCONTEXT_H_
diff --git a/CefSharp.Core/RequestContextBuilder.cpp b/CefSharp.Core/RequestContextBuilder.cpp
deleted file mode 100644
index dafe57c989..0000000000
--- a/CefSharp.Core/RequestContextBuilder.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright © 2020 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#include "Stdafx.h"
-#include "RequestContextBuilder.h"
-#include "RequestContext.h"
-
-namespace CefSharp
-{
- IRequestContext^ RequestContextBuilder::Create()
- {
- if (_otherContext != nullptr)
- {
- return gcnew RequestContext(_otherContext, _handler);
- }
-
- if(_settings != nullptr)
- {
- return gcnew RequestContext(_settings, _handler);
- }
-
- return gcnew RequestContext(_handler);
- }
-
- RequestContextBuilder^ RequestContextBuilder::OnInitialize(Action^ action)
- {
- if (_handler == nullptr)
- {
- _handler = gcnew RequestContextHandler();
- }
-
- _handler->OnInitialize(action);
-
- return this;
- }
-
- RequestContextBuilder^ RequestContextBuilder::WithPreference(String^ name, Object^ value)
- {
- if (_handler == nullptr)
- {
- _handler = gcnew RequestContextHandler();
- }
-
- _handler->SetPreferenceOnContextInitialized(name, value);
-
- return this;
- }
-
- RequestContextBuilder^ RequestContextBuilder::WithProxyServer(String^ host)
- {
- if (_handler == nullptr)
- {
- _handler = gcnew RequestContextHandler();
- }
-
- _handler->SetProxyOnContextInitialized(host, Nullable());
-
- return this;
- }
-
- RequestContextBuilder^ RequestContextBuilder::WithProxyServer(String^ host, Nullable port)
- {
- if (_handler == nullptr)
- {
- _handler = gcnew RequestContextHandler();
- }
-
- _handler->SetProxyOnContextInitialized(host, port);
-
- return this;
- }
-
- RequestContextBuilder^ RequestContextBuilder::WithProxyServer(String^ scheme, String^ host, Nullable port)
- {
- if (_handler == nullptr)
- {
- _handler = gcnew RequestContextHandler();
- }
-
- _handler->SetProxyOnContextInitialized(scheme, host, port);
-
- return this;
- }
-
- RequestContextBuilder^ RequestContextBuilder::PersistUserPreferences()
- {
- ThrowExceptionIfContextAlreadySet();
-
- if (_settings == nullptr)
- {
- _settings = gcnew RequestContextSettings();
- }
-
- _settings->PersistUserPreferences = true;
-
- return this;
- }
-
- RequestContextBuilder^ RequestContextBuilder::WithCachePath(String^ cachePath)
- {
- ThrowExceptionIfContextAlreadySet();
-
- if (_settings == nullptr)
- {
- _settings = gcnew RequestContextSettings();
- }
-
- _settings->CachePath = cachePath;
-
- return this;
- }
-
- RequestContextBuilder^ RequestContextBuilder::WithSharedSettings(IRequestContext^ other)
- {
- if (other == nullptr)
- {
- throw gcnew ArgumentNullException("other");
- }
-
- ThrowExceptionIfCustomSettingSpecified();
-
- _otherContext = other;
-
- return this;
- }
-}
diff --git a/CefSharp.Core/RequestContextBuilder.h b/CefSharp.Core/RequestContextBuilder.h
deleted file mode 100644
index 96acd18181..0000000000
--- a/CefSharp.Core/RequestContextBuilder.h
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright © 2020 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#pragma once
-
-#include "RequestContextSettings.h"
-
-using namespace CefSharp::Handler;
-
-namespace CefSharp
-{
- ///
- /// Fluent style builder for creating IRequestContext instances.
- ///
- public ref class RequestContextBuilder
- {
- private:
- RequestContextSettings^ _settings;
- IRequestContext^ _otherContext;
- RequestContextHandler^ _handler;
-
- void ThrowExceptionIfContextAlreadySet()
- {
- if (_otherContext != nullptr)
- {
- throw gcnew Exception("A call to WithSharedSettings has already been made, it is no possible to provide custom settings.");
- }
- }
-
- void ThrowExceptionIfCustomSettingSpecified()
- {
- if (_settings != nullptr)
- {
- throw gcnew Exception("A call to WithCachePath/PersistUserPreferences has already been made, it's not possible to share settings with another RequestContext.");
- }
- }
-
- public:
- ///
- /// Create the actual RequestContext instance
- ///
- /// Returns a new RequestContext instance.
- IRequestContext^ Create();
-
- ///
- /// Action is called in IRequestContextHandler.OnRequestContextInitialized
- ///
- /// called when the context has been initialized.
- /// Returns RequestContextBuilder instance
- RequestContextBuilder^ OnInitialize(Action^ action);
-
- ///
- /// Sets the Cache Path
- ///
- ///
- /// The location where cache data for this request context will be stored on
- /// disk. If this value is non-empty then it must be an absolute path that is
- /// either equal to or a child directory of CefSettings.RootCachePath.
- /// If the value is empty then browsers will be created in "incognito mode"
- /// where in-memory caches are used for storage and no data is persisted to disk.
- /// HTML5 databases such as localStorage will only persist across sessions if a
- /// cache path is specified. To share the global browser cache and related
- /// configuration set this value to match the CefSettings.CachePath value.
- ///
- /// Returns RequestContextBuilder instance
- RequestContextBuilder^ WithCachePath(String^ cachePath);
-
- ///
- /// Invoke this method tp persist user preferences as a JSON file in the cache path directory.
- /// Can be set globally using the CefSettings.PersistUserPreferences value.
- /// This value will be ignored if CachePath is empty or if it matches the CefSettings.CachePath value.
- ///
- /// Returns RequestContextBuilder instance
- RequestContextBuilder^ PersistUserPreferences();
-
- ///
- /// Set the value associated with preference name when the RequestContext
- /// is initialzied. If value is null the preference will be restored to its
- /// default value. If setting the preference fails no error is throw, you
- /// must check the CEF Log file.
- /// Preferences set via the command-line usually cannot be modified.
- ///
- /// preference key
- /// preference value
- /// Returns RequestContextBuilder instance
- RequestContextBuilder^ WithPreference(String^ name, Object^ value);
-
- ///
- /// Set the Proxy server when the RequestContext is initialzied.
- /// If value is null the preference will be restored to its
- /// default value. If setting the preference fails no error is throw, you
- /// must check the CEF Log file.
- /// Proxy set via the command-line cannot be modified.
- ///
- /// proxy host
- /// Returns RequestContextBuilder instance
- RequestContextBuilder^ WithProxyServer(String^ host);
-
- ///
- /// Set the Proxy server when the RequestContext is initialzied.
- /// If value is null the preference will be restored to its
- /// default value. If setting the preference fails no error is throw, you
- /// must check the CEF Log file.
- /// Proxy set via the command-line cannot be modified.
- ///
- /// proxy host
- /// proxy port (optional)
- /// Returns RequestContextBuilder instance
- RequestContextBuilder^ WithProxyServer(String^ host, Nullable port);
-
- ///
- /// Set the Proxy server when the RequestContext is initialzied.
- /// If value is null the preference will be restored to its
- /// default value. If setting the preference fails no error is throw, you
- /// must check the CEF Log file.
- /// Proxy set via the command-line cannot be modified.
- ///
- /// proxy scheme
- /// proxy host
- /// proxy port (optional)
- /// Returns RequestContextBuilder instance
- RequestContextBuilder^ WithProxyServer(String^ scheme, String^ host, Nullable port);
-
- ///
- /// Shares storage with other RequestContext
- ///
- /// shares storage with this RequestContext
- /// Returns RequestContextBuilder instance
- RequestContextBuilder^ WithSharedSettings(IRequestContext^ other);
- };
-}
-
diff --git a/CefSharp.Core/RequestContextSettings.h b/CefSharp.Core/RequestContextSettings.h
deleted file mode 100644
index 468b743156..0000000000
--- a/CefSharp.Core/RequestContextSettings.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright © 2015 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#pragma once
-
-#include "Stdafx.h"
-#include "include\cef_request_context.h"
-
-namespace CefSharp
-{
- ///
- /// RequestContextSettings
- ///
- public ref class RequestContextSettings
- {
- private:
- CefRequestContextSettings* _settings;
-
- internal:
- operator CefRequestContextSettings()
- {
- return *_settings;
- }
-
- public:
- ///
- /// Default constructor
- ///
- RequestContextSettings() : _settings(new CefRequestContextSettings())
- {
- }
-
- !RequestContextSettings()
- {
- delete _settings;
- }
-
- ~RequestContextSettings()
- {
- this->!RequestContextSettings();
- }
-
- ///
- /// To persist session cookies (cookies without an expiry date or validity
- /// interval) by default when using the global cookie manager set this value to
- /// true. Session cookies are generally intended to be transient and most
- /// Web browsers do not persist them. Can be set globally using the
- /// CefSettings.PersistSessionCookies value. This value will be ignored if
- /// CachePath is empty or if it matches the CefSettings.CachePath value.
- ///
- property bool PersistSessionCookies
- {
- bool get() { return _settings->persist_session_cookies == 1; }
- void set(bool value) { _settings->persist_session_cookies = value; }
- }
-
- ///
- /// To persist user preferences as a JSON file in the cache path directory set
- /// this value to true. Can be set globally using the
- /// CefSettings.PersistUserPreferences value. This value will be ignored if
- /// CachePath is empty or if it matches the CefSettings.CachePath value.
- ///
- property bool PersistUserPreferences
- {
- bool get() { return _settings->persist_user_preferences == 1; }
- void set(bool value) { _settings->persist_user_preferences = value; }
- }
-
- ///
- /// The location where cache data for this request context will be stored on
- /// disk. If this value is non-empty then it must be an absolute path that is
- /// either equal to or a child directory of CefSettings.RootCachePath.
- /// If the value is empty then browsers will be created in "incognito mode"
- /// where in-memory caches are used for storage and no data is persisted to disk.
- /// HTML5 databases such as localStorage will only persist across sessions if a
- /// cache path is specified. To share the global browser cache and related
- /// configuration set this value to match the CefSettings.CachePath value.
- ///
- property String^ CachePath
- {
- String^ get() { return StringUtils::ToClr(_settings->cache_path); }
- void set(String^ value) { StringUtils::AssignNativeFromClr(_settings->cache_path, value); }
- }
-
- ///
- /// Comma delimited ordered list of language codes without any whitespace that
- /// will be used in the "Accept-Language" HTTP header. Can be set globally
- /// using the CefSettings.accept_language_list value or overridden on a per-
- /// browser basis using the BrowserSettings.AcceptLanguageList value. If
- /// all values are empty then "en-US,en" will be used. This value will be
- /// ignored if CachePath matches the CefSettings.CachePath value.
- ///
- property String^ AcceptLanguageList
- {
- String^ get() { return StringUtils::ToClr(_settings->accept_language_list); }
- void set(String^ value) { StringUtils::AssignNativeFromClr(_settings->accept_language_list, value); }
- }
-
- ///
- /// Set to true to ignore errors related to invalid SSL certificates.
- /// Enabling this setting can lead to potential security vulnerabilities like
- /// "man in the middle" attacks. Applications that load content from the
- /// internet should not enable this setting. Can be set globally using the
- /// CefSettings.IgnoreCertificateErrors value. This value will be ignored if
- /// CachePath matches the CefSettings.cache_path value.
- ///
- property bool IgnoreCertificateErrors
- {
- bool get() { return _settings->ignore_certificate_errors == 1; }
- void set(bool value) { _settings->ignore_certificate_errors = value; }
- }
- };
-}
diff --git a/CefSharp.Core/UrlRequest.cpp b/CefSharp.Core/UrlRequest.cpp
deleted file mode 100644
index 93fec9e1f1..0000000000
--- a/CefSharp.Core/UrlRequest.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright © 2019 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#include "Stdafx.h"
-#include "UrlRequest.h"
-#include "Internals\CefResponseWrapper.h"
-
-bool UrlRequest::ResponseWasCached::get()
-{
- ThrowIfDisposed();
-
- return _urlRequest->ResponseWasCached();
-}
-
-IResponse^ UrlRequest::Response::get()
-{
- ThrowIfDisposed();
-
- return gcnew CefResponseWrapper(_urlRequest->GetResponse());
-}
-
-UrlRequestStatus UrlRequest::RequestStatus::get()
-{
- ThrowIfDisposed();
-
- return (UrlRequestStatus)_urlRequest->GetRequestStatus();
-}
-
diff --git a/CefSharp.Core/UrlRequest.h b/CefSharp.Core/UrlRequest.h
deleted file mode 100644
index 79d6ccc012..0000000000
--- a/CefSharp.Core/UrlRequest.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright © 2019 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#pragma once
-
-#include "Stdafx.h"
-
-#include "include\cef_urlrequest.h"
-
-#include "Request.h"
-#include "RequestContext.h"
-#include "Internals\CefUrlRequestClientAdapter.h"
-#include "Internals\CefWrapper.h"
-
-namespace CefSharp
-{
- ///
- // Class used to make a URL request. URL requests are not associated with
- // a browser instance so no CefClient callbacks will be executed.
- // URL requests can be created on any valid CEF thread in either the browser
- // or render process. Once created the methods of the URL request object must
- // be accessed on the same thread that created it.
- ///
- /*--cef(source=library)--*/
- public ref class UrlRequest : public IUrlRequest, public CefWrapper
- {
- private:
- MCefRefPtr _urlRequest;
- internal:
- UrlRequest(CefRefPtr &urlRequest)
- : _urlRequest(urlRequest)
- {
- }
-
- !UrlRequest()
- {
- _urlRequest = NULL;
- }
-
- ~UrlRequest()
- {
- this->!UrlRequest();
- }
-
- public:
- UrlRequest(IRequest^ request, IUrlRequestClient^ urlRequestClient)
- : UrlRequest(request, urlRequestClient, nullptr)
- {
- }
-
- UrlRequest(IRequest^ request, IUrlRequestClient^ urlRequestClient, IRequestContext^ requestContext)
- {
- if (request == nullptr)
- {
- throw gcnew ArgumentNullException("request");
- }
- if (urlRequestClient == nullptr)
- {
- throw gcnew ArgumentNullException("urlRequestClient");
- }
-
- _urlRequest = CefURLRequest::Create((Request^)request, new CefUrlRequestClientAdapter(urlRequestClient), (RequestContext^)requestContext);
- }
-
- ///
- // Returns true if the response body was served from the cache. This includes
- // responses for which revalidation was required.
- ///
- /*--cef()--*/
- virtual property bool ResponseWasCached
- {
- bool get();
- }
-
- ///
- // Returns the response, or NULL if no response information is available.
- // Response information will only be available after the upload has completed.
- // The returned object is read-only and should not be modified.
- ///
- /*--cef()--*/
- virtual property IResponse^ Response
- {
- IResponse^ get();
- }
-
- ///
- // Returns the request status.
- ///
- /*--cef(default_retval=UR_UNKNOWN)--*/
- virtual property UrlRequestStatus RequestStatus
- {
- UrlRequestStatus get();
- }
- };
-}
diff --git a/CefSharp.Core/WindowInfo.h b/CefSharp.Core/WindowInfo.h
deleted file mode 100644
index f155fb6dee..0000000000
--- a/CefSharp.Core/WindowInfo.h
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright © 2015 The CefSharp Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-#pragma once
-
-#include "Stdafx.h"
-
-#include "include\internal\cef_win.h"
-
-namespace CefSharp
-{
- public ref class WindowInfo : public IWindowInfo
- {
- private:
- CefWindowInfo* _windowInfo;
- bool _ownsPointer = false;
-
- internal:
- WindowInfo(CefWindowInfo* windowInfo) : _windowInfo(windowInfo)
- {
-
- }
-
- CefWindowInfo* GetWindowInfo()
- {
- return _windowInfo;
- }
-
- public:
- WindowInfo() : _windowInfo(new CefWindowInfo())
- {
- _ownsPointer = true;
- }
-
- !WindowInfo()
- {
- if (_ownsPointer)
- {
- delete _windowInfo;
- }
-
- _windowInfo = NULL;
- }
-
- ~WindowInfo()
- {
- this->!WindowInfo();
- }
-
- virtual property int X
- {
- int get()
- {
- return _windowInfo->x;
- }
- void set(int x)
- {
- _windowInfo->x = x;
- }
- }
-
- virtual property int Y
- {
- int get()
- {
- return _windowInfo->y;
- }
- void set(int y)
- {
- _windowInfo->y = y;
- }
- }
-
- virtual property int Width
- {
- int get()
- {
- return _windowInfo->width;
- }
- void set(int width)
- {
- _windowInfo->width = width;
- }
- }
-
- virtual property int Height
- {
- int get()
- {
- return _windowInfo->height;
- }
- void set(int height)
- {
- _windowInfo->height = height;
- }
- }
-
- virtual property UINT32 Style
- {
- UINT32 get()
- {
- return _windowInfo->style;
- }
- void set(UINT32 style)
- {
- _windowInfo->style = style;
- }
- }
-
- virtual property UINT32 ExStyle
- {
- UINT32 get()
- {
- return _windowInfo->ex_style;
- }
- void set(UINT32 ex_style)
- {
- _windowInfo->ex_style = ex_style;
- }
- }
-
- virtual property IntPtr ParentWindowHandle
- {
- IntPtr get()
- {
- return IntPtr(_windowInfo->parent_window);
- }
- void set(IntPtr parentWindowHandle)
- {
- _windowInfo->parent_window = (HWND)parentWindowHandle.ToPointer();
- }
- }
-
- virtual property IntPtr WindowHandle
- {
- IntPtr get()
- {
- return IntPtr(_windowInfo->window);
- }
- void set(IntPtr windowHandle)
- {
- _windowInfo->window = (HWND)windowHandle.ToPointer();
- }
- }
-
- virtual property bool WindowlessRenderingEnabled
- {
- bool get()
- {
- return _windowInfo->windowless_rendering_enabled == 1;
- }
- void set(bool windowlessRenderingEnabled)
- {
- _windowInfo->windowless_rendering_enabled = windowlessRenderingEnabled;
- }
- }
-
- virtual property bool SharedTextureEnabled
- {
- bool get()
- {
- return _windowInfo->shared_texture_enabled == 1;
- }
- void set(bool sharedTextureEnabled)
- {
- _windowInfo->shared_texture_enabled = sharedTextureEnabled;
- }
- }
-
- virtual property bool ExternalBeginFrameEnabled
- {
- bool get()
- {
- return _windowInfo->external_begin_frame_enabled == 1;
- }
- void set(bool externalBeginFrameEnabled)
- {
- _windowInfo->external_begin_frame_enabled = externalBeginFrameEnabled;
- }
- }
-
- virtual void SetAsChild(IntPtr parentHandle)
- {
- HWND hwnd = static_cast(parentHandle.ToPointer());
- RECT rect;
- GetClientRect(hwnd, &rect);
- CefWindowInfo window;
- _windowInfo->SetAsChild(hwnd, rect);
- }
-
- virtual void SetAsChild(IntPtr parentHandle, int left, int top, int right, int bottom)
- {
- RECT rect;
- rect.left = left;
- rect.top = top;
- rect.right = right;
- rect.bottom = bottom;
- _windowInfo->SetAsChild((HWND)parentHandle.ToPointer(), rect);
- }
-
- virtual void SetAsPopup(IntPtr parentHandle, String^ windowName)
- {
- _windowInfo->SetAsPopup((HWND)parentHandle.ToPointer(), StringUtils::ToNative(windowName));
- }
-
- virtual void SetAsWindowless(IntPtr parentHandle)
- {
- _windowInfo->SetAsWindowless((HWND)parentHandle.ToPointer());
- }
- };
-}
diff --git a/CefSharp.Core/packages.config b/CefSharp.Core/packages.config
new file mode 100644
index 0000000000..e2934c28ce
--- /dev/null
+++ b/CefSharp.Core/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/CefSharp.Example/CefSharp.Example.csproj b/CefSharp.Example/CefSharp.Example.csproj
index 467e11a2da..f917b62349 100644
--- a/CefSharp.Example/CefSharp.Example.csproj
+++ b/CefSharp.Example/CefSharp.Example.csproj
@@ -187,8 +187,12 @@
-
+
{7b495581-2271-4f41-9476-acb86e8c864f}
+ CefSharp.Core.Runtime
+
+
+ {b760b002-d277-4525-9f63-67ed2065034a}
CefSharp.Core
diff --git a/CefSharp.Example/CefSharp.Example.netcore.csproj b/CefSharp.Example/CefSharp.Example.netcore.csproj
index 48036ed04e..1321863df6 100644
--- a/CefSharp.Example/CefSharp.Example.netcore.csproj
+++ b/CefSharp.Example/CefSharp.Example.netcore.csproj
@@ -23,7 +23,7 @@
-
+
diff --git a/CefSharp.Example/Resources/Home.html b/CefSharp.Example/Resources/Home.html
index f1838a0ad7..8fd9461bd4 100644
--- a/CefSharp.Example/Resources/Home.html
+++ b/CefSharp.Example/Resources/Home.html
@@ -142,7 +142,7 @@ Initialize/Shutdown Cef
}
- It's important to note CEF that Initialize/Shutdown MUST be called on your main applicaiton thread (Typically the UI thead). If you call them on different
+ It's important to note CEF that Initialize/Shutdown MUST be called on your main application thread (typically the UI thread). If you call them on different
threads, your application will hang.
diff --git a/CefSharp.OffScreen.Example/CefSharp.OffScreen.Example.csproj b/CefSharp.OffScreen.Example/CefSharp.OffScreen.Example.csproj
index e7661eb9c3..19fe782b84 100644
--- a/CefSharp.OffScreen.Example/CefSharp.OffScreen.Example.csproj
+++ b/CefSharp.OffScreen.Example/CefSharp.OffScreen.Example.csproj
@@ -73,8 +73,12 @@
-
+
{7b495581-2271-4f41-9476-acb86e8c864f}
+ CefSharp.Core.Runtime
+
+
+ {b760b002-d277-4525-9f63-67ed2065034a}
CefSharp.Core
diff --git a/CefSharp.OffScreen.Example/CefSharp.OffScreen.Example.netcore.csproj b/CefSharp.OffScreen.Example/CefSharp.OffScreen.Example.netcore.csproj
index 38d4f6eced..8a1e45224e 100644
--- a/CefSharp.OffScreen.Example/CefSharp.OffScreen.Example.netcore.csproj
+++ b/CefSharp.OffScreen.Example/CefSharp.OffScreen.Example.netcore.csproj
@@ -22,7 +22,7 @@
-
+
diff --git a/CefSharp.OffScreen.Example/app.manifest b/CefSharp.OffScreen.Example/app.manifest
index 9006e320f7..b49c064ba6 100644
--- a/CefSharp.OffScreen.Example/app.manifest
+++ b/CefSharp.OffScreen.Example/app.manifest
@@ -7,7 +7,7 @@
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
+
diff --git a/CefSharp.OffScreen/CefSharp.OffScreen.csproj b/CefSharp.OffScreen/CefSharp.OffScreen.csproj
index 4255fcbf2c..32348bae50 100644
--- a/CefSharp.OffScreen/CefSharp.OffScreen.csproj
+++ b/CefSharp.OffScreen/CefSharp.OffScreen.csproj
@@ -1,5 +1,6 @@
-
+
+
@@ -17,59 +18,28 @@
7.1
+ true
+ true
+ ..\CefSharp.snk
-
- true
- bin\x64\Debug\
- DEBUG;TRACE;OFFSCREEN
- full
- x64
- prompt
- MinimumRecommendedRules.ruleset
- bin\x64\Debug\CefSharp.OffScreen.xml
- false
-
-
- bin\x64\Release\
- TRACE;OFFSCREEN
- true
- pdbonly
- x64
- prompt
- MinimumRecommendedRules.ruleset
- bin\x64\Release\CefSharp.OffScreen.xml
- false
- true
-
-
+
true
- bin\x86\Debug\
+ bin\Debug\
DEBUG;TRACE;OFFSCREEN
full
- x86
+ AnyCPU
prompt
MinimumRecommendedRules.ruleset
- bin\x86\Debug\CefSharp.OffScreen.xml
- 1591
- false
-
- bin\x86\Release\
+
+ bin\Release\
TRACE;OFFSCREEN
+ bin\Release\CefSharp.OffScreen.xml
true
pdbonly
- x86
+ AnyCPU
prompt
MinimumRecommendedRules.ruleset
- bin\x86\Release\CefSharp.OffScreen.xml
- false
- true
-
-
- true
-
-
- ..\CefSharp.snk
@@ -91,8 +61,8 @@
-
- {7b495581-2271-4f41-9476-acb86e8c864f}
+
+ {b760b002-d277-4525-9f63-67ed2065034a}
CefSharp.Core
@@ -104,6 +74,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/NuGet/CefSharp.Common.app.config.x86.transform b/NuGet/CefSharp.Common.app.config.x86.transform
new file mode 100644
index 0000000000..175b118681
--- /dev/null
+++ b/NuGet/CefSharp.Common.app.config.x86.transform
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/NuGet/CefSharp.Common.nuspec b/NuGet/CefSharp.Common.nuspec
index df8826e48c..3690fa2ed2 100644
--- a/NuGet/CefSharp.Common.nuspec
+++ b/NuGet/CefSharp.Common.nuspec
@@ -17,26 +17,51 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -49,10 +74,13 @@
+
+
-
-
+
+
+
diff --git a/NuGet/CefSharp.Common.props b/NuGet/CefSharp.Common.props
index cfb962522c..eeb86e1c20 100644
--- a/NuGet/CefSharp.Common.props
+++ b/NuGet/CefSharp.Common.props
@@ -4,36 +4,11 @@
+
+
+
-
-
-
-
-
- $(MSBuildThisFileDirectory)..\CefSharp\x64\CefSharp.dll
- False
-
-
- $(MSBuildThisFileDirectory)..\CefSharp\x64\CefSharp.Core.dll
- False
-
-
-
-
-
-
-
- $(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.dll
- False
-
-
- $(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Core.dll
- False
-
-
-
-
diff --git a/NuGet/CefSharp.Common.targets b/NuGet/CefSharp.Common.targets
index c15aa78fa4..c092b4648b 100644
--- a/NuGet/CefSharp.Common.targets
+++ b/NuGet/CefSharp.Common.targets
@@ -1,77 +1,160 @@
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+ $(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll
+ $(VSToolsPath)\Web\Microsoft.Web.Publishing.Tasks.dll
+
- .
+ .
+ $(CefSharpTargetDir)\x86
+ $(CefSharpTargetDir)\x64
+
+
+
+
+
+
+
+ runtimes\win-x64\lib\netcoreapp3.0
+
+
+
+
+ runtimes\win-x86\lib\netcoreapp3.0
+
+
+
+
+ runtimes\win-x86\lib\netcoreapp3.0
+ runtimes\win-x64\lib\netcoreapp3.0
+
+
+
+
+
+
+
+
-
-
-
- $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
- $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
-
-
-
- $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
- $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
-
-
-
- $(CefSharpTargetDir)\x86\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
- $(CefSharpTargetDir)\x64\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
- $(CefSharpTargetDir)\x86\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
- $(CefSharpTargetDir)\x64\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
-
+
+
+
+
+
+ $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
+ PreserveNewest
+ Included
+ false
+
+
+ $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
+ PreserveNewest
+ Included
+ false
+
+
+
+
+
+
+ $(CefSharpTargetDirAnyCpu32)\%(RecursiveDir)%(FileName)%(Extension)
+ PreserveNewest
+ Included
+ false
+
+
+ $(CefSharpTargetDirAnyCpu64)\%(RecursiveDir)%(FileName)%(Extension)
+ PreserveNewest
+ Included
+ false
+
+
+ $(CefSharpTargetDirAnyCpu32)\%(RecursiveDir)%(FileName)%(Extension)
+ PreserveNewest
+ Included
+ false
+
+
+ $(CefSharpTargetDirAnyCpu64)\%(RecursiveDir)%(FileName)%(Extension)
+ PreserveNewest
+ Included
+ false
+
+
+
+ $(CefSharpTargetDirAnyCpu32)\%(RecursiveDir)%(FileName)%(Extension)
+ PreserveNewest
+ Included
+ false
+
+
+ $(CefSharpTargetDirAnyCpu64)\%(RecursiveDir)%(FileName)%(Extension)
+ PreserveNewest
+ Included
+ false
+
+
+
+
+
+
+
+ $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
+ PreserveNewest
+ Included
+ false
+
+
+ $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
+ PreserveNewest
+ Included
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/NuGet/CefSharp.OffScreen.nuspec b/NuGet/CefSharp.OffScreen.nuspec
index 5719d7f412..b84d48664f 100644
--- a/NuGet/CefSharp.OffScreen.nuspec
+++ b/NuGet/CefSharp.OffScreen.nuspec
@@ -27,18 +27,9 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/NuGet/CefSharp.OffScreen.props b/NuGet/CefSharp.OffScreen.props
deleted file mode 100644
index c532925b66..0000000000
--- a/NuGet/CefSharp.OffScreen.props
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(MSBuildThisFileDirectory)..\CefSharp\x64\CefSharp.OffScreen.dll
- False
-
-
-
-
-
-
-
- $(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.OffScreen.dll
- False
-
-
-
-
-
diff --git a/NuGet/CefSharp.OffScreen.targets b/NuGet/CefSharp.OffScreen.targets
deleted file mode 100644
index 714a13c96a..0000000000
--- a/NuGet/CefSharp.OffScreen.targets
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
- .
-
-
-
-
-
-
-
-
-
- $(CefSharpTargetDir)\x86\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
- $(CefSharpTargetDir)\x64\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
-
-
-
-
- $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
-
-
-
-
-
- $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
-
-
-
diff --git a/NuGet/CefSharp.WinForms.nuspec b/NuGet/CefSharp.WinForms.nuspec
index 454b4796c6..2be89586dd 100644
--- a/NuGet/CefSharp.WinForms.nuspec
+++ b/NuGet/CefSharp.WinForms.nuspec
@@ -27,18 +27,9 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/NuGet/CefSharp.WinForms.props b/NuGet/CefSharp.WinForms.props
deleted file mode 100644
index 0451d0319f..0000000000
--- a/NuGet/CefSharp.WinForms.props
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(MSBuildThisFileDirectory)..\CefSharp\x64\CefSharp.WinForms.dll
- False
-
-
-
-
-
-
-
- $(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.WinForms.dll
- False
-
-
-
-
-
diff --git a/NuGet/CefSharp.WinForms.targets b/NuGet/CefSharp.WinForms.targets
deleted file mode 100644
index 9a10ec14b1..0000000000
--- a/NuGet/CefSharp.WinForms.targets
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
- .
-
-
-
-
-
-
-
-
-
- $(CefSharpTargetDir)\x86\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
- $(CefSharpTargetDir)\x64\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
-
-
-
-
- $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
-
-
-
-
-
- $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
-
-
-
diff --git a/NuGet/CefSharp.Wpf.nuspec b/NuGet/CefSharp.Wpf.nuspec
index 5f230b32ed..b1fbce7f6d 100644
--- a/NuGet/CefSharp.Wpf.nuspec
+++ b/NuGet/CefSharp.Wpf.nuspec
@@ -27,18 +27,9 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/NuGet/CefSharp.Wpf.props b/NuGet/CefSharp.Wpf.props
deleted file mode 100644
index ea7c745140..0000000000
--- a/NuGet/CefSharp.Wpf.props
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(MSBuildThisFileDirectory)..\CefSharp\x64\CefSharp.Wpf.dll
- False
-
-
-
-
-
-
-
- $(MSBuildThisFileDirectory)..\CefSharp\x86\CefSharp.Wpf.dll
- False
-
-
-
-
-
diff --git a/NuGet/CefSharp.Wpf.targets b/NuGet/CefSharp.Wpf.targets
deleted file mode 100644
index 1e83a5650e..0000000000
--- a/NuGet/CefSharp.Wpf.targets
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
- .
-
-
-
-
-
-
-
-
-
- $(CefSharpTargetDir)\x86\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
- $(CefSharpTargetDir)\x64\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
-
-
-
-
- $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
-
-
-
-
-
- $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
-
-
-
-
-
diff --git a/NuGet/PackageReference/CefSharp.Common.NETCore.nuspec b/NuGet/PackageReference/CefSharp.Common.NETCore.nuspec
index cc9ed29227..f080228b32 100644
--- a/NuGet/PackageReference/CefSharp.Common.NETCore.nuspec
+++ b/NuGet/PackageReference/CefSharp.Common.NETCore.nuspec
@@ -21,7 +21,8 @@
-
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
diff --git a/NuGet/PackageReference/CefSharp.Common.NETCore.targets b/NuGet/PackageReference/CefSharp.Common.NETCore.targets
index 7eb2b0f109..92f9cb138b 100644
--- a/NuGet/PackageReference/CefSharp.Common.NETCore.targets
+++ b/NuGet/PackageReference/CefSharp.Common.NETCore.targets
@@ -8,12 +8,14 @@
PreserveNewest
Included
false
+ true
swiftshader\%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
+ true
@@ -24,48 +26,48 @@
PreserveNewest
Included
false
+ true
swiftshader\%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
+ true
-
-
+
+
runtimes\win-x86\native\locales\%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
+ true
runtimes\win-x86\native\swiftshader\%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
-
-
- runtimes\win-x86\native\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
+ true
runtimes\win-x86\native\%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
+ true
runtimes\win-x86\native\%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
+ true
@@ -73,30 +75,28 @@
PreserveNewest
Included
false
+ true
runtimes\win-x64\native\swiftshader\%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
-
-
- runtimes\win-x64\native\%(RecursiveDir)%(FileName)%(Extension)
- PreserveNewest
- Included
- false
+ true
runtimes\win-x64\native\%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
+ true
runtimes\win-x64\native\%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
+ true
diff --git a/build.netcore.ps1 b/build.netcore.ps1
index 16569c53b5..9368764e33 100644
--- a/build.netcore.ps1
+++ b/build.netcore.ps1
@@ -12,9 +12,9 @@ $WorkingDir = split-path -parent $MyInvocation.MyCommand.Definition
$CefSln = Join-Path $WorkingDir 'CefSharp3.netcore.sln'
$nuget = Join-Path $WorkingDir .\nuget\NuGet.exe
-# Extract the current CEF Redist version from the CefSharp.Core\packages.CefSharp.Core.config file
+# Extract the current CEF Redist version from the CefSharp.Runtime.Core\packages.CefSharp.Core.config file
# Save having to update this file manually Example 3.2704.1418
-$CefSharpCorePackagesXml = [xml](Get-Content (Join-Path $WorkingDir 'CefSharp.Core\packages.CefSharp.Core.netcore.config'))
+$CefSharpCorePackagesXml = [xml](Get-Content (Join-Path $WorkingDir 'CefSharp.Core.Runtime\packages.CefSharp.Core.Runtime.netcore.config'))
$RedistVersion = $CefSharpCorePackagesXml.SelectSingleNode("//packages/package[@id='cef.sdk']/@version").value
function Write-Diagnostic
@@ -169,7 +169,7 @@ function Compile
Write-Diagnostic "Restore Nuget Packages"
# Restore packages
- . $nuget restore CefSharp.Core\packages.CefSharp.Core.netcore.config -PackagesDirectory packages
+ . $nuget restore CefSharp.Core.Runtime\packages.CefSharp.Core.Runtime.netcore.config -PackagesDirectory packages
. $nuget restore CefSharp.BrowserSubprocess.Core\packages.CefSharp.BrowserSubprocess.Core.netcore.config -PackagesDirectory packages
&msbuild /t:restore CefSharp3.netcore.sln
@@ -320,7 +320,7 @@ WriteVersionToManifest "CefSharp.WinForms.Example\app.manifest"
WriteVersionToManifest "CefSharp.Wpf.Example\app.manifest"
WriteVersionToResourceFile "CefSharp.BrowserSubprocess.Core\Resource.rc"
-WriteVersionToResourceFile "CefSharp.Core\Resource.rc"
+WriteVersionToResourceFile "CefSharp.Core.Runtime\Resource.rc"
switch -Exact ($Target)
{
diff --git a/build.ps1 b/build.ps1
index 9a120763d8..24546f7f88 100644
--- a/build.ps1
+++ b/build.ps1
@@ -1,5 +1,5 @@
param(
- [ValidateSet("vs2015", "vs2017", "vs2019", "nupkg-only", "gitlink")]
+ [ValidateSet("vs2015", "vs2017", "vs2019", "nupkg-only")]
[Parameter(Position = 0)]
[string] $Target = "vs2015",
[Parameter(Position = 1)]
@@ -11,9 +11,9 @@
$WorkingDir = split-path -parent $MyInvocation.MyCommand.Definition
$CefSln = Join-Path $WorkingDir 'CefSharp3.sln'
-# Extract the current CEF Redist version from the CefSharp.Core\packages.CefSharp.Core.config file
+# Extract the current CEF Redist version from the CefSharp.Core.Runtime\packages.CefSharp.Core.Runtime.config file
# Save having to update this file manually Example 3.2704.1418
-$CefSharpCorePackagesXml = [xml](Get-Content (Join-Path $WorkingDir 'CefSharp.Core\packages.CefSharp.Core.config'))
+$CefSharpCorePackagesXml = [xml](Get-Content (Join-Path $WorkingDir 'CefSharp.Core.Runtime\packages.CefSharp.Core.Runtime.config'))
$RedistVersion = $CefSharpCorePackagesXml.SelectSingleNode("//packages/package[@id='cef.sdk']/@version").value
function Write-Diagnostic
@@ -312,33 +312,6 @@ function DownloadNuget()
}
}
-function UpdateSymbolsWithGitLink()
-{
- $gitlink = "GitLink.exe"
-
- #Check for GitLink
- if ((Get-Command $gitlink -ErrorAction SilentlyContinue) -eq $null)
- {
- #Download if not on path and not in Nuget folder (TODO: change to different folder)
- $gitlink = Join-Path $WorkingDir .\nuget\GitLink.exe
- if(-not (Test-Path $gitlink))
- {
- Write-Diagnostic "Downloading GitLink"
- #Powershell is having problems download GitLink SSL/TLS error, force TLS 1.2
- #https://stackoverflow.com/a/55809878/4583726
- [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::TLS12
- $client = New-Object System.Net.WebClient;
- $client.DownloadFile('https://github.com/GitTools/GitLink/releases/download/2.3.0/GitLink.exe', $gitlink);
- }
- }
-
- Write-Diagnostic "GitLink working dir : $WorkingDir"
-
- # Run GitLink in the workingDir
- . $gitlink $WorkingDir -f CefSharp3.sln -u https://github.com/CefSharp/CefSharp -c Release -p x64 -ignore CefSharp.Example`,CefSharp.Wpf.Example`,CefSharp.OffScreen.Example`,CefSharp.WinForms.Example
- . $gitlink $WorkingDir -f CefSharp3.sln -u https://github.com/CefSharp/CefSharp -c Release -p x86 -ignore CefSharp.Example`,CefSharp.Wpf.Example`,CefSharp.OffScreen.Example`,CefSharp.WinForms.Example
-}
-
function WriteAssemblyVersion
{
param()
@@ -371,6 +344,19 @@ function WriteVersionToManifest($manifest)
[System.IO.File]::WriteAllLines($Filename, $NewString, $Utf8NoBomEncoding)
}
+function WriteVersionToTransform($transform)
+{
+ $Filename = Join-Path $WorkingDir $transform
+ $Regex = 'codeBase version="(.*?)"';
+
+ $TransformData = Get-Content -Encoding UTF8 $Filename
+ $NewString = $TransformData -replace $Regex, "codeBase version=""$AssemblyVersion.0"""
+
+ $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
+ [System.IO.File]::WriteAllLines($Filename, $NewString, $Utf8NoBomEncoding)
+}
+
+
function WriteVersionToResourceFile($resourceFile)
{
$Filename = Join-Path $WorkingDir $resourceFile
@@ -432,8 +418,11 @@ WriteVersionToManifest "CefSharp.OffScreen.Example\app.manifest"
WriteVersionToManifest "CefSharp.WinForms.Example\app.manifest"
WriteVersionToManifest "CefSharp.Wpf.Example\app.manifest"
+WriteVersionToTransform "NuGet\CefSharp.Common.app.config.x64.transform"
+WriteVersionToTransform "NuGet\CefSharp.Common.app.config.x86.transform"
+
WriteVersionToResourceFile "CefSharp.BrowserSubprocess.Core\Resource.rc"
-WriteVersionToResourceFile "CefSharp.Core\Resource.rc"
+WriteVersionToResourceFile "CefSharp.Core.Runtime\Resource.rc"
switch -Exact ($Target)
{
@@ -441,26 +430,19 @@ switch -Exact ($Target)
{
Nupkg
}
- "gitlink"
- {
- UpdateSymbolsWithGitLink
- }
"vs2015"
{
VSX v140
- UpdateSymbolsWithGitLink
Nupkg
}
"vs2017"
{
VSX v141
- UpdateSymbolsWithGitLink
Nupkg
}
"vs2019"
{
VSX v142
- UpdateSymbolsWithGitLink
Nupkg
}
}