Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
amaitland authored Apr 5, 2019
2 parents ee0749a + ea843f3 commit d9f522b
Show file tree
Hide file tree
Showing 88 changed files with 2,364 additions and 707 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ csharp_new_line_between_query_expression_clauses =
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = false
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current

Expand Down
58 changes: 56 additions & 2 deletions CefSharp.BrowserSubprocess.Core/CefAppUnmanagedWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@
#include "CefAppUnmanagedWrapper.h"
#include "RegisterBoundObjectHandler.h"
#include "JavascriptRootObjectWrapper.h"
#include "Async\JavascriptAsyncMethodCallback.h"
#include "Serialization\V8Serialization.h"
#include "Serialization\JsObjectsSerialization.h"
#include "Async\JavascriptAsyncMethodCallback.h"
#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"

using namespace System;
using namespace System::Diagnostics;
using namespace System::Collections::Generic;
using namespace CefSharp::BrowserSubprocess;
using namespace CefSharp::Internals::Messaging;
using namespace CefSharp::Internals::Serialization;

Expand Down Expand Up @@ -62,6 +66,15 @@ namespace CefSharp

void CefAppUnmanagedWrapper::OnContextCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context)
{
if (!Object::ReferenceEquals(_handler, nullptr))
{
Browser browserWrapper(browser);
Frame frameWrapper(frame);
V8Context contextWrapper(context);

_handler->OnContextCreated(%browserWrapper, %frameWrapper, %contextWrapper);
}

if (_legacyBindingEnabled)
{
if (_javascriptObjects->Count > 0)
Expand Down Expand Up @@ -115,6 +128,15 @@ namespace CefSharp

void CefAppUnmanagedWrapper::OnContextReleased(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context)
{
if (!Object::ReferenceEquals(_handler, nullptr))
{
Browser browserWrapper(browser);
Frame frameWrapper(frame);
V8Context contextWrapper(context);

_handler->OnContextReleased(%browserWrapper, %frameWrapper, %contextWrapper);
}

auto contextReleasedMessage = CefProcessMessage::Create(kOnContextReleasedRequest);

SetInt64(contextReleasedMessage->GetArgumentList(), 0, frame->GetIdentifier());
Expand Down Expand Up @@ -674,7 +696,39 @@ namespace CefSharp
{
for each (CefCustomScheme^ scheme in _schemes->AsReadOnly())
{
registrar->AddCustomScheme(StringUtils::ToNative(scheme->SchemeName), scheme->IsStandard, scheme->IsLocal, scheme->IsDisplayIsolated, scheme->IsSecure, scheme->IsCorsEnabled, scheme->IsCSPBypassing);
int options = cef_scheme_options_t::CEF_SCHEME_OPTION_NONE;

if (scheme->IsStandard)
{
options |= cef_scheme_options_t::CEF_SCHEME_OPTION_STANDARD;
}

if (scheme->IsLocal)
{
options |= cef_scheme_options_t::CEF_SCHEME_OPTION_LOCAL;
}

if (scheme->IsDisplayIsolated)
{
options |= cef_scheme_options_t::CEF_SCHEME_OPTION_DISPLAY_ISOLATED;
}

if (scheme->IsSecure)
{
options |= cef_scheme_options_t::CEF_SCHEME_OPTION_SECURE;
}

if (scheme->IsCorsEnabled)
{
options |= cef_scheme_options_t::CEF_SCHEME_OPTION_CORS_ENABLED;
}

if (scheme->IsCSPBypassing)
{
options |= cef_scheme_options_t::CEF_SCHEME_OPTION_CSP_BYPASSING;
}

registrar->AddCustomScheme(StringUtils::ToNative(scheme->SchemeName), options);
}
}
}
5 changes: 4 additions & 1 deletion CefSharp.BrowserSubprocess.Core/CefAppUnmanagedWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
#include "RegisterBoundObjectRegistry.h"

using namespace System::Collections::Generic;
using namespace CefSharp::RenderProcess;

namespace CefSharp
{
// This class is the native subprocess level CEF object wrapper.
private class CefAppUnmanagedWrapper : CefApp, CefRenderProcessHandler
{
private:
gcroot<IRenderProcessHandler^> _handler;
gcroot<Action<CefBrowserWrapper^>^> _onBrowserCreated;
gcroot<Action<CefBrowserWrapper^>^> _onBrowserDestroyed;
gcroot<ConcurrentDictionary<int, CefBrowserWrapper^>^> _browserWrappers;
Expand All @@ -35,8 +37,9 @@ namespace CefSharp
public:
static const CefString kPromiseCreatorScript;

CefAppUnmanagedWrapper(List<CefCustomScheme^>^ schemes, bool enableFocusedNodeChanged, Action<CefBrowserWrapper^>^ onBrowserCreated, Action<CefBrowserWrapper^>^ onBrowserDestoryed)
CefAppUnmanagedWrapper(IRenderProcessHandler^ handler, List<CefCustomScheme^>^ schemes, bool enableFocusedNodeChanged, Action<CefBrowserWrapper^>^ onBrowserCreated, Action<CefBrowserWrapper^>^ onBrowserDestoryed)
{
_handler = handler;
_onBrowserCreated = onBrowserCreated;
_onBrowserDestroyed = onBrowserDestoryed;
_browserWrappers = gcnew ConcurrentDictionary<int, CefBrowserWrapper^>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\cef.sdk.3.3626.1895\build\cef.sdk.props" Condition="Exists('..\packages\cef.sdk.3.3626.1895\build\cef.sdk.props')" />
<Import Project="..\packages\cef.sdk.73.1.12\build\cef.sdk.props" Condition="Exists('..\packages\cef.sdk.73.1.12\build\cef.sdk.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
Expand Down Expand Up @@ -177,6 +177,9 @@
<ClInclude Include="Async\JavascriptAsyncMethodWrapper.h" />
<ClInclude Include="Async\JavascriptAsyncObjectWrapper.h" />
<ClInclude Include="CefAppUnmanagedWrapper.h" />
<ClInclude Include="Wrapper\Frame.h" />
<ClInclude Include="Wrapper\Browser.h" />
<ClInclude Include="Wrapper\V8Context.h" />
<ClInclude Include="RegisterBoundObjectHandler.h" />
<ClInclude Include="RegisterBoundObjectRegistry.h" />
<ClInclude Include="resource.h" />
Expand Down Expand Up @@ -206,6 +209,8 @@
<ClCompile Include="Async\JavascriptAsyncMethodWrapper.cpp" />
<ClCompile Include="Async\JavascriptAsyncObjectWrapper.cpp" />
<ClCompile Include="CefAppUnmanagedWrapper.cpp" />
<ClCompile Include="Wrapper\Frame.cpp" />
<ClCompile Include="Wrapper\Browser.cpp" />
<ClCompile Include="WcfEnabledSubProcess.cpp" />
<ClCompile Include="JavascriptCallbackRegistry.cpp" />
<ClCompile Include="JavascriptMethodHandler.cpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@
<ClInclude Include="RegisterBoundObjectRegistry.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Wrapper\Frame.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Wrapper\Browser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Wrapper\V8Context.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="AssemblyInfo.cpp">
Expand Down Expand Up @@ -157,6 +166,12 @@
<ClCompile Include="WcfEnabledSubProcess.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Wrapper\Frame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Wrapper\Browser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Resource.rc" />
Expand Down
8 changes: 4 additions & 4 deletions CefSharp.BrowserSubprocess.Core/Resource.rc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
1 VERSIONINFO
FILEVERSION 72.0.0
PRODUCTVERSION 72.0.0
FILEVERSION 73.1.12.0
PRODUCTVERSION 73.1.12.0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -16,10 +16,10 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "CefSharp.BrowserSubprocess.Core"
VALUE "FileVersion", "72.0.0"
VALUE "FileVersion", "73.1.12.0"
VALUE "LegalCopyright", "Copyright © 2019 The CefSharp Authors"
VALUE "ProductName", "CefSharp"
VALUE "ProductVersion", "72.0.0"
VALUE "ProductVersion", "73.1.12.0"
END
END
BLOCK "VarFileInfo"
Expand Down
5 changes: 3 additions & 2 deletions CefSharp.BrowserSubprocess.Core/SubProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using namespace System::Collections::Generic;
using namespace System::Linq;
using namespace CefSharp::Internals;
using namespace CefSharp::RenderProcess;

namespace CefSharp
{
Expand All @@ -26,14 +27,14 @@ namespace CefSharp
MCefRefPtr<CefAppUnmanagedWrapper> _cefApp;

public:
SubProcess(IEnumerable<String^>^ args)
SubProcess(IRenderProcessHandler^ handler, IEnumerable<String^>^ args)
{
auto onBrowserCreated = gcnew Action<CefBrowserWrapper^>(this, &SubProcess::OnBrowserCreated);
auto onBrowserDestroyed = gcnew Action<CefBrowserWrapper^>(this, &SubProcess::OnBrowserDestroyed);
auto schemes = CefCustomScheme::ParseCommandLineArguments(args);
auto enableFocusedNodeChanged = CommandLineArgsParser::HasArgument(args, CefSharpArguments::FocusedNodeChangedEnabledArgument);

_cefApp = new CefAppUnmanagedWrapper(schemes, enableFocusedNodeChanged, onBrowserCreated, onBrowserDestroyed);
_cefApp = new CefAppUnmanagedWrapper(handler, schemes, enableFocusedNodeChanged, onBrowserCreated, onBrowserDestroyed);
}

!SubProcess()
Expand Down
5 changes: 3 additions & 2 deletions CefSharp.BrowserSubprocess.Core/WcfEnabledSubProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "CefBrowserWrapper.h"

using namespace System;
using namespace CefSharp::RenderProcess;

namespace CefSharp
{
Expand All @@ -25,7 +26,7 @@ namespace CefSharp
int _parentProcessId;

public:
WcfEnabledSubProcess(int parentProcessId, IEnumerable<String^>^ args) : SubProcess(args)
WcfEnabledSubProcess(int parentProcessId, IRenderProcessHandler^ handler, IEnumerable<String^>^ args) : SubProcess(handler,args)
{
_parentProcessId = parentProcessId;
}
Expand All @@ -34,4 +35,4 @@ namespace CefSharp
void OnBrowserDestroyed(CefBrowserWrapper^ browser) override;
};
}
}
}
Loading

0 comments on commit d9f522b

Please sign in to comment.