public CSharpToJavascriptConverter(HTMLViewContext context, IJavascriptSessionCache icacher, IJSCommandFactory commandFactory, IWebSessionLogger logger) { _CommandFactory = commandFactory; _Logger = logger; _Context = context; _Cacher = icacher; }
private Task<IWebBrowserWindowProvider> InitTask(string fullpath, IWebSessionLogger logger) { TaskCompletionSource<IWebBrowserWindowProvider> tcs = new TaskCompletionSource<IWebBrowserWindowProvider>(); Task.Run(async () => { var cefWindowInfo = CefWindowInfo.Create(); cefWindowInfo.SetAsWindowless(IntPtr.Zero, true); //// Settings for the browser window itself (e.g. enable JavaScript?). var cefBrowserSettings = new CefBrowserSettings(); // Initialize some the cust interactions with the browser process. var cefClient = new TestCefClient(); // Start up the browser instance. CefBrowserHost.CreateBrowser(cefWindowInfo, cefClient, cefBrowserSettings, fullpath); _CefBrowser = await cefClient.GetLoadedBrowserAsync(); _CefFrame = _CefBrowser.GetMainFrame(); _TestCefGlueHTMLWindowProvider = new TestCefGlueHTMLWindowProvider(_CefFrame, cefClient); tcs.SetResult(_TestCefGlueHTMLWindowProvider); }); return tcs.Task; }
private async Task InitAsync(string path, IWebSessionLogger logger ) { var taskload = _WpfThread.Dispatcher.Invoke(() => RawInit(path)); WebView = await _ChromiumFXWebViewTask; await taskload; _ChromiumFXHTMLWindowProvider = new ChromiumFXHTMLWindowProvider(_CfxClient, WebView, new Uri(path)); }
public VueJavascriptViewModelUpdater(IWebView webView, IJavascriptObject listener, Lazy<IJavascriptObject> vueHelper, IWebSessionLogger logger) { _WebView = webView; _Listener = listener; _VueHelper = vueHelper; _Logger = logger; }
public HTMLEngineFactoryTest() { _WPFWebWindowFactory = CreateFactory("FakeWEngine"); _JavascripEngine1 = CreateJavascriptFactory("One"); _JavascripEngine2 = CreateJavascriptFactory("Two"); _JavascripEngine3 = CreateJavascriptFactory("Three"); _iWebSessionLogger = Substitute.For<IWebSessionLogger>(); }
public VueVmManager(IWebView webView, IJavascriptObject listener, IWebSessionLogger logger) { _WebView = webView; _Logger = logger; _VueHelperLazy = new Lazy<IJavascriptObject>(GetVueHelper); _VueJavascriptSessionInjector = new VueJavascriptSessionInjector(webView, listener, _VueHelperLazy, _Logger); _VueJavascriptViewModelUpdater = new VueJavascriptViewModelUpdater(webView, listener, _VueHelperLazy, _Logger); }
private HTML_Binding(BidirectionalMapper iConvertToJSO, IWebSessionLogger logger) { _Context = iConvertToJSO.Context; _BirectionalMapper = iConvertToJSO; _Logger = logger; _Bindings.Add(this); _Logger.Debug(() => $"HTML_Binding {_Current} created"); }
public DoubleBrowserNavigator(IWebViewLifeCycleManager lifecycler, IUrlSolver urlSolver, IJavascriptFrameworkManager javascriptFrameworkManager) { _webSessionLogger = new BasicLogger(); _javascriptFrameworkManager = javascriptFrameworkManager; _WebViewLifeCycleManager = lifecycler; _UrlSolver = urlSolver; }
public HTMLViewContext(IWebView webView, IDispatcher uiDispatcher, IJavascriptFrameworkManager javascriptFrameworkManager, IJavascriptChangesObserver javascriptChangesObserver, IWebSessionLogger logger) { WebView = webView; _logger = logger; UIDispatcher = uiDispatcher; var builder = new BinderBuilder(webView, javascriptChangesObserver); _Listener = builder.BuildListener(); _VmManager = javascriptFrameworkManager.CreateManager(WebView, _Listener, _logger); ViewModelUpdater = _VmManager.ViewModelUpdater; JavascriptSessionInjector = _VmManager.Injector; }
public ChromiumFxControlWebBrowserWindow(ChromiumWebBrowser chromiumWebBrowser, IDispatcher dispatcher, IWebSessionLogger logger) { _Logger = logger; _dispatcher = dispatcher; _ChromiumWebBrowser = chromiumWebBrowser; _ChromiumWebBrowser.LoadHandler.OnLoadEnd += OnLoadEnd; _ChromiumWebBrowser.DisplayHandler.OnConsoleMessage += OnConsoleMessage; _ChromiumWebBrowser.OnV8ContextCreated += OnV8ContextCreated; _ChromiumWebBrowser.RemoteBrowserCreated += OnChromiumWebBrowser_RemoteBrowserCreated; _ChromiumWebBrowser.ContextMenuHandler.OnBeforeContextMenu += OnBeforeContextMenu; _ChromiumWebBrowser.RequestHandler.OnRenderProcessTerminated += RequestHandler_OnRenderProcessTerminated; }
public ChromiumFxWpfWindow(IWebSessionLogger logger) { _Logger = logger; _ChromiumFxControl = new ChromiumFxControl() { Visibility = Visibility.Hidden, VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, ContextMenu = new ContextMenu() { Visibility = Visibility.Collapsed } }; _ChromiumWebBrowser = _ChromiumFxControl.ChromiumWebBrowser; var dispatcher = new WPFUIDispatcher(_ChromiumFxControl.Dispatcher); _chromiumFxControlWebBrowserWindow = new ChromiumFxControlWebBrowserWindow(_ChromiumWebBrowser, dispatcher, _Logger); }
private async Task InitAsync(string ipath, IWebSessionLogger logger) { var taskLoaded = new TaskCompletionSource<object>(); WebCore.QueueWork( () => { _CurrentWebView = WebCore.CreateWebView(500, 500); var uri = new Uri(ipath); _CurrentWebView.Source = uri; WebView = new AwesomiumWebView(_CurrentWebView); _AwesomiumTestHTMLWindowProvider = new AwesomiumTestHTMLWindowProvider(WebView, uri); var viewReadyExecuter = new ViewReadyExecuter(_CurrentWebView, () => { taskLoaded.TrySetResult(null); }); viewReadyExecuter.Do(); }); await taskLoaded.Task; }
internal BidirectionalMapper(object iRoot, HTMLViewEngine contextBuilder, JavascriptBindingMode iMode, object addicionalObject, IWebSessionLogger logger) { _BindingMode = iMode; _Logger = logger; var javascriptObjecChanges = (iMode == JavascriptBindingMode.TwoWay) ? (IJavascriptChangesObserver)this : null; _Context = contextBuilder.GetMainContext(javascriptObjecChanges); _sessionInjector = _Context.JavascriptSessionInjector; _SessionCache = new SessionCacher(); _ListenerRegister = new FullListenerRegister( (n) => n.PropertyChanged += CSharpPropertyChanged, (n) => n.PropertyChanged -= CSharpPropertyChanged, (n) => n.CollectionChanged += CSharpCollectionChanged, (n) => n.CollectionChanged -= CSharpCollectionChanged, (c) => c.ListenChanges(), (c) => c.UnListenChanges()); var commandFactory = new CommandFactory(_Context, this); RegisterJavascriptHelper(); _JSObjectBuilder = new CSharpToJavascriptConverter(_Context, _SessionCache, commandFactory, _Logger) ; _Root = _JSObjectBuilder.Map(iRoot, addicionalObject); }
public AddLoger(IWebSessionLogger logger1, IWebSessionLogger logger2) { _Logger1 = logger1; _Logger2 = logger2; }
public HtmlViewEngine(IWebBrowserWindowProvider htmlWindowProvider, IJavascriptFrameworkManager frameworkManager, IWebSessionLogger logger) { _HtmlWindowProvider = htmlWindowProvider; _FrameworkManager = frameworkManager; _Logger = logger; }
public IJavascriptViewModelManager CreateManager(IWebView webView, IJavascriptObject listener, IWebSessionLogger logger, bool debugMode) { return(new KnockoutUiVmManager(webView, listener, logger)); }
public BindingBuilder(BidirectionalMapper mapper, IWebSessionLogger logger) { _Binding = new HtmlBinding(mapper, logger); _Mapper = mapper; }
public ChromiumFxControlWebBrowserWindow(ChromiumWebBrowser chromiumWebBrowser, IDispatcher dispatcher, IWebSessionLogger logger) { _Logger = logger; _Dispatcher = dispatcher; _ChromiumWebBrowser = chromiumWebBrowser; _ChromiumWebBrowser.LoadHandler.OnLoadEnd += OnLoadEnd; _ChromiumWebBrowser.LoadHandler.OnLoadError += LoadHandler_OnLoadError; _ChromiumWebBrowser.RequestHandler.OnBeforeBrowse += RequestHandler_OnBeforeBrowse; _ChromiumWebBrowser.DisplayHandler.OnConsoleMessage += OnConsoleMessage; _ChromiumWebBrowser.OnV8ContextCreated += OnV8ContextCreated; _ChromiumWebBrowser.ContextMenuHandler.OnBeforeContextMenu += OnBeforeContextMenu; _ChromiumWebBrowser.ContextMenuHandler.OnContextMenuCommand += ContextMenuHandler_OnContextMenuCommand; _ChromiumWebBrowser.RequestHandler.OnRenderProcessTerminated += RequestHandler_OnRenderProcessTerminated; }
internal BidirectionalMapper(object iRoot, HTMLViewEngine contextBuilder, JavascriptBindingMode iMode, IWebSessionLogger logger) { _BindingMode = iMode; _Logger = logger; var javascriptObjecChanges = (iMode == JavascriptBindingMode.TwoWay) ? (IJavascriptChangesObserver)this : null; _Context = contextBuilder.GetMainContext(javascriptObjecChanges); _SessionCache = new SessionCacher(); _ListenerRegister = new FullListenerRegister( (n) => n.PropertyChanged += CSharpPropertyChanged, (n) => n.PropertyChanged -= CSharpPropertyChanged, (n) => n.CollectionChanged += CSharpCollectionChanged, (n) => n.CollectionChanged -= CSharpCollectionChanged, (c) => c.ListenChanges(), (c) => c.UnListenChanges()); var commandFactory = new CommandFactory(_Context, this); _JSObjectBuilder = new CSharpToJavascriptConverter(contextBuilder.HTMLWindow, _SessionCache, commandFactory, _Logger); _RootObject = iRoot; }
internal BidirectionalMapper(object root, HTMLViewEngine contextBuilder, JavascriptBindingMode mode, IWebSessionLogger logger, IJavascriptObjectBuilderStrategyFactory strategyFactory) : this(root, contextBuilder, null, strategyFactory, mode, logger) { }
protected WpfComponentTest_Base(IWindowContextProvider windowTestEnvironment, ITestOutputHelper testOutputHelper) { _Logger = new TestLogger(testOutputHelper).Add(new BasicLogger()); _WindowTestEnvironment = windowTestEnvironment.WindowTestContext; }
private ChromiumFxSession(Action <CfxSettings> settingsBuilder, Action <CfxBrowserSettings> browserSettingsUpdater, Action <CfxOnBeforeCommandLineProcessingEventArgs> commandLineHandler, IWebSessionLogger webSessionLogger) { _CurrentDirectory = this.GetType().Assembly.GetPath(); _SettingsBuilder = settingsBuilder; _CommandLineHandler = commandLineHandler; CfxRuntime.LibCefDirPath = GetPath($@"{CefRepo}\Release"); ChromiumWebBrowser.OnBeforeCfxInitialize += ChromiumWebBrowser_OnBeforeCfxInitialize; ChromiumWebBrowser.OnBeforeCommandLineProcessing += ChromiumWebBrowser_OnBeforeCommandLineProcessing; int value = CfxRuntime.ExecuteProcess(); if (value >= 0) { Environment.Exit(value); } CfxRuntime.EnableHighDpiSupport(); ChromiumWebBrowser.Initialize(); browserSettingsUpdater?.Invoke(NeutroniumSettings.NeutroniumBrowserSettings); _NeutroniumSchemeHandlerFactory = new NeutroniumSchemeHandlerFactory(webSessionLogger); //need this to make request interception work CfxRuntime.RegisterSchemeHandlerFactory("https", "application", _NeutroniumSchemeHandlerFactory); }
public AddLoger(IWebSessionLogger logger1, IWebSessionLogger logger2) { _Logger1 = logger1; _Logger2 = logger2; }
public static IWebSessionLogger Add(this IWebSessionLogger logger1, IWebSessionLogger logger2) { return(new AddLoger(logger1, logger2)); }
public HTMLViewEngine(IWebBrowserWindowProvider hTMLWindowProvider, IJavascriptFrameworkManager frameworkManager, IWebSessionLogger logger) { _HTMLWindowProvider = hTMLWindowProvider; _frameworkManager = frameworkManager; Logger = logger; }
public void Init(string path, IWebSessionLogger logger) { var cc = InitTask(path, logger).Result; WebView = cc.HtmlWindow.MainFrame; }
public BindingBuilder(BidirectionalMapper mapper, IWebSessionLogger logger, object additionalVm) { _Binding = new HTML_Binding(mapper, logger); _Mapper = mapper; _AdditionalVm = additionalVm; }
internal BidirectionalMapper(object root, HTMLViewEngine contextBuilder, IGlueFactory glueFactory, IJavascriptObjectBuilderStrategyFactory strategyFactory, JavascriptBindingMode mode, IWebSessionLogger logger) { _BuilderStrategyFactory = strategyFactory ?? new StandardStrategyFactory(); _BindingMode = mode; _Logger = logger; var javascriptObjecChanges = (mode == JavascriptBindingMode.TwoWay) ? (IJavascriptChangesObserver)this : null; _Context = contextBuilder.GetMainContext(javascriptObjecChanges); _SessionCache = new SessionCacher(); _ListenerRegister = new FullListenerRegister( (n) => n.PropertyChanged += CSharpPropertyChanged, (n) => n.PropertyChanged -= CSharpPropertyChanged, (n) => n.CollectionChanged += CSharpCollectionChanged, (n) => n.CollectionChanged -= CSharpCollectionChanged, (c) => c.ListenChanges(), (c) => c.UnListenChanges()); glueFactory = glueFactory ?? GlueFactoryFactory.GetFactory(_Context, this); _JSObjectBuilder = new CSharpToJavascriptConverter(contextBuilder.HTMLWindow, _SessionCache, glueFactory, _Logger); _RootObject = root; }
public ChromiumFxControlWebBrowserWindow(ChromiumWebBrowser chromiumWebBrowser, IDispatcher dispatcher, IWebSessionLogger logger) { _Logger = logger; _dispatcher = dispatcher; _ChromiumWebBrowser = chromiumWebBrowser; _ChromiumWebBrowser.LoadHandler.OnLoadEnd += OnLoadEnd; _ChromiumWebBrowser.DisplayHandler.OnConsoleMessage += OnConsoleMessage; _ChromiumWebBrowser.OnV8ContextCreated += OnV8ContextCreated; _ChromiumWebBrowser.RemoteBrowserCreated += OnChromiumWebBrowser_RemoteBrowserCreated; _ChromiumWebBrowser.ContextMenuHandler.OnBeforeContextMenu += OnBeforeContextMenu; _ChromiumWebBrowser.RequestHandler.OnRenderProcessTerminated += RequestHandler_OnRenderProcessTerminated; _ChromiumWebBrowser.LifeSpanHandler.OnBeforePopup += LifeSpanHandler_OnBeforePopup; ChromiumWebBrowser.OnBeforeCommandLineProcessing += ChromiumWebBrowser_OnBeforeCommandLineProcessing; }
public CSharpToJavascriptConverter(ICSharpToJsCache cacher, IGlueFactory glueFactory, IWebSessionLogger logger) { _GlueFactory = glueFactory; _Logger = logger; _Cacher = cacher; _Converters = new Dictionary <Type, Func <IGlueFactory, object, IJsCsGlue> > { [Types.String] = (factory, @object) => factory.BuildString(@object), [Types.Bool] = (factory, @object) => factory.BuildBool(@object), [Types.Int] = (factory, @object) => factory.BuildInt(@object), [Types.Double] = (factory, @object) => factory.BuildDouble(@object), [Types.Uint] = (factory, @object) => factory.BuildUint(@object), [Types.Byte] = (factory, @object) => factory.BuildByte(@object), [Types.SByte] = (factory, @object) => factory.BuildSByte(@object), [Types.Decimal] = (factory, @object) => factory.BuildDecimal(@object), [Types.Long] = (factory, @object) => factory.BuildLong(@object), [Types.Short] = (factory, @object) => factory.BuildShort(@object), [Types.Float] = (factory, @object) => factory.BuildFloat(@object), [Types.ULong] = (factory, @object) => factory.BuildUlong(@object), [Types.UShort] = (factory, @object) => factory.BuildUshort(@object), [Types.DateTime] = (factory, @object) => factory.BuildDateTime(@object), [Types.Char] = (factory, @object) => factory.BuildChar(@object), }; }
public VueJavascriptSessionInjector(IWebView webView, IJavascriptObject listener, Lazy <IJavascriptObject> vueHelper, IWebSessionLogger logger) { _WebView = webView; _Listener = listener; _VueHelper = vueHelper; _Logger = logger; }
internal BidirectionalMapper(object root, HtmlViewEngine contextBuilder, IGlueFactory glueFactory, IJavascriptObjectBuilderStrategyFactory strategyFactory, JavascriptBindingMode mode, IWebSessionLogger logger) { _BuilderStrategyFactory = strategyFactory ?? new StandardStrategyFactory(); Mode = mode; _Logger = logger; var javascriptObjecChanges = (mode == JavascriptBindingMode.TwoWay) ? (IJavascriptChangesObserver)this : null; Context = contextBuilder.GetMainContext(javascriptObjecChanges); _SessionCache = new SessionCacher(); var jsUpdateHelper = new JsUpdateHelper(this, Context, () => _BuilderStrategy, _SessionCache); _ListenerUpdater = ListenToCSharp ? new ListenerUpdater(jsUpdateHelper) : null; glueFactory = glueFactory ?? GlueFactoryFactory.GetFactory(Context, _SessionCache, this, _ListenerUpdater?.On); _JsObjectBuilder = new CSharpToJavascriptConverter(_SessionCache, glueFactory, _Logger); jsUpdateHelper.JsObjectBuilder = _JsObjectBuilder; _JsUpdateHelper = jsUpdateHelper; _RootObject = root; _JsUpdateHelper.CheckUiContext(); JsValueRoot = _JsObjectBuilder.Map(_RootObject); JsValueRoot.AddRef(); }
public IJavascriptViewModelManager CreateManager(IWebView webView, IJavascriptObject listener, IWebSessionLogger logger, bool debugMode) { return(new VueVmManager(webView, listener, debugMode ? _WebViewCommunication : null, logger)); }
public void Init(string path, IWebSessionLogger logger) { var cc = InitTask(path, logger).Result; WebView = cc.HTMLWindow.MainFrame; }
protected abstract IWPFWebWindowFactory GetWindowFactory(IWebSessionLogger logger);
public KnockoutUiVmManager(IWebView webView, IJavascriptObject listener, IWebSessionLogger logger) { _Logger = logger; _KnockoutSessionInjector = new KnockoutSessionInjector(webView, listener, _Logger); _KnockoutViewModelUpdater = new KnockoutViewModelUpdater(webView); }
protected override IWPFWebWindowFactory GetWindowFactory(IWebSessionLogger logger) { return(new AwesomiumWPFWebWindowFactory(logger)); }
public ChromiumFxContext(CfrV8Context context, IWebSessionLogger logger) { _Logger = logger; _Context = context; _Context.Enter(); }
public PropertyAccessorTests() { _Logger = Substitute.For <IWebSessionLogger>(); }
public KnockoutSessionInjector(IWebView webView, IJavascriptObject listener, IWebSessionLogger logger) { _WebView = webView; _Listener = listener; _logger = logger; }
public static CfxResourceHandler FromHttpsUrl(CfxRequest request, IWebSessionLogger logger) { return(new NeutroniumResourceHandler(request, logger, UpdateHttpsUrl(request.Url))); }
public MobxJavascriptSessionInjector(IWebView webView, Lazy <IJavascriptObject> helper, IJavascriptObject listener, IWebSessionLogger logger) { _WebView = webView; _Listener = listener; _Logger = logger; _MobxHelperLazy = helper; }
public IJavascriptViewModelManager CreateManager(IWebView webView, IJavascriptObject listener, IWebSessionLogger logger) { return new KnockoutUiVmManager(webView, listener, logger); }
internal static ChromiumFxSession GetSession(Action <CfxSettings> settingsBuilder, Action <CfxOnBeforeCommandLineProcessingEventArgs> commadLineHandler, IWebSessionLogger webSessionLogger) { if (_Session != null) { return(_Session); } _Session = new ChromiumFxSession(settingsBuilder, commadLineHandler, webSessionLogger); return(_Session); }
public void Init(string path, IWebSessionLogger logger) { InitAsync(path, logger).Wait(); }
protected override IWPFWebWindowFactory GetWindowFactory(IWebSessionLogger logger) => new ChromiumFXWPFWebWindowFactory(logger, UpdateChromiumSettings, UpdateChromiumBrowserSettings, PrivateUpdateLineCommandArg);
public HTMLEngineFactory() { _webSessionLogger = new BasicLogger(); }
public PropertyAccessor(object target, string propertyName, IWebSessionLogger logger) { _PropertyInfo = target.GetType().GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance); _Target = target; _Logger = logger; }
public static IWebSessionLogger Add(this IWebSessionLogger logger1, IWebSessionLogger logger2) { return new AddLoger(logger1, logger2); }
public PropertyAccessor(object target, string propertyName, IWebSessionLogger logger) { _PropertyInfo = target.GetType().GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance); _Target = target; _Logger = logger; }
public HTMLEngineFactory() { _webSessionLogger = new BasicLogger(); }
private ChromiumFxSession(Action <CfxSettings> settingsBuilder, Action <CfxOnBeforeCommandLineProcessingEventArgs> commadLineHandler, IWebSessionLogger webSessionLogger) { _CurrentDirectory = this.GetType().Assembly.GetPath(); _SettingsBuilder = settingsBuilder; _CommandLineHandler = commadLineHandler; CfxRuntime.LibCefDirPath = GetPath($@"{CefRepo}\Release"); ChromiumWebBrowser.OnBeforeCfxInitialize += ChromiumWebBrowser_OnBeforeCfxInitialize; ChromiumWebBrowser.OnBeforeCommandLineProcessing += ChromiumWebBrowser_OnBeforeCommandLineProcessing; ChromiumWebBrowser.Initialize(); _PackUriSchemeHandlerFactory = new PackUriSchemeHandlerFactory(webSessionLogger); //need this to make request interception work CfxRuntime.RegisterSchemeHandlerFactory("pack", null, _PackUriSchemeHandlerFactory); }