diff --git a/NativeMessaging/Host.cs b/NativeMessaging/Host.cs
index c62337f..32c95fe 100644
--- a/NativeMessaging/Host.cs
+++ b/NativeMessaging/Host.cs
@@ -9,6 +9,7 @@ namespace NativeMessaging
public abstract class Host
{
private readonly bool SendConfirmationReceipt;
+ private readonly bool CheckIsRegistered;
private readonly string ManifestPath;
///
@@ -25,11 +26,13 @@ public abstract class Host
/// Creates the Host object
///
/// for the host to automatically send message confirmation receipt.
- public Host(bool sendConfirmationReceipt = true)
+ /// /// for the host to check if it is registered before listening.
+ public Host(bool sendConfirmationReceipt = true, bool checkIsRegistered = true)
{
SupportedBrowsers = new List(2);
SendConfirmationReceipt = sendConfirmationReceipt;
+ CheckIsRegistered = checkIsRegistered;
ManifestPath
= Path.Combine(
@@ -42,7 +45,7 @@ public Host(bool sendConfirmationReceipt = true)
///
public void Listen()
{
- if (!IsRegistered())
+ if (CheckIsRegistered && !IsRegistered())
{
throw new NotRegisteredWithBrowserException(Hostname);
}
@@ -155,7 +158,7 @@ public void RemoveManifest()
#region Browser Registration
///
- /// Checks if the host is registered with all required browsers.
+ /// Checks if the host is registered with any of the supported browsers.
///
/// if the required information is present in the registry.
public bool IsRegistered()
diff --git a/NativeMessagingTest/MyHost.cs b/NativeMessagingTest/MyHost.cs
index 4ed4241..456230d 100644
--- a/NativeMessagingTest/MyHost.cs
+++ b/NativeMessagingTest/MyHost.cs
@@ -6,13 +6,14 @@ namespace NativeMessagingTest
public class MyHost : Host
{
private const bool SendConfirmationReceipt = true;
+ private const bool CheckIsRegistered = true;
public override string Hostname
{
get { return "com.google.chrome.example.echo"; }
}
- public MyHost() : base(SendConfirmationReceipt)
+ public MyHost() : base(SendConfirmationReceipt, CheckIsRegistered)
{
}