diff --git a/SampleApps/WebView2APISample/AppWindow.cpp b/SampleApps/WebView2APISample/AppWindow.cpp index 97f63c7..283de40 100644 --- a/SampleApps/WebView2APISample/AppWindow.cpp +++ b/SampleApps/WebView2APISample/AppWindow.cpp @@ -1777,7 +1777,8 @@ void AppWindow::RegisterEventHandlers() static const wchar_t* browser_launching_domain = L"www.example.com"; wil::unique_bstr source_domain = GetDomainOfUri(source.get()); const wchar_t* source_domain_as_wchar = source_domain.get(); - if (wcscmp(browser_launching_domain, source_domain_as_wchar) == 0) + if (source_domain_as_wchar && + wcscmp(browser_launching_domain, source_domain_as_wchar) == 0) { // Open the URI in the default browser. wil::unique_cotaskmem_string target_uri; diff --git a/SampleApps/WebView2APISample/ScenarioScreenCapture.cpp b/SampleApps/WebView2APISample/ScenarioScreenCapture.cpp new file mode 100644 index 0000000..837590f --- /dev/null +++ b/SampleApps/WebView2APISample/ScenarioScreenCapture.cpp @@ -0,0 +1,12 @@ +// Copyright (C) Microsoft Corporation. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "stdafx.h" + +#include "ScenarioScreenCapture.h" + +#include "AppWindow.h" +#include "CheckFailure.h" + +using namespace Microsoft::WRL; diff --git a/SampleApps/WebView2APISample/ScenarioScreenCapture.h b/SampleApps/WebView2APISample/ScenarioScreenCapture.h new file mode 100644 index 0000000..273b918 --- /dev/null +++ b/SampleApps/WebView2APISample/ScenarioScreenCapture.h @@ -0,0 +1,11 @@ +// Copyright (C) Microsoft Corporation. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#pragma once +#include "stdafx.h" + +#include + +#include "AppWindow.h" +#include "ComponentBase.h" diff --git a/SampleApps/WebView2APISample/ScenarioScreenCaptureIFrame2.html b/SampleApps/WebView2APISample/ScenarioScreenCaptureIFrame2.html new file mode 100644 index 0000000..6c7f330 --- /dev/null +++ b/SampleApps/WebView2APISample/ScenarioScreenCaptureIFrame2.html @@ -0,0 +1,32 @@ + + + + ScenarioScreenCaptureIFrame2 + + +

Screen Capture Test From Top Level IFrame 2

+ + +
+ + + + diff --git a/SampleApps/WebView2APISample/SettingsComponent.cpp b/SampleApps/WebView2APISample/SettingsComponent.cpp index e3966fd..5ffadad 100644 --- a/SampleApps/WebView2APISample/SettingsComponent.cpp +++ b/SampleApps/WebView2APISample/SettingsComponent.cpp @@ -1814,7 +1814,12 @@ SettingsComponent::~SettingsComponent() wil::unique_bstr GetDomainOfUri(PWSTR uri) { wil::com_ptr uriObject; - CreateUri(uri, Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_DECODE_EXTRA_INFO, 0, &uriObject); + HRESULT hr = CreateUri( + uri, Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_DECODE_EXTRA_INFO, 0, &uriObject); + if (FAILED(hr)) + { + return nullptr; + } wil::unique_bstr domain; uriObject->GetHost(&domain); return domain; diff --git a/SampleApps/WebView2APISample/WebView2APISample.vcxproj b/SampleApps/WebView2APISample/WebView2APISample.vcxproj index a8d8eed..cc97767 100644 --- a/SampleApps/WebView2APISample/WebView2APISample.vcxproj +++ b/SampleApps/WebView2APISample/WebView2APISample.vcxproj @@ -244,6 +244,7 @@ + @@ -295,6 +296,7 @@ + @@ -375,6 +377,15 @@ $(OutDir)\assets + + $(OutDir)\assets + + + $(OutDir)\assets + + + $(OutDir)\assets + $(OutDir)\assets @@ -451,6 +462,9 @@ $(OutDir)\assets + + $(OutDir)\assets + @@ -458,13 +472,13 @@ - + 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}. - + diff --git a/SampleApps/WebView2APISample/assets/ScenarioScreenCapture.html b/SampleApps/WebView2APISample/assets/ScenarioScreenCapture.html new file mode 100644 index 0000000..f094b52 --- /dev/null +++ b/SampleApps/WebView2APISample/assets/ScenarioScreenCapture.html @@ -0,0 +1,43 @@ + + + + ScenarioScreenCapture + + +

ScenarioScreenCapture Sample Page

+

Screen Capture Test From Main Frame

+ + +
+ + + + + + + diff --git a/SampleApps/WebView2APISample/assets/ScenarioScreenCaptureIFrame1.html b/SampleApps/WebView2APISample/assets/ScenarioScreenCaptureIFrame1.html new file mode 100644 index 0000000..6d6ce82 --- /dev/null +++ b/SampleApps/WebView2APISample/assets/ScenarioScreenCaptureIFrame1.html @@ -0,0 +1,32 @@ + + + + ScenarioScreenCaptureIFrame1 + + +

Screen Capture Test From Top Level IFrame1

+ + +
+ + + + diff --git a/SampleApps/WebView2APISample/assets/ScenarioScreenCaptureIFrame2.html b/SampleApps/WebView2APISample/assets/ScenarioScreenCaptureIFrame2.html new file mode 100644 index 0000000..0d901e5 --- /dev/null +++ b/SampleApps/WebView2APISample/assets/ScenarioScreenCaptureIFrame2.html @@ -0,0 +1,32 @@ + + + + ScenarioScreenCaptureIFrame2 + + +

Screen Capture Test From Top Level IFrame2

+ + +
+ + + + diff --git a/SampleApps/WebView2APISample/packages.config b/SampleApps/WebView2APISample/packages.config index 6ad4540..8f9266a 100644 --- a/SampleApps/WebView2APISample/packages.config +++ b/SampleApps/WebView2APISample/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/SampleApps/WebView2WindowsFormsBrowser/WebView2WindowsFormsBrowser.csproj b/SampleApps/WebView2WindowsFormsBrowser/WebView2WindowsFormsBrowser.csproj index 483fb46..bcefe84 100644 --- a/SampleApps/WebView2WindowsFormsBrowser/WebView2WindowsFormsBrowser.csproj +++ b/SampleApps/WebView2WindowsFormsBrowser/WebView2WindowsFormsBrowser.csproj @@ -25,7 +25,7 @@ AnyCPU - + diff --git a/SampleApps/WebView2WpfBrowser/MainWindow.xaml b/SampleApps/WebView2WpfBrowser/MainWindow.xaml index a4dcfde..f557cfe 100644 --- a/SampleApps/WebView2WpfBrowser/MainWindow.xaml +++ b/SampleApps/WebView2WpfBrowser/MainWindow.xaml @@ -128,7 +128,7 @@ found in the LICENSE file. - + diff --git a/SampleApps/WebView2WpfBrowser/MainWindow.xaml.cs b/SampleApps/WebView2WpfBrowser/MainWindow.xaml.cs index e7a3caa..020fe8b 100644 --- a/SampleApps/WebView2WpfBrowser/MainWindow.xaml.cs +++ b/SampleApps/WebView2WpfBrowser/MainWindow.xaml.cs @@ -287,6 +287,7 @@ void CloseCmdExecuted(object sender, ExecutedRoutedEventArgs e) return; } } + webView.Dispose(); this.Close(); } diff --git a/SampleApps/WebView2WpfBrowser/WebView2WpfBrowser.csproj b/SampleApps/WebView2WpfBrowser/WebView2WpfBrowser.csproj index ee5a5f0..f8c02a1 100644 --- a/SampleApps/WebView2WpfBrowser/WebView2WpfBrowser.csproj +++ b/SampleApps/WebView2WpfBrowser/WebView2WpfBrowser.csproj @@ -61,7 +61,7 @@ - +