Skip to content

Commit

Permalink
Merge pull request cefsharp#398 from JanEggers/Resharped
Browse files Browse the repository at this point in the history
Resharped
  • Loading branch information
jornh committed Jun 13, 2014
2 parents a9cf8c3 + 0abd868 commit 6ca98c0
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 39 deletions.
9 changes: 3 additions & 6 deletions CefSharp.Test/BrowserTest.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using System;
using System.Threading;
using CefSharp.Wpf;
using Xunit;
using Xunit;
using Xunit.Extensions;

namespace CefSharp.Test
{
public class BrowserTest
{
[Theory()]
[Theory]
[InlineData("'2'", "2")]
[InlineData("2+2", 4)]
public void EvaluateScriptTest(string script, object result)
Expand All @@ -20,7 +17,7 @@ public void EvaluateScriptTest(string script, object result)
}
}

[Theory()]
[Theory]
[InlineData("!!!")]
public void EvaluateScriptExceptionTest(string script)
{
Expand Down
3 changes: 0 additions & 3 deletions CefSharp.Test/DispatcherThread.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Threading;
Expand Down
15 changes: 8 additions & 7 deletions CefSharp.Test/Fixture.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Threading;
//using NUnit.Framework;
using System.Threading.Tasks;
using System.Windows;
using CefSharp.Wpf;
Expand All @@ -26,11 +25,13 @@ public Task Initialize()
{
Window = new Window();

var cefsettings = new CefSettings();
cefsettings.BrowserSubprocessPath = Path.Combine( Environment.CurrentDirectory, "CefSharp.BrowserSubprocess.exe" );
cefsettings.LogSeverity = LogSeverity.Verbose;
cefsettings.LocalesDirPath = Path.Combine(Environment.CurrentDirectory, "locales");
cefsettings.PackLoadingDisabled = true;
var cefsettings = new CefSettings
{
BrowserSubprocessPath = Path.Combine(Environment.CurrentDirectory, "CefSharp.BrowserSubprocess.exe"),
LogSeverity = LogSeverity.Verbose,
LocalesDirPath = Path.Combine(Environment.CurrentDirectory, "locales"),
PackLoadingDisabled = true
};

if (!Cef.Initialize(cefsettings))
{
Expand All @@ -40,7 +41,7 @@ public Task Initialize()
Window.Content = Browser = new ChromiumWebBrowser();

Window.Show();
}).ContinueWith((t) =>
}).ContinueWith(t =>
{
if (t.IsFaulted)
{
Expand Down
14 changes: 6 additions & 8 deletions CefSharp.Wpf/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ namespace CefSharp.Wpf
{
public class ChromiumWebBrowser : ContentControl, IRenderWebBrowser, IWpfWebBrowser
{
private static readonly Key[] KeysToSendtoBrowser = new[] {
private static readonly Key[] KeysToSendtoBrowser =
{
Key.Tab,
Key.Home, Key.End,
Key.Left, Key.Right,
Expand Down Expand Up @@ -557,13 +558,10 @@ private void Transform(FrameworkElement element)

private void CheckIsNonStandardDpi()
{
if (matrix != null) // make sure it's connected
{
dpiTransform = new ScaleTransform(
1 / matrix.M11,
1 / matrix.M22
);
}
dpiTransform = new ScaleTransform(
1 / matrix.M11,
1 / matrix.M22
);
}

private void AddSourceHookIfNotAlreadyPresent()
Expand Down
4 changes: 1 addition & 3 deletions CefSharp/IRequestHandler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Net;

namespace CefSharp
namespace CefSharp
{
public interface IRequestHandler
{
Expand Down
4 changes: 1 addition & 3 deletions CefSharp/IWebPluginInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;

namespace CefSharp
namespace CefSharp
{
/// <summary>
/// Wrapper for the CEF3 CefWebPluginInfo
Expand Down
11 changes: 5 additions & 6 deletions CefSharp/Internals/CefSubprocess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,17 @@ public void FindParentProcessId(IEnumerable<string> args)
return;
}

var parentProcessId = channelArgument
var parentProcessIdString = channelArgument
.Substring(channelPrefix.Length)
.Split('.')
.First();
ParentProcessId = int.Parse(parentProcessId);
parentProcessId = int.Parse(parentProcessIdString);
}


private SubProcessServiceHost javascriptServiceHost;
private CefBrowserBase browser;

public int? ParentProcessId { get; private set; }
private int? parentProcessId;

public CefBrowserBase Browser
{
Expand All @@ -66,12 +65,12 @@ public override void OnBrowserCreated(CefBrowserBase cefBrowserWrapper)
{
browser = cefBrowserWrapper;

if (ParentProcessId == null)
if (parentProcessId == null)
{
return;
}

Task.Factory.StartNew(() => javascriptServiceHost = SubProcessServiceHost.Create(ParentProcessId.Value, cefBrowserWrapper.BrowserId));
Task.Factory.StartNew(() => javascriptServiceHost = SubProcessServiceHost.Create(parentProcessId.Value, cefBrowserWrapper.BrowserId));
}
}
}
2 changes: 1 addition & 1 deletion CefSharp/Internals/Kernel32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace CefSharp.Internals
{
public class Kernel32
public static class Kernel32
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern void OutputDebugString(string message);
Expand Down
2 changes: 1 addition & 1 deletion CefSharp/Internals/SubProcessProxySupport.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace CefSharp.Internals
{
public class SubProcessProxySupport
public static class SubProcessProxySupport
{
private const string BaseAddress = "net.pipe://localhost";
private const string ServiceName = "CefSharpSubProcessProxy";
Expand Down
3 changes: 2 additions & 1 deletion CefSharp/Internals/SubProcessServiceHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static SubProcessServiceHost Create(int parentProcessId, int browserId)
var host = new SubProcessServiceHost();
AddDebugBehavior(host);

//use absultadress for hosting
//use absolute address for hosting
//http://stackoverflow.com/questions/10362246/two-unique-named-pipes-conflicting-and-invalidcredentialexception
var serviceName = SubProcessProxySupport.GetServiceName(parentProcessId, browserId);

Expand Down Expand Up @@ -49,6 +49,7 @@ private static void KillExistingServiceIfNeeded(string serviceName)
var javascriptProxy = channelFactory.CreateChannel();
javascriptProxy.Terminate();
}
// ReSharper disable once EmptyGeneralCatchClause
catch
{
// We assume errors at this point are caused by things like the endpoint not being present (which will happen in
Expand Down

0 comments on commit 6ca98c0

Please sign in to comment.