void ICefWebBrowserInternal.OnLoadEnd(LoadEndEventArgs e)
        {
            // Reset the flags used to indicate that the resource associated
            // with the main frame is not acessible or has a cert error.
            _mainFrameResourceNotAccessible = false;
            _mainFrameCertificateError      = false;

            this.DispatchIfRequired(() =>
            {
                try
                {
                    // If the source URI has changed since navigation was started, initiate naviagation again.
                    if (!_sourceUrl.Equals(_currentUrl))
                    {
                        NavigateTo(_sourceUrl);
                    }

                    ExecuteJavaScript(StaticWebContent.GetOnLoadEndScript());
                }
                catch (Exception ex)
                {
                    Logger.Error("Error in OnLoadEnd : {0}", ex);
                }
                finally
                {
                    if (LoadEnd != null)
                    {
                        LoadEnd(this, e);
                    }
                }
            },
                                    true);
        }
 void ICefWebBrowserInternal.OnLoadError(LoadErrorEventArgs e)
 {
     // OnLoadError is called when an error occurs while loading the main frame
     // resource (resource of type CefResourceType.MainFrame). OnLoadError is not
     // called when child resources of the main frame (scripts, etc) fail to load.
     this.DispatchIfRequired(() =>
     {
         try
         {
             if (_mainFrameCertificateError)
             {
                 var html = StaticWebContent.GetInvalidCertErrorPage(e.FailedUrl);
                 e.Frame.LoadString(html, PackagedApplicationSchemeHandlerFactory.ErrorPage);
                 Logger.Error("Unable to load the main frame due to an invalid certifiate: " + e.FailedUrl);
             }
             else if (_mainFrameResourceNotAccessible)
             {
                 // The resource associated with the main frame is not accessible.
                 // The domain may not be whitelisted, etc.
                 var html = StaticWebContent.GetResourceNotAccessibleErrorPage(e.FailedUrl);
                 e.Frame.LoadString(html, PackagedApplicationSchemeHandlerFactory.ErrorPage);
                 Logger.Error("Main frame resource not accessible: " + e.FailedUrl);
             }
             else if (e.ErrorCode != CefErrorCode.Aborted)
             {
                 // The main frame failed to load for some reason. Show the default error
                 // page along with any error text that may have been provided.
                 var html = StaticWebContent.GetLoadErrorPage(e.FailedUrl, e.ErrorText, ParagonLogManager.CurrentParagonLogFile);
                 e.Frame.LoadString(html, PackagedApplicationSchemeHandlerFactory.ErrorPage);
                 Logger.Error("Error loading the main frame: url = {0}, Error = {1} {2}", e.FailedUrl, e.ErrorCode, e.ErrorText);
             }
             else
             {
                 // In various situations, OnLoadError is called with CefErrorCode.Aborted. Aside
                 // from certificate errors or cases where the main frame resource is not available
                 // (both of which are handled above and both of which are CefErrorCode.Aborted errors)
                 // OnLoadError may be called for cases where there it does not actually indicate
                 // that a real problem has occurred. For example, it is called when the main frame
                 // is refreshed. We log it here at INFO because in most cases it does not represent
                 // a real error condition.
                 Logger.Info("Main frame load aborted: " + e.FailedUrl);
             }
             if (LoadError != null)
             {
                 LoadError(this, e);
             }
         }
         catch (Exception ex)
         {
             Logger.Error("Exception encountered while handling a page load error", ex);
         }
     }, true);
 }
 void ICefWebBrowserInternal.OnLoadStart(LoadStartEventArgs e)
 {
     this.DispatchIfRequired(() =>
     {
         try
         {
             ExecuteJavaScript(StaticWebContent.GetOnLoadStartScript());
         }
         catch (Exception ex)
         {
             Logger.Error("Error in OnLoadStart : {0}", ex);
         }
     },
                             true);
 }