mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 19:25:01 +00:00
9b01b69d2f
* JSB Rewrite - Add CefSharp.RegisterBoundObject javascript method To get around the problem of IPC timing, I've reversed the communication, now it's the render process requesting the bound objects, the implementation is incomplete at this stage, more just a basic proof of concept Rewrite BindingTest.html using QUnit One of the tests doesn't map correctly as it requires def user interaction TODO: - Get objects by name - Rename Messages.h values that relate to this change so they are more descriptive - Better error handling - Caching of objects within a render process - Investigate global context options, don't think it's possible to call an async method directly in the global context # Conflicts: # CefSharp.Example/Resources/BindingTest.html * JSB Improve Request/Response message names * BindingTest.html - Output stress test results * Remove JavascriptRootObject was leftover from time we used WCF to transmit objects * JavascriptObjectRepository - Objects are now sent in the same list with an IsAsync flag Separation when sending over IPC with two unique lists isn't necessary * JavascriptObjectRepository - Return objects by name or return all by default Untabify CefAppUnmanagedWrapper.cpp Add minor comment to CefBrowserWrapper for a reminder that we use Frame Identifier as dictionary key * Add //TODO: JSB comments for work that's left to be done Ideally within a render process we cache bound objects once they've been communicated, It would also be nice to make multiple binding requests so objects can later be added dynamically * JSB Allow multiple calls to CefSharp.RegisterBoundObject Update BindingTest.html to name two distinct calls to different bound objects * JSB - Add some notes about caching, no working implementation yet * JSB - Dynamically Register object on Request * JSB Add ability to unbind an object and rename RegisterBoundObject to BindObjectAsync # Conflicts: # CefSharp.Example/Resources/BindingTest.html * JSB BindObjectAsync - if objects already bound then return false * JSB - Ignore Indexer properties Were previously throwing an exception * JSB - Add LegacyJavascriptBindingEnabled option so preserve existing behaviour This is only useful for SPA application and those that only navigate to pages hosting within a single domain. Any sort of cross-site navigation and a new render process will be spawned and objects won't be bound automatically (You can use the new methods to request they're bound yourself, at least in theory, more testing required on this) * Add LegacyBindingTest.html Current disabled by default. To enable uncomment CefSharpSettings.LegacyJavascriptBindingEnabled = true; in CefExample.cs * RegisterJsObject and RegisterAsyncJsObject can now only be used when CefSharpSettings.LegacyJavascriptBindingEnabled = true See https://github.com/cefsharp/CefSharp/issues/2246 for details
76 lines
5.8 KiB
XML
76 lines
5.8 KiB
XML
<Window x:Class="CefSharp.Wpf.Example.MainWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:controls="clr-namespace:CefSharp.Wpf.Example.Controls"
|
|
xmlns:ex="clr-namespace:CefSharp.Example;assembly=CefSharp.Example"
|
|
Title="CefSharp.Wpf.Example"
|
|
WindowState="Maximized">
|
|
<Window.InputBindings>
|
|
<KeyBinding Key="T" Modifiers="Control" Command="New"/>
|
|
<KeyBinding Key="W" Modifiers="Control" Command="Close"/>
|
|
</Window.InputBindings>
|
|
<DockPanel>
|
|
<Menu DockPanel.Dock="Top">
|
|
<MenuItem Header="_File">
|
|
<MenuItem Header="_New Tab" Command="New"/>
|
|
<MenuItem Header="_Close Tab" Command="Close"/>
|
|
<MenuItem Header="_Open DevTools" Command="controls:CefSharpCommands.CustomCommand" CommandParameter="OpenDevTools"/>
|
|
<MenuItem Header="Zoom In" Command="controls:CefSharpCommands.CustomCommand" CommandParameter="ZoomIn"/>
|
|
<MenuItem Header="Zoom Out" Command="controls:CefSharpCommands.CustomCommand" CommandParameter="ZoomOut"/>
|
|
<MenuItem Header="Zooom Reset" Command="controls:CefSharpCommands.CustomCommand" CommandParameter="ZoomReset"/>
|
|
<MenuItem Header="_Exit" Command="controls:CefSharpCommands.Exit"/>
|
|
</MenuItem>
|
|
<MenuItem Header="_View">
|
|
<MenuItem Header="Toggle _Sidebar" Command="controls:CefSharpCommands.CustomCommand" CommandParameter="ToggleSidebar"/>
|
|
<MenuItem Header="Toggle _Download Info" Command="controls:CefSharpCommands.CustomCommand" CommandParameter="ToggleDownloadInfo"/>
|
|
</MenuItem>
|
|
<MenuItem Header="_Tests">
|
|
<MenuItem Header="_Binding Test" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="{Binding Source={x:Static ex:CefExample.BindingTestUrl}}"/>
|
|
<MenuItem Header="_LegacyBinding Test" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="{Binding Source={x:Static ex:CefExample.LegacyBindingTestUrl}}"/>
|
|
<MenuItem Header="_List Plugins" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="{Binding Source={x:Static ex:CefExample.PluginsTestUrl}}"/>
|
|
<MenuItem Header="_Tooltip Test" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="{Binding Source={x:Static ex:CefExample.TooltipTestUrl}}"/>
|
|
<MenuItem Header="_Popup Test" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="{Binding Source={x:Static ex:CefExample.PopupParentUrl}}"/>
|
|
<MenuItem Header="_Popup Test Custom Scheme" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="{Binding Source={x:Static ex:CefExample.PopupTestUrl}}"/>
|
|
<MenuItem Header="_Basic Scheme Test" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="{Binding Source={x:Static ex:CefExample.BasicSchemeTestUrl}}"/>
|
|
<MenuItem Header="_Response Filter Test" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="{Binding Source={x:Static ex:CefExample.ResponseFilterTestUrl}}"/>
|
|
<MenuItem Header="_Draggable Region Test" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="{Binding Source={x:Static ex:CefExample.DraggableRegionTestUrl}}"/>
|
|
<MenuItem Header="_Fish Gl" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="http://www.fishgl.com/"/>
|
|
<MenuItem Header="_Microsoft Test Drive" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="http://dev.modern.ie/testdrive/"/>
|
|
<MenuItem Header="_Drag Demo" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="http://html5demos.com/drag"/>
|
|
<MenuItem Header="_Adobe Flash Demo" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="http://www.adobe.com/software/flash/about/"/>
|
|
<MenuItem Header="_Print Current tab to PDF" Command="controls:CefSharpCommands.PrintTabToPdfCommand" />
|
|
<MenuItem Header="_Load Custom Request" Command="controls:CefSharpCommands.CustomCommand" CommandParameter="CustomRequest" />
|
|
<MenuItem Header="_CDM/DRM Support Test" Command="controls:CefSharpCommands.OpenTabCommand" CommandParameter="{Binding Source={x:Static ex:CefExample.CdmSupportTestUrl}}"/>
|
|
</MenuItem>
|
|
</Menu>
|
|
<controls:NonReloadingTabControl x:Name="TabControl"
|
|
Margin="0,5,0,0"
|
|
ItemsSource="{Binding BrowserTabs, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
|
SelectedIndex="0">
|
|
<TabControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="{Binding Title}"/>
|
|
<Button Content="X"
|
|
Height="20"
|
|
Width="20"
|
|
FontFamily="Courier"
|
|
FontWeight="Bold"
|
|
Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
|
|
Command="Close"
|
|
FontSize="10"
|
|
Padding="0"
|
|
Margin="10,0,0,0"
|
|
ToolTip="Close"/>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</TabControl.ItemTemplate>
|
|
<TabControl.ContentTemplate>
|
|
<DataTemplate>
|
|
<ContentControl Content="{Binding}" />
|
|
</DataTemplate>
|
|
</TabControl.ContentTemplate>
|
|
</controls:NonReloadingTabControl>
|
|
</DockPanel>
|
|
</Window>
|