Skip to content

Commit

Permalink
Rearranged to be more structured.
Browse files Browse the repository at this point in the history
  • Loading branch information
perlun committed Sep 2, 2013
1 parent 8d09375 commit 0645da4
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 33 deletions.
12 changes: 12 additions & 0 deletions CefSharp.BrowserSubprocess/CefRenderProcess.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright © 2013 The CefSharp Project. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

#include "include/cef_app.h"

int ExecuteCefRenderProcess(HINSTANCE hInstance)
{
CefMainArgs main_args(hInstance);
CefRefPtr<CefApp> app;
return CefExecuteProcess(main_args, app);
}
2 changes: 2 additions & 0 deletions CefSharp.BrowserSubprocess/CefSharp.BrowserSubprocess.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@
<Reference Include="System.ServiceModel" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="CefRenderProcess.h" />
<ClInclude Include="JavascriptProxy.h" />
<ClInclude Include="JavascriptProxyService.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
<ClInclude Include="JavascriptProxy.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="JavascriptProxyService.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CefRenderProcess.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Program.cpp">
Expand Down
2 changes: 1 addition & 1 deletion CefSharp.BrowserSubprocess/JavascriptProxy.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2010-2013 The CefSharp Project. All rights reserved.
// Copyright © 2013 The CefSharp Project. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Expand Down
36 changes: 36 additions & 0 deletions CefSharp.BrowserSubprocess/JavascriptProxyService.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright © 2013 The CefSharp Project. 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 "JavascriptProxy.h"

using namespace CefSharp::Internals::JavascriptBinding;
using namespace CefSharp::BrowserSubprocess;
using namespace System;
using namespace System::ServiceModel;
using namespace System::Threading;

static void ThreadEntryPoint();

void CreateJavascriptProxyServiceHost()
{
auto thread = gcnew Thread(gcnew ThreadStart(ThreadEntryPoint));
thread->Start();
}

void ThreadEntryPoint()
{
auto uris = gcnew array<Uri^>(1);
uris[0] = gcnew Uri(JavascriptProxy::BaseAddress);

auto host = gcnew ServiceHost(JavascriptProxy::typeid, uris);
host->AddServiceEndpoint(
IJavascriptProxy::typeid,
gcnew NetNamedPipeBinding(),
JavascriptProxy::ServiceName
);

host->Open();
}
37 changes: 5 additions & 32 deletions CefSharp.BrowserSubprocess/Program.cpp
Original file line number Diff line number Diff line change
@@ -1,39 +1,12 @@
// Copyright © 2010-2013 The CefSharp Project. All rights reserved.
// Copyright © 2013 The CefSharp Project. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

#include "include/cef_app.h"
#include "JavascriptProxy.h"

using namespace CefSharp::Internals::JavascriptBinding;
using namespace CefSharp::BrowserSubprocess;
using namespace System;
using namespace System::ServiceModel;
using namespace System::Threading;

static void threadEntryPoint();
#include "CefRenderProcess.h"
#include "JavascriptProxyService.h"

int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
auto thread = gcnew Thread(gcnew ThreadStart(threadEntryPoint));
thread->Start();

CefMainArgs main_args(hInstance);
CefRefPtr<CefApp> app;
return CefExecuteProcess(main_args, app);
}

void threadEntryPoint()
{
auto uris = gcnew array<Uri^>(1);
uris[0] = gcnew Uri(JavascriptProxy::BaseAddress);

auto host = gcnew ServiceHost(JavascriptProxy::typeid, uris);
host->AddServiceEndpoint(
IJavascriptProxy::typeid,
gcnew NetNamedPipeBinding(),
JavascriptProxy::ServiceName
);

host->Open();
CreateJavascriptProxyServiceHost();
return ExecuteCefRenderProcess(hInstance);
}

0 comments on commit 0645da4

Please sign in to comment.