Skip to content

Commit

Permalink
Merge pull request #255 from MicrosoftEdge/smoketest/1.0.2839-testing
Browse files Browse the repository at this point in the history
Update projects to use latest WebView2 SDK 1.0.2839-prerelease
  • Loading branch information
lflores-ms authored Sep 24, 2024
2 parents d1cf80d + 15ed1dd commit c05049e
Show file tree
Hide file tree
Showing 8 changed files with 412 additions and 323 deletions.
5 changes: 3 additions & 2 deletions SampleApps/WebView2APISample/AppWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1429,11 +1429,11 @@ HRESULT AppWindow::OnCreateEnvironmentCompleted(
m_webViewEnvironment = environment;

if (m_webviewOption.entry == WebViewCreateEntry::EVER_FROM_CREATE_WITH_OPTION_MENU ||
m_creationModeId == IDM_CREATION_MODE_HOST_INPUT_PROCESSING
)
m_creationModeId == IDM_CREATION_MODE_HOST_INPUT_PROCESSING)
{
return CreateControllerWithOptions();
}

auto webViewEnvironment3 = m_webViewEnvironment.try_query<ICoreWebView2Environment3>();

if (webViewEnvironment3 && (m_dcompDevice || m_wincompCompositor))
Expand Down Expand Up @@ -1522,6 +1522,7 @@ HRESULT AppWindow::CreateControllerWithOptions()
}
}
//! [AllowHostInputProcessing]

if (m_dcompDevice || m_wincompCompositor)
{
//! [OnCreateCoreWebView2ControllerCompleted]
Expand Down
4 changes: 2 additions & 2 deletions SampleApps/WebView2APISample/WebView2APISample.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -480,13 +480,13 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.2783-prerelease\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.2783-prerelease\build\native\Microsoft.Web.WebView2.targets')" />
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.2839-prerelease\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.2839-prerelease\build\native\Microsoft.Web.WebView2.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.2783-prerelease\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.2783-prerelease\build\native\Microsoft.Web.WebView2.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.2839-prerelease\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.2839-prerelease\build\native\Microsoft.Web.WebView2.targets'))" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion SampleApps/WebView2APISample/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Web.WebView2" version="1.0.2783-prerelease" targetFramework="native" />
<package id="Microsoft.Web.WebView2" version="1.0.2839-prerelease" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.220201.1" targetFramework="native" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2783-prerelease" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2839-prerelease" />
</ItemGroup>
<ItemGroup>
<Folder Include="assets\" />
Expand Down
12 changes: 0 additions & 12 deletions SampleApps/WebView2WpfBrowser/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,5 @@ found in the LICENSE file.
xmlns:local="clr-namespace:WebView2WpfBrowser"
StartupUri="MainWindow.xaml">
<Application.Resources>
<!--
These CreationProperties use the Evergreen Edge executable that's installed on the machine.
-->
<wv2:CoreWebView2CreationProperties x:Key="EvergreenWebView2CreationProperties" />
<!--
If you want to use fixed version:
1) Navigate to https://developer.microsoft.com/en-us/microsoft-edge/webview2/
2) Choose "Fixed Version", select appropriate version and architecture and click download
3) Unzip the CAB file to a folder
4) Point that folder by `BrowserExecutableFolder` property
-->
<wv2:CoreWebView2CreationProperties x:Key="BYOWebView2CreationProperties" BrowserExecutableFolder="Replace this with BYO folder" />
</Application.Resources>
</Application>
35 changes: 22 additions & 13 deletions SampleApps/WebView2WpfBrowser/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ found in the LICENSE file.
Width="800"
>
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</Window.Resources>
<Window.CommandBindings>
<CommandBinding Command="ApplicationCommands.New" Executed="NewCmdExecuted"/>
Expand Down Expand Up @@ -60,6 +61,7 @@ found in the LICENSE file.
<CommandBinding Command="{x:Static local:MainWindow.ClearServerCertificateErrorActionsCommand}" Executed="ClearServerCertificateErrorActionsCmdExecuted" CanExecute="CoreWebView2RequiringCmdsCanExecute"/>
<CommandBinding Command="{x:Static local:MainWindow.SetDefaultDownloadPathCommand}" Executed="SetDefaultDownloadPathCmdExecuted" CanExecute="CoreWebView2RequiringCmdsCanExecute"/>
<CommandBinding Command="{x:Static local:MainWindow.CreateDownloadsButtonCommand}" Executed="CreateDownloadsButtonCmdExecuted" CanExecute="CoreWebView2RequiringCmdsCanExecute"/>
<CommandBinding Command="{x:Static local:MainWindow.ShowExtensionsWindowCommand}" Executed="ShowExtensionsWindowCmdExecuted" CanExecute="CoreWebView2RequiringCmdsCanExecute"/>
<CommandBinding Command="{x:Static local:MainWindow.ToggleMuteStateCommand}" Executed="ToggleMuteStateCmdExecuted" CanExecute="CoreWebView2RequiringCmdsCanExecute"/>
<CommandBinding Command="{x:Static local:MainWindow.PrintToPdfCommand}" Executed="PrintToPdfCmdExecuted" CanExecute="CoreWebView2RequiringCmdsCanExecute"/>
<CommandBinding Command="{x:Static local:MainWindow.PinchZoomCommand}" Executed="PinchZoomCmdExecuted" CanExecute="CoreWebView2RequiringCmdsCanExecute"/>
Expand Down Expand Up @@ -94,7 +96,8 @@ found in the LICENSE file.
<CommandBinding Command="{x:Static local:MainWindow.BrowserAcceleratorKeyEnabledCommand}" Executed="BrowserAcceleratorKeyEnabledCommandExecuted" CanExecute="CoreWebView2RequiringCmdsCanExecute"/>

<CommandBinding Command="{x:Static local:MainWindow.CloseWebViewCommand}" Executed="CloseWebViewCommandExecuted" CanExecute="CoreWebView2RequiringCmdsCanExecute"/>
<CommandBinding Command="{x:Static local:MainWindow.NewWebViewCommand}" Executed="NewWebViewCommandExecuted" CanExecute="CoreWebView2RequiringCmdsCanExecute"/>
<CommandBinding Command="{x:Static local:MainWindow.NewWebViewCommand}" Executed="NewWebViewCommandExecuted"/>
<CommandBinding Command="{x:Static local:MainWindow.NewWebViewCompositionControlCommand}" Executed="NewWebViewCompositionControlCommandExecuted" CanExecute="EpxerimentalCmdsCanExecute"/>

<CommandBinding Command="{x:Static local:MainWindow.PermissionManagementCommand}" Executed="PermissionManagementExecuted" CanExecute="CoreWebView2RequiringCmdsCanExecute"/>
<CommandBinding Command="{x:Static local:MainWindow.NonClientRegionSupportCommand}" Executed="NonClientRegionSupportCmdExecuted" CanExecute="CoreWebView2RequiringCmdsCanExecute"/>
Expand Down Expand Up @@ -136,8 +139,9 @@ found in the LICENSE file.
<!--TODO-->
</MenuItem>
<MenuItem Header="_Window">
<MenuItem Header="_Close WebView" Command="ApplicationCommands.Close"/>
<MenuItem Header="_New WebView" Command="{x:Static local:MainWindow.NewWebViewCommand}"/>
<MenuItem Header="_Close WebView2" Command="{x:Static local:MainWindow.CloseWebViewCommand}"/>
<MenuItem Header="_New WebView2" Command="{x:Static local:MainWindow.NewWebViewCommand}"/>
<MenuItem Header="_New WebView2CompositionControl" Command="{x:Static local:MainWindow.NewWebViewCompositionControlCommand}"/>
<MenuItem Header="_New Window" Command="ApplicationCommands.New"/>
<MenuItem Header="_New Window With Options" Command="{x:Static local:MainWindow.NewWindowWithOptionsCommand}"/>
<MenuItem Header="_Create New Thread" Command="{x:Static local:MainWindow.CreateNewThreadCommand}"/>
Expand Down Expand Up @@ -176,7 +180,7 @@ found in the LICENSE file.
<MenuItem Header="Toggle Non-Client Region Support" Command="{x:Static local:MainWindow.NonClientRegionSupportCommand}"/>
</MenuItem>
<MenuItem Header="_View">
<MenuItem Header="Toggle _Visibility" Name="webViewVisible" IsCheckable="True" IsChecked="True"/>
<MenuItem Header="Toggle _Visibility" Name="webViewVisible" IsCheckable="True" IsChecked="True" Checked="OnWebViewVisibleChecked" Unchecked="OnWebViewVisibleUnchecked"/>
<MenuItem Header="Suspend" Command="{x:Static local:MainWindow.SuspendCommand}"/>
<MenuItem Header="Resume" Command="{x:Static local:MainWindow.ResumeCommand}"/>
<MenuItem Header="_Increase Zoom" Command="NavigationCommands.IncreaseZoom"/>
Expand All @@ -188,6 +192,7 @@ found in the LICENSE file.
<MenuItem Header="Transparent" Command="{x:Static local:MainWindow.BackgroundColorCommand}" CommandParameter="Transparent"/>
</MenuItem>
<MenuItem Header="_Create Downloads Button" Command="{x:Static local:MainWindow.CreateDownloadsButtonCommand}"/>
<MenuItem Header="Show Extensions Manager" Command="{x:Static local:MainWindow.ShowExtensionsWindowCommand}" />
</MenuItem>
<MenuItem Header="S_cenario">
<MenuItem Header="Au_thentication" Command="{x:Static local:MainWindow.AuthenticationCommand}"/>
Expand Down Expand Up @@ -259,7 +264,7 @@ found in the LICENSE file.
<Button DockPanel.Dock="Left" Command="NavigationCommands.BrowseStop">Cancel</Button>
<Button DockPanel.Dock="Right" Command="NavigationCommands.GoToPage" CommandParameter="{Binding ElementName=url,Path=Text}">Go</Button>
<!-- We want the address bar to update based on the WebView's Source, but we don't want the WebView to navigate just from the user typing into the address bar. Therefore we use the OneWay binding mode. -->
<TextBox x:Name="url" Text="{Binding ElementName=webView,Path=Source,Mode=OneWay}">
<TextBox x:Name="url" Text="{Binding ElementName=webView2XamlElement,Path=Source,Mode=OneWay}">
<TextBox.InputBindings>
<KeyBinding Key="Return" Command="NavigationCommands.GoToPage" CommandParameter="{Binding ElementName=url,Path=Text}" />
</TextBox.InputBindings>
Expand All @@ -270,14 +275,18 @@ found in the LICENSE file.
<ImageBrush ImageSource="/assets/AppStartPageBackground.png" />
</Grid.Background>

<!-- If you want to use a specific version of WebView2 Runtime change EvergreenWebView2CreationProperties
to BYOWebView2CreationProperties and follow the steps in MainWindow.xaml
-->
<wv2:WebView2
x:Name="webView"
CreationProperties="{StaticResource EvergreenWebView2CreationProperties}"
Source="https://www.bing.com/"
/>
<wv2:WebView2 x:Name="webView2XamlElement">
<wv2:WebView2.CreationProperties>
<!--
By default, this CreationProperties uses the Evergreen WebView2 Runtime that's installed on the machine.
If you want to use a specific version of WebView2 Runtime, change BrowserExecutableFolder to point to the folder
with the runtime. https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#the-fixed-version-runtime-distribution-mode
-->
<wv2:CoreWebView2CreationProperties
BrowserExecutableFolder=""
AdditionalBrowserArguments="" />
</wv2:WebView2.CreationProperties>
</wv2:WebView2>
<!-- The control event handlers are set in code behind so they can be reused when replacing the control after
a WebView2 Runtime's browser process failure
-->
Expand Down
Loading

0 comments on commit c05049e

Please sign in to comment.