diff --git a/SampleApps/WebView2APISample/AppWindow.cpp b/SampleApps/WebView2APISample/AppWindow.cpp index ccb2c20c..537810cc 100644 --- a/SampleApps/WebView2APISample/AppWindow.cpp +++ b/SampleApps/WebView2APISample/AppWindow.cpp @@ -2422,12 +2422,13 @@ void AppWindow::RegisterEventHandlers() //! [WindowCloseRequested] // Register a handler for the WindowCloseRequested event. - // This handler will close the app window if it is not the main window. + // This handler will close the app window if it is not the main window, + // or if it is a WCO window (where the close button fires this event). CHECK_FAILURE(m_webView->add_WindowCloseRequested( Callback( [this](ICoreWebView2* sender, IUnknown* args) { - if (m_isPopupWindow) + if (m_isPopupWindow || m_webviewOption.useWco) { CloseAppWindow(); } diff --git a/SampleApps/WebView2APISample/ClientCertificateSelectionDialog.h b/SampleApps/WebView2APISample/ClientCertificateSelectionDialog.h index a72f1d52..7ec6058c 100644 --- a/SampleApps/WebView2APISample/ClientCertificateSelectionDialog.h +++ b/SampleApps/WebView2APISample/ClientCertificateSelectionDialog.h @@ -29,8 +29,8 @@ struct ClientCertificate PCWSTR CertificateKind; }; -// Constructing this struct will show a client certificate selection dialog and return when -// the user dismisses it. If the user clicks the OK button, confirmed will be true with the +// Constructing this struct will show a client certificate selection dialog and return when +// the user dismisses it. If the user clicks the OK button, confirmed will be true with the // selected certificate. struct ClientCertificateSelectionDialog { diff --git a/SampleApps/WebView2APISample/ScenarioDedicatedWorker.cpp b/SampleApps/WebView2APISample/ScenarioDedicatedWorker.cpp index 83616ed1..3372e137 100644 --- a/SampleApps/WebView2APISample/ScenarioDedicatedWorker.cpp +++ b/SampleApps/WebView2APISample/ScenarioDedicatedWorker.cpp @@ -12,16 +12,14 @@ using namespace Microsoft::WRL; ScenarioDedicatedWorker::ScenarioDedicatedWorker(AppWindow* appWindow) : m_appWindow(appWindow) { //! [DedicatedWorkerCreated] - m_appWindow->GetWebView()->QueryInterface(IID_PPV_ARGS(&m_webView2Experimental_30)); - CHECK_FEATURE_RETURN_EMPTY(m_webView2Experimental_30); - - CHECK_FAILURE(m_webView2Experimental_30->add_DedicatedWorkerCreated( - Callback( - [this]( - ICoreWebView2* sender, - ICoreWebView2ExperimentalDedicatedWorkerCreatedEventArgs* args) + m_appWindow->GetWebView()->QueryInterface(IID_PPV_ARGS(&m_webView2_29)); + CHECK_FEATURE_RETURN_EMPTY(m_webView2_29); + + CHECK_FAILURE(m_webView2_29->add_DedicatedWorkerCreated( + Callback( + [this](ICoreWebView2* sender, ICoreWebView2DedicatedWorkerCreatedEventArgs* args) { - wil::com_ptr dedicatedWorker; + wil::com_ptr dedicatedWorker; CHECK_FAILURE(args->get_Worker(&dedicatedWorker)); wil::unique_cotaskmem_string scriptUri; @@ -32,10 +30,9 @@ ScenarioDedicatedWorker::ScenarioDedicatedWorker(AppWindow* appWindow) : m_appWi // Subscribe to worker destroying event dedicatedWorker->add_Destroying( - Callback( + Callback( [this, scriptUriStr]( - ICoreWebView2ExperimentalDedicatedWorker* sender, - IUnknown* args) -> HRESULT + ICoreWebView2DedicatedWorker* sender, IUnknown* args) -> HRESULT { /*Cleanup on worker destruction*/ m_appWindow->AsyncMessageBox( @@ -62,15 +59,14 @@ ScenarioDedicatedWorker::ScenarioDedicatedWorker(AppWindow* appWindow) : m_appWi wil::com_ptr webviewFrame; CHECK_FAILURE(args->get_Frame(&webviewFrame)); - wil::com_ptr m_frameExperimental_9 = - webviewFrame.try_query(); + wil::com_ptr m_frame8 = + webviewFrame.try_query(); - m_frameExperimental_9->add_DedicatedWorkerCreated( - Callback( + m_frame8->add_DedicatedWorkerCreated( + Callback( [this]( ICoreWebView2Frame* sender, - ICoreWebView2ExperimentalDedicatedWorkerCreatedEventArgs* args) - -> HRESULT + ICoreWebView2DedicatedWorkerCreatedEventArgs* args) -> HRESULT { // frameInfo that created the worker. wil::com_ptr frameInfo; @@ -85,8 +81,7 @@ ScenarioDedicatedWorker::ScenarioDedicatedWorker(AppWindow* appWindow) : m_appWi UINT32 source_frameId; CHECK_FAILURE(frameInfo2->get_FrameId(&source_frameId)); - wil::com_ptr - dedicatedWorker; + wil::com_ptr dedicatedWorker; CHECK_FAILURE(args->get_Worker(&dedicatedWorker)); wil::unique_cotaskmem_string scriptUri; @@ -98,10 +93,9 @@ ScenarioDedicatedWorker::ScenarioDedicatedWorker(AppWindow* appWindow) : m_appWi // Subscribe to worker destroying event dedicatedWorker->add_Destroying( - Callback< - ICoreWebView2ExperimentalDedicatedWorkerDestroyingEventHandler>( + Callback( [this, scriptUriStr]( - ICoreWebView2ExperimentalDedicatedWorker* sender, + ICoreWebView2DedicatedWorker* sender, IUnknown* args) -> HRESULT { /*Cleanup on worker destruction*/ @@ -125,5 +119,5 @@ ScenarioDedicatedWorker::ScenarioDedicatedWorker(AppWindow* appWindow) : m_appWi ScenarioDedicatedWorker::~ScenarioDedicatedWorker() { - m_webView2Experimental_30->remove_DedicatedWorkerCreated(m_dedicatedWorkerCreatedToken); + m_webView2_29->remove_DedicatedWorkerCreated(m_dedicatedWorkerCreatedToken); } diff --git a/SampleApps/WebView2APISample/ScenarioDedicatedWorker.h b/SampleApps/WebView2APISample/ScenarioDedicatedWorker.h index 9c206e9c..5baca503 100644 --- a/SampleApps/WebView2APISample/ScenarioDedicatedWorker.h +++ b/SampleApps/WebView2APISample/ScenarioDedicatedWorker.h @@ -15,6 +15,6 @@ class ScenarioDedicatedWorker : public ComponentBase private: AppWindow* m_appWindow; - wil::com_ptr m_webView2Experimental_30; + wil::com_ptr m_webView2_29; EventRegistrationToken m_dedicatedWorkerCreatedToken = {}; }; diff --git a/SampleApps/WebView2APISample/ScenarioDedicatedWorkerPostMessage.cpp b/SampleApps/WebView2APISample/ScenarioDedicatedWorkerPostMessage.cpp index 7e088899..b9ba3348 100644 --- a/SampleApps/WebView2APISample/ScenarioDedicatedWorkerPostMessage.cpp +++ b/SampleApps/WebView2APISample/ScenarioDedicatedWorkerPostMessage.cpp @@ -18,16 +18,14 @@ ScenarioDedicatedWorkerPostMessage::ScenarioDedicatedWorkerPostMessage(AppWindow : m_appWindow(appWindow) { //! [DedicatedWorkerCreated] - m_appWindow->GetWebView()->QueryInterface(IID_PPV_ARGS(&m_webView2Experimental_30)); - CHECK_FEATURE_RETURN_EMPTY(m_webView2Experimental_30); + m_appWindow->GetWebView()->QueryInterface(IID_PPV_ARGS(&m_webView2_29)); + CHECK_FEATURE_RETURN_EMPTY(m_webView2_29); - CHECK_FAILURE(m_webView2Experimental_30->add_DedicatedWorkerCreated( - Callback( - [this]( - ICoreWebView2* sender, - ICoreWebView2ExperimentalDedicatedWorkerCreatedEventArgs* args) + CHECK_FAILURE(m_webView2_29->add_DedicatedWorkerCreated( + Callback( + [this](ICoreWebView2* sender, ICoreWebView2DedicatedWorkerCreatedEventArgs* args) { - wil::com_ptr dedicatedWorker; + wil::com_ptr dedicatedWorker; CHECK_FAILURE(args->get_Worker(&dedicatedWorker)); wil::unique_cotaskmem_string scriptUri; @@ -66,13 +64,13 @@ ScenarioDedicatedWorkerPostMessage::ScenarioDedicatedWorkerPostMessage(AppWindow } void ScenarioDedicatedWorkerPostMessage::SetupEventsOnDedicatedWorker( - wil::com_ptr dedicatedWorker) + wil::com_ptr dedicatedWorker) { //! [WebMessageReceived] dedicatedWorker->add_WebMessageReceived( - Callback( + Callback( [this]( - ICoreWebView2ExperimentalDedicatedWorker* sender, + ICoreWebView2DedicatedWorker* sender, ICoreWebView2WebMessageReceivedEventArgs* args) -> HRESULT { wil::unique_cotaskmem_string scriptUri; @@ -96,7 +94,7 @@ void ScenarioDedicatedWorkerPostMessage::SetupEventsOnDedicatedWorker( } void ScenarioDedicatedWorkerPostMessage::ComputeWithDedicatedWorker( - wil::com_ptr dedicatedWorker) + wil::com_ptr dedicatedWorker) { //! [PostWebMessageAsJson] // Do not block from event handler @@ -118,6 +116,6 @@ void ScenarioDedicatedWorkerPostMessage::ComputeWithDedicatedWorker( ScenarioDedicatedWorkerPostMessage::~ScenarioDedicatedWorkerPostMessage() { - m_webView2Experimental_30->remove_DedicatedWorkerCreated(m_dedicatedWorkerCreatedToken); + m_webView2_29->remove_DedicatedWorkerCreated(m_dedicatedWorkerCreatedToken); m_appWindow->GetWebView()->remove_ContentLoading(m_contentLoadingToken); } diff --git a/SampleApps/WebView2APISample/ScenarioDedicatedWorkerPostMessage.h b/SampleApps/WebView2APISample/ScenarioDedicatedWorkerPostMessage.h index c465679f..757e66d8 100644 --- a/SampleApps/WebView2APISample/ScenarioDedicatedWorkerPostMessage.h +++ b/SampleApps/WebView2APISample/ScenarioDedicatedWorkerPostMessage.h @@ -15,12 +15,11 @@ class ScenarioDedicatedWorkerPostMessage : public ComponentBase private: void SetupEventsOnDedicatedWorker( - wil::com_ptr dedicatedWorker); - void ComputeWithDedicatedWorker( - wil::com_ptr dedicatedWorker); + wil::com_ptr dedicatedWorker); + void ComputeWithDedicatedWorker(wil::com_ptr dedicatedWorker); AppWindow* m_appWindow; - wil::com_ptr m_webView2Experimental_30; + wil::com_ptr m_webView2_29; std::wstring m_sampleUri; EventRegistrationToken m_contentLoadingToken = {}; EventRegistrationToken m_dedicatedWorkerCreatedToken = {}; diff --git a/SampleApps/WebView2APISample/ScenarioServiceWorkerManager.cpp b/SampleApps/WebView2APISample/ScenarioServiceWorkerManager.cpp index e738d51d..bbcdda91 100644 --- a/SampleApps/WebView2APISample/ScenarioServiceWorkerManager.cpp +++ b/SampleApps/WebView2APISample/ScenarioServiceWorkerManager.cpp @@ -27,11 +27,9 @@ void ScenarioServiceWorkerManager::CreateServiceWorkerManager() wil::com_ptr webView2Profile; CHECK_FAILURE(webView2_13->get_Profile(&webView2Profile)); - auto webViewExperimentalProfile13 = - webView2Profile.try_query(); - CHECK_FEATURE_RETURN_EMPTY(webViewExperimentalProfile13); - CHECK_FAILURE( - webViewExperimentalProfile13->get_ServiceWorkerManager(&m_serviceWorkerManager)); + auto webViewProfile9 = webView2Profile.try_query(); + CHECK_FEATURE_RETURN_EMPTY(webViewProfile9); + CHECK_FAILURE(webViewProfile9->get_ServiceWorkerManager(&m_serviceWorkerManager)); //! [ServiceWorkerManager] } @@ -44,13 +42,12 @@ void ScenarioServiceWorkerManager::SetupEventsOnWebview() //! [ServiceWorkerRegistered] CHECK_FAILURE(m_serviceWorkerManager->add_ServiceWorkerRegistered( - Callback( + Callback( [this]( - ICoreWebView2ExperimentalServiceWorkerManager* sender, - ICoreWebView2ExperimentalServiceWorkerRegisteredEventArgs* args) + ICoreWebView2ServiceWorkerManager* sender, + ICoreWebView2ServiceWorkerRegisteredEventArgs* args) { - wil::com_ptr - serviceWorkerRegistration; + wil::com_ptr serviceWorkerRegistration; CHECK_FAILURE(args->get_ServiceWorkerRegistration(&serviceWorkerRegistration)); if (serviceWorkerRegistration) @@ -69,9 +66,9 @@ void ScenarioServiceWorkerManager::SetupEventsOnWebview() // Subscribe to worker registration unregistering event serviceWorkerRegistration->add_Unregistering( Callback< - ICoreWebView2ExperimentalServiceWorkerRegistrationUnregisteringEventHandler>( + ICoreWebView2ServiceWorkerRegistrationUnregisteringEventHandler>( [this, scopeUriStr]( - ICoreWebView2ExperimentalServiceWorkerRegistration* sender, + ICoreWebView2ServiceWorkerRegistration* sender, IUnknown* args) -> HRESULT { /*Cleanup on worker registration destruction*/ @@ -82,7 +79,7 @@ void ScenarioServiceWorkerManager::SetupEventsOnWebview() .Get(), nullptr); - wil::com_ptr serviceWorker; + wil::com_ptr serviceWorker; CHECK_FAILURE( serviceWorkerRegistration->get_ActiveServiceWorker(&serviceWorker)); @@ -94,10 +91,9 @@ void ScenarioServiceWorkerManager::SetupEventsOnWebview() // Subscribe to worker destroying event serviceWorker->add_Destroying( - Callback< - ICoreWebView2ExperimentalServiceWorkerDestroyingEventHandler>( + Callback( [this, scriptUriStr]( - ICoreWebView2ExperimentalServiceWorker* sender, + ICoreWebView2ServiceWorker* sender, IUnknown* args) -> HRESULT { /*Cleanup on worker destruction*/ @@ -111,15 +107,13 @@ void ScenarioServiceWorkerManager::SetupEventsOnWebview() else { CHECK_FAILURE(serviceWorkerRegistration->add_ServiceWorkerActivated( - Callback< - ICoreWebView2ExperimentalServiceWorkerActivatedEventHandler>( + Callback( [this]( - ICoreWebView2ExperimentalServiceWorkerRegistration* sender, - ICoreWebView2ExperimentalServiceWorkerActivatedEventArgs* - args) -> HRESULT + ICoreWebView2ServiceWorkerRegistration* sender, + ICoreWebView2ServiceWorkerActivatedEventArgs* args) + -> HRESULT { - wil::com_ptr - serviceWorker; + wil::com_ptr serviceWorker; CHECK_FAILURE( args->get_ActiveServiceWorker(&serviceWorker)); wil::unique_cotaskmem_string scriptUri; @@ -129,9 +123,9 @@ void ScenarioServiceWorkerManager::SetupEventsOnWebview() // Subscribe to worker destroying event serviceWorker->add_Destroying( Callback< - ICoreWebView2ExperimentalServiceWorkerDestroyingEventHandler>( + ICoreWebView2ServiceWorkerDestroyingEventHandler>( [this, scriptUriStr]( - ICoreWebView2ExperimentalServiceWorker* sender, + ICoreWebView2ServiceWorker* sender, IUnknown* args) -> HRESULT { /*Cleanup on worker destruction*/ @@ -166,9 +160,9 @@ void ScenarioServiceWorkerManager::GetAllServiceWorkerRegistrations() { CHECK_FEATURE_RETURN_EMPTY(m_serviceWorkerManager); CHECK_FAILURE(m_serviceWorkerManager->GetServiceWorkerRegistrations( - Callback( + Callback( [this]( - HRESULT error, ICoreWebView2ExperimentalServiceWorkerRegistrationCollectionView* + HRESULT error, ICoreWebView2ServiceWorkerRegistrationCollectionView* workerRegistrationCollection) -> HRESULT { CHECK_FAILURE(error); @@ -181,8 +175,7 @@ void ScenarioServiceWorkerManager::GetAllServiceWorkerRegistrations() for (UINT32 i = 0; i < workersCount; i++) { - ComPtr - serviceWorkerRegistration; + ComPtr serviceWorkerRegistration; CHECK_FAILURE(workerRegistrationCollection->GetValueAtIndex( i, &serviceWorkerRegistration)); @@ -221,11 +214,10 @@ void ScenarioServiceWorkerManager::GetServiceWorkerRegisteredForScope() std::wstring scope = dialog.input.c_str(); CHECK_FAILURE(m_serviceWorkerManager->GetServiceWorkerRegistrationsForScope( scope.c_str(), - Callback( + Callback( [this, scope]( - HRESULT error, - ICoreWebView2ExperimentalServiceWorkerRegistrationCollectionView* - workerRegistrationCollection) -> HRESULT + HRESULT error, ICoreWebView2ServiceWorkerRegistrationCollectionView* + workerRegistrationCollection) -> HRESULT { CHECK_FAILURE(error); UINT32 workersCount = 0; @@ -237,7 +229,7 @@ void ScenarioServiceWorkerManager::GetServiceWorkerRegisteredForScope() for (UINT32 i = 0; i < workersCount; i++) { - ComPtr + ComPtr serviceWorkerRegistration; CHECK_FAILURE(workerRegistrationCollection->GetValueAtIndex( i, &serviceWorkerRegistration)); diff --git a/SampleApps/WebView2APISample/ScenarioServiceWorkerManager.h b/SampleApps/WebView2APISample/ScenarioServiceWorkerManager.h index 2a47f533..01bcbc55 100644 --- a/SampleApps/WebView2APISample/ScenarioServiceWorkerManager.h +++ b/SampleApps/WebView2APISample/ScenarioServiceWorkerManager.h @@ -22,6 +22,6 @@ class ScenarioServiceWorkerManager : public ComponentBase AppWindow* m_appWindow; wil::com_ptr m_webView; - wil::com_ptr m_serviceWorkerManager; + wil::com_ptr m_serviceWorkerManager; EventRegistrationToken m_serviceWorkerRegisteredToken = {}; }; diff --git a/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessage.cpp b/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessage.cpp index f592f540..d09b92c6 100644 --- a/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessage.cpp +++ b/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessage.cpp @@ -27,11 +27,9 @@ void ScenarioServiceWorkerPostMessage::CreateServiceWorkerManager() wil::com_ptr webView2Profile; CHECK_FAILURE(webView2_13->get_Profile(&webView2Profile)); - auto webViewExperimentalProfile13 = - webView2Profile.try_query(); - CHECK_FEATURE_RETURN_EMPTY(webViewExperimentalProfile13); - CHECK_FAILURE( - webViewExperimentalProfile13->get_ServiceWorkerManager(&m_serviceWorkerManager)); + auto webViewProfile9 = webView2Profile.try_query(); + CHECK_FEATURE_RETURN_EMPTY(webViewProfile9); + CHECK_FAILURE(webViewProfile9->get_ServiceWorkerManager(&m_serviceWorkerManager)); } void ScenarioServiceWorkerPostMessage::SetupEventsOnWebview() @@ -42,13 +40,12 @@ void ScenarioServiceWorkerPostMessage::SetupEventsOnWebview() } CHECK_FAILURE(m_serviceWorkerManager->add_ServiceWorkerRegistered( - Callback( + Callback( [this]( - ICoreWebView2ExperimentalServiceWorkerManager* sender, - ICoreWebView2ExperimentalServiceWorkerRegisteredEventArgs* args) + ICoreWebView2ServiceWorkerManager* sender, + ICoreWebView2ServiceWorkerRegisteredEventArgs* args) { - wil::com_ptr - serviceWorkerRegistration; + wil::com_ptr serviceWorkerRegistration; CHECK_FAILURE(args->get_ServiceWorkerRegistration(&serviceWorkerRegistration)); if (serviceWorkerRegistration) @@ -57,7 +54,7 @@ void ScenarioServiceWorkerPostMessage::SetupEventsOnWebview() CHECK_FAILURE(serviceWorkerRegistration->get_ScopeUri(&scopeUri)); std::wstring scopeUriStr(scopeUri.get()); - wil::com_ptr serviceWorker; + wil::com_ptr serviceWorker; CHECK_FAILURE( serviceWorkerRegistration->get_ActiveServiceWorker(&serviceWorker)); @@ -69,15 +66,13 @@ void ScenarioServiceWorkerPostMessage::SetupEventsOnWebview() else { CHECK_FAILURE(serviceWorkerRegistration->add_ServiceWorkerActivated( - Callback< - ICoreWebView2ExperimentalServiceWorkerActivatedEventHandler>( + Callback( [this]( - ICoreWebView2ExperimentalServiceWorkerRegistration* sender, - ICoreWebView2ExperimentalServiceWorkerActivatedEventArgs* - args) -> HRESULT + ICoreWebView2ServiceWorkerRegistration* sender, + ICoreWebView2ServiceWorkerActivatedEventArgs* args) + -> HRESULT { - wil::com_ptr - serviceWorker; + wil::com_ptr serviceWorker; CHECK_FAILURE( args->get_ActiveServiceWorker(&serviceWorker)); @@ -119,13 +114,13 @@ void ScenarioServiceWorkerPostMessage::SetupEventsOnWebview() } void ScenarioServiceWorkerPostMessage::SetupEventsOnServiceWorker( - wil::com_ptr serviceWorker) + wil::com_ptr serviceWorker) { //! [WebMessageReceived] serviceWorker->add_WebMessageReceived( - Callback( + Callback( [this]( - ICoreWebView2ExperimentalServiceWorker* sender, + ICoreWebView2ServiceWorker* sender, ICoreWebView2WebMessageReceivedEventArgs* args) -> HRESULT { wil::unique_cotaskmem_string scriptUri; @@ -149,7 +144,7 @@ void ScenarioServiceWorkerPostMessage::SetupEventsOnServiceWorker( } void ScenarioServiceWorkerPostMessage::AddToCache( - std::wstring url, wil::com_ptr serviceWorker) + std::wstring url, wil::com_ptr serviceWorker) { //! [PostWebMessageAsJson] std::wstring msg = L"{\"command\":\"ADD_TO_CACHE\",\"url\":\"" + url + L"\"}"; diff --git a/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessage.h b/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessage.h index 2c83d25d..470d5b23 100644 --- a/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessage.h +++ b/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessage.h @@ -16,15 +16,13 @@ class ScenarioServiceWorkerPostMessage : public ComponentBase private: void SetupEventsOnWebview(); void CreateServiceWorkerManager(); - void SetupEventsOnServiceWorker( - wil::com_ptr serviceWorker); - void AddToCache( - std::wstring url, wil::com_ptr serviceWorker); + void SetupEventsOnServiceWorker(wil::com_ptr serviceWorker); + void AddToCache(std::wstring url, wil::com_ptr serviceWorker); AppWindow* m_appWindow; wil::com_ptr m_webView; std::wstring m_sampleUri; - wil::com_ptr m_serviceWorkerManager; + wil::com_ptr m_serviceWorkerManager; EventRegistrationToken m_contentLoadingToken = {}; EventRegistrationToken m_serviceWorkerRegisteredToken = {}; }; diff --git a/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessageSetting.cpp b/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessageSetting.cpp index 7044b1cc..ad9060bb 100644 --- a/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessageSetting.cpp +++ b/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessageSetting.cpp @@ -51,19 +51,16 @@ void ScenarioServiceWorkerPostMessageSetting::ToggleServiceWorkerJsApiSetting() wil::com_ptr webView2Profile; CHECK_FAILURE(webView2_13->get_Profile(&webView2Profile)); - auto webViewExperimentalProfile15 = - webView2Profile.try_query(); + auto webViewProfile9 = webView2Profile.try_query(); - if (webViewExperimentalProfile15) + if (webViewProfile9) { BOOL isEnabled; //! [AreWebViewScriptApisEnabledForServiceWorkers] CHECK_FAILURE( - webViewExperimentalProfile15->get_AreWebViewScriptApisEnabledForServiceWorkers( - &isEnabled)); + webViewProfile9->get_AreWebViewScriptApisEnabledForServiceWorkers(&isEnabled)); CHECK_FAILURE( - webViewExperimentalProfile15->put_AreWebViewScriptApisEnabledForServiceWorkers( - !isEnabled)); + webViewProfile9->put_AreWebViewScriptApisEnabledForServiceWorkers(!isEnabled)); //! [AreWebViewScriptApisEnabledForServiceWorkers] MessageBox( @@ -130,25 +127,22 @@ void ScenarioServiceWorkerPostMessageSetting::SetupEventsOnWebview() wil::com_ptr webView2Profile; CHECK_FAILURE(webView2_13->get_Profile(&webView2Profile)); - auto webViewExperimentalProfile13 = - webView2Profile.try_query(); - CHECK_FEATURE_RETURN_EMPTY(webViewExperimentalProfile13); - CHECK_FAILURE( - webViewExperimentalProfile13->get_ServiceWorkerManager(&m_serviceWorkerManager)); + auto webViewProfile9 = webView2Profile.try_query(); + CHECK_FEATURE_RETURN_EMPTY(webViewProfile9); + CHECK_FAILURE(webViewProfile9->get_ServiceWorkerManager(&m_serviceWorkerManager)); CHECK_FAILURE(m_serviceWorkerManager->add_ServiceWorkerRegistered( - Callback( + Callback( [this]( - ICoreWebView2ExperimentalServiceWorkerManager* sender, - ICoreWebView2ExperimentalServiceWorkerRegisteredEventArgs* args) + ICoreWebView2ServiceWorkerManager* sender, + ICoreWebView2ServiceWorkerRegisteredEventArgs* args) { - wil::com_ptr - serviceWorkerRegistration; + wil::com_ptr serviceWorkerRegistration; CHECK_FAILURE(args->get_ServiceWorkerRegistration(&serviceWorkerRegistration)); if (serviceWorkerRegistration) { - wil::com_ptr serviceWorker; + wil::com_ptr serviceWorker; CHECK_FAILURE( serviceWorkerRegistration->get_ActiveServiceWorker(&serviceWorker)); @@ -159,15 +153,13 @@ void ScenarioServiceWorkerPostMessageSetting::SetupEventsOnWebview() else { CHECK_FAILURE(serviceWorkerRegistration->add_ServiceWorkerActivated( - Callback< - ICoreWebView2ExperimentalServiceWorkerActivatedEventHandler>( + Callback( [this]( - ICoreWebView2ExperimentalServiceWorkerRegistration* sender, - ICoreWebView2ExperimentalServiceWorkerActivatedEventArgs* - args) -> HRESULT + ICoreWebView2ServiceWorkerRegistration* sender, + ICoreWebView2ServiceWorkerActivatedEventArgs* args) + -> HRESULT { - wil::com_ptr - serviceWorker; + wil::com_ptr serviceWorker; CHECK_FAILURE( args->get_ActiveServiceWorker(&serviceWorker)); SetupEventsOnServiceWorker(serviceWorker); @@ -186,12 +178,12 @@ void ScenarioServiceWorkerPostMessageSetting::SetupEventsOnWebview() } void ScenarioServiceWorkerPostMessageSetting::SetupEventsOnServiceWorker( - wil::com_ptr serviceWorker) + wil::com_ptr serviceWorker) { serviceWorker->add_WebMessageReceived( - Callback( + Callback( [this]( - ICoreWebView2ExperimentalServiceWorker* sender, + ICoreWebView2ServiceWorker* sender, ICoreWebView2WebMessageReceivedEventArgs* args) -> HRESULT { wil::unique_cotaskmem_string messageRaw; diff --git a/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessageSetting.h b/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessageSetting.h index cd85aeaf..dd53bc1a 100644 --- a/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessageSetting.h +++ b/SampleApps/WebView2APISample/ScenarioServiceWorkerPostMessageSetting.h @@ -14,8 +14,7 @@ class ScenarioServiceWorkerPostMessageSetting : public ComponentBase ScenarioServiceWorkerPostMessageSetting(AppWindow* appWindow); ~ScenarioServiceWorkerPostMessageSetting() override; void SetupEventsOnWebview(); - void SetupEventsOnServiceWorker( - wil::com_ptr serviceWorker); + void SetupEventsOnServiceWorker(wil::com_ptr serviceWorker); void ToggleServiceWorkerJsApiSetting(); void UnregisterAllServiceWorkers(); @@ -23,7 +22,7 @@ class ScenarioServiceWorkerPostMessageSetting : public ComponentBase private: AppWindow* m_appWindow; wil::com_ptr m_webView; - wil::com_ptr m_serviceWorkerManager; + wil::com_ptr m_serviceWorkerManager; std::wstring m_sampleUri; EventRegistrationToken m_serviceWorkerRegisteredToken = {}; EventRegistrationToken m_contentLoadingToken = {}; diff --git a/SampleApps/WebView2APISample/ScenarioSharedWorkerManager.cpp b/SampleApps/WebView2APISample/ScenarioSharedWorkerManager.cpp index 0d682155..66ba75d8 100644 --- a/SampleApps/WebView2APISample/ScenarioSharedWorkerManager.cpp +++ b/SampleApps/WebView2APISample/ScenarioSharedWorkerManager.cpp @@ -26,11 +26,9 @@ void ScenarioSharedWorkerManager::GetSharedWorkerManager() wil::com_ptr webView2Profile; CHECK_FAILURE(webView2_13->get_Profile(&webView2Profile)); - auto webViewExperimentalProfile13 = - webView2Profile.try_query(); - CHECK_FEATURE_RETURN_EMPTY(webViewExperimentalProfile13); - CHECK_FAILURE( - webViewExperimentalProfile13->get_SharedWorkerManager(&m_sharedWorkerManager)); + auto webViewProfile9 = webView2Profile.try_query(); + CHECK_FEATURE_RETURN_EMPTY(webViewProfile9); + CHECK_FAILURE(webViewProfile9->get_SharedWorkerManager(&m_sharedWorkerManager)); //! [SharedWorkerManager] } @@ -43,12 +41,12 @@ void ScenarioSharedWorkerManager::SetupEventsOnWebview() //! [SharedWorkerCreated] CHECK_FAILURE(m_sharedWorkerManager->add_SharedWorkerCreated( - Callback( + Callback( [this]( - ICoreWebView2ExperimentalSharedWorkerManager* sender, - ICoreWebView2ExperimentalSharedWorkerCreatedEventArgs* args) + ICoreWebView2SharedWorkerManager* sender, + ICoreWebView2SharedWorkerCreatedEventArgs* args) { - wil::com_ptr sharedWorker; + wil::com_ptr sharedWorker; CHECK_FAILURE(args->get_Worker(&sharedWorker)); wil::unique_cotaskmem_string scriptUri; @@ -59,10 +57,9 @@ void ScenarioSharedWorkerManager::SetupEventsOnWebview() // Subscribe to worker destroying event sharedWorker->add_Destroying( - Callback( + Callback( [this, scriptUriStr]( - ICoreWebView2ExperimentalSharedWorker* sender, - IUnknown* args) -> HRESULT + ICoreWebView2SharedWorker* sender, IUnknown* args) -> HRESULT { /*Cleanup on worker destruction*/ m_appWindow->AsyncMessageBox( @@ -83,10 +80,8 @@ void ScenarioSharedWorkerManager::GetAllSharedWorkers() { CHECK_FEATURE_RETURN_EMPTY(m_sharedWorkerManager); CHECK_FAILURE(m_sharedWorkerManager->GetSharedWorkers( - Callback( - [this]( - HRESULT error, - ICoreWebView2ExperimentalSharedWorkerCollectionView* workersCollection) + Callback( + [this](HRESULT error, ICoreWebView2SharedWorkerCollectionView* workersCollection) -> HRESULT { UINT32 workersCount = 0; @@ -97,7 +92,7 @@ void ScenarioSharedWorkerManager::GetAllSharedWorkers() for (UINT32 i = 0; i < workersCount; i++) { - ComPtr sharedWorker; + ComPtr sharedWorker; CHECK_FAILURE(workersCollection->GetValueAtIndex(i, &sharedWorker)); wil::unique_cotaskmem_string scriptUri; diff --git a/SampleApps/WebView2APISample/ScenarioSharedWorkerManager.h b/SampleApps/WebView2APISample/ScenarioSharedWorkerManager.h index 021d11dd..34c6e146 100644 --- a/SampleApps/WebView2APISample/ScenarioSharedWorkerManager.h +++ b/SampleApps/WebView2APISample/ScenarioSharedWorkerManager.h @@ -21,6 +21,6 @@ class ScenarioSharedWorkerManager : public ComponentBase AppWindow* m_appWindow; wil::com_ptr m_webView; - wil::com_ptr m_sharedWorkerManager; + wil::com_ptr m_sharedWorkerManager; EventRegistrationToken m_sharedWorkerCreatedToken = {}; }; diff --git a/SampleApps/WebView2APISample/SettingsComponent.cpp b/SampleApps/WebView2APISample/SettingsComponent.cpp index a6e93995..90b04027 100644 --- a/SampleApps/WebView2APISample/SettingsComponent.cpp +++ b/SampleApps/WebView2APISample/SettingsComponent.cpp @@ -1327,11 +1327,11 @@ bool SettingsComponent::HandleWindowMessage( case IDM_TRACKING_PREVENTION_LEVEL_STRICT: SetTrackingPreventionLevel(COREWEBVIEW2_TRACKING_PREVENTION_LEVEL_STRICT); return true; - case IDM_ENHANCED_SECURITY_MODE_LEVEL_OFF: - SetEnhancedSecurityModeLevel(COREWEBVIEW2_ENHANCED_SECURITY_MODE_LEVEL_OFF); + case IDM_ENHANCED_SECURITY_MODE_STATE_DISABLED: + SetEnhancedSecurityModeState(COREWEBVIEW2_ENHANCED_SECURITY_MODE_STATE_DISABLED); return true; - case IDM_ENHANCED_SECURITY_MODE_LEVEL_STRICT: - SetEnhancedSecurityModeLevel(COREWEBVIEW2_ENHANCED_SECURITY_MODE_LEVEL_STRICT); + case IDM_ENHANCED_SECURITY_MODE_STATE_ENABLED: + SetEnhancedSecurityModeState(COREWEBVIEW2_ENHANCED_SECURITY_MODE_STATE_ENABLED); return true; case ID_SETTINGS_NON_CLIENT_REGION_SUPPORT_ENABLED: { @@ -1850,9 +1850,9 @@ void SettingsComponent::SetTrackingPreventionLevel(COREWEBVIEW2_TRACKING_PREVENT } //! [SetTrackingPreventionLevel] -//! [SetEnhancedSecurityModeLevel] -void SettingsComponent::SetEnhancedSecurityModeLevel( - COREWEBVIEW2_ENHANCED_SECURITY_MODE_LEVEL value) +//! [SetEnhancedSecurityModeState] +void SettingsComponent::SetEnhancedSecurityModeState( + COREWEBVIEW2_ENHANCED_SECURITY_MODE_STATE value) { wil::com_ptr webView2_13; webView2_13 = m_webView.try_query(); @@ -1862,25 +1862,25 @@ void SettingsComponent::SetEnhancedSecurityModeLevel( wil::com_ptr profile; CHECK_FAILURE(webView2_13->get_Profile(&profile)); - auto experimentalProfile9 = profile.try_query(); - if (experimentalProfile9) + auto experimentalProfile17 = profile.try_query(); + if (experimentalProfile17) { - CHECK_FAILURE(experimentalProfile9->put_EnhancedSecurityModeLevel(value)); + CHECK_FAILURE(experimentalProfile17->put_EnhancedSecurityModeState(value)); - const wchar_t* levelText = L"Off"; - if (value == COREWEBVIEW2_ENHANCED_SECURITY_MODE_LEVEL_STRICT) + const wchar_t* stateText = L"Disabled"; + if (value == COREWEBVIEW2_ENHANCED_SECURITY_MODE_STATE_ENABLED) { - levelText = L"Strict"; + stateText = L"Enabled"; } MessageBox( nullptr, - (std::wstring(L"Enhanced Security Mode level is set to ") + levelText).c_str(), - L"Enhanced Security Mode Level", MB_OK); + (std::wstring(L"Enhanced Security Mode state is set to ") + stateText).c_str(), + L"Enhanced Security Mode State", MB_OK); } } } -//! [SetEnhancedSecurityModeLevel] +//! [SetEnhancedSecurityModeState] SettingsComponent::~SettingsComponent() { diff --git a/SampleApps/WebView2APISample/SettingsComponent.h b/SampleApps/WebView2APISample/SettingsComponent.h index 109328be..c3662d12 100644 --- a/SampleApps/WebView2APISample/SettingsComponent.h +++ b/SampleApps/WebView2APISample/SettingsComponent.h @@ -46,7 +46,7 @@ class SettingsComponent : public ComponentBase void SetTrackingPreventionLevel(COREWEBVIEW2_TRACKING_PREVENTION_LEVEL value); - void SetEnhancedSecurityModeLevel(COREWEBVIEW2_ENHANCED_SECURITY_MODE_LEVEL value); + void SetEnhancedSecurityModeState(COREWEBVIEW2_ENHANCED_SECURITY_MODE_STATE value); ~SettingsComponent() override; diff --git a/SampleApps/WebView2APISample/WebView2APISample.rc b/SampleApps/WebView2APISample/WebView2APISample.rc index 36b69f38..d7f80506 100644 --- a/SampleApps/WebView2APISample/WebView2APISample.rc +++ b/SampleApps/WebView2APISample/WebView2APISample.rc @@ -172,10 +172,10 @@ BEGIN MENUITEM "Balanced", IDM_TRACKING_PREVENTION_LEVEL_BALANCED MENUITEM "Strict", IDM_TRACKING_PREVENTION_LEVEL_STRICT END - POPUP "Enhanced Security Mode Level" + POPUP "Enhanced Security Mode State" BEGIN - MENUITEM "Off", IDM_ENHANCED_SECURITY_MODE_LEVEL_OFF - MENUITEM "Strict", IDM_ENHANCED_SECURITY_MODE_LEVEL_STRICT + MENUITEM "Disabled", IDM_ENHANCED_SECURITY_MODE_STATE_DISABLED + MENUITEM "Enabled", IDM_ENHANCED_SECURITY_MODE_STATE_ENABLED END MENUITEM "Toggle Non-Client Region Support", ID_SETTINGS_NON_CLIENT_REGION_SUPPORT_ENABLED END diff --git a/SampleApps/WebView2APISample/WebView2APISample.vcxproj b/SampleApps/WebView2APISample/WebView2APISample.vcxproj index 85728c70..818065c1 100644 --- a/SampleApps/WebView2APISample/WebView2APISample.vcxproj +++ b/SampleApps/WebView2APISample/WebView2APISample.vcxproj @@ -536,13 +536,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/packages.config b/SampleApps/WebView2APISample/packages.config index 0131375e..d5f1f006 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/WebView2APISample/resource.h b/SampleApps/WebView2APISample/resource.h index 2c1d4b50..c974e7c5 100644 --- a/SampleApps/WebView2APISample/resource.h +++ b/SampleApps/WebView2APISample/resource.h @@ -126,8 +126,8 @@ #define IDC_EDIT_SAVE_AS_FILENAME 262 #define IDC_CHECK_SAVE_AS_ALLOW_REPLACE 263 #define IDC_SAVE_AS_KIND 264 -#define IDM_ENHANCED_SECURITY_MODE_LEVEL_OFF 265 -#define IDM_ENHANCED_SECURITY_MODE_LEVEL_STRICT 266 +#define IDM_ENHANCED_SECURITY_MODE_STATE_DISABLED 265 +#define IDM_ENHANCED_SECURITY_MODE_STATE_ENABLED 266 #define IDM_TOGGLE_TOPMOST_WINDOW 300 #define IDM_PROCESS_EXTENDED_INFO 301 #define IDE_ADDRESSBAR 1000 diff --git a/SampleApps/WebView2APISample/stdafx.cpp b/SampleApps/WebView2APISample/stdafx.cpp index 58f1c7e5..cc2ca489 100644 --- a/SampleApps/WebView2APISample/stdafx.cpp +++ b/SampleApps/WebView2APISample/stdafx.cpp @@ -8,5 +8,5 @@ #include "stdafx.h" -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file +// Note: Reference any additional headers you need in STDAFX.H +// and not in this file. diff --git a/SampleApps/WebView2WindowsFormsBrowser/BrowserForm.Designer.cs b/SampleApps/WebView2WindowsFormsBrowser/BrowserForm.Designer.cs index cf403323..abca545d 100644 --- a/SampleApps/WebView2WindowsFormsBrowser/BrowserForm.Designer.cs +++ b/SampleApps/WebView2WindowsFormsBrowser/BrowserForm.Designer.cs @@ -1,4 +1,4 @@ -// Copyright (C) Microsoft Corporation. All rights reserved. +// 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. @@ -409,7 +409,7 @@ private void InitializeComponent() this.scriptToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.injectScriptMenuItem, this.injectScriptIntoFrameMenuItem, - this.methodCDPToolStripMenuItem, + this.methodCDPToolStripMenuItem, this.taskManagerToolStripMenuItem, this.postMessageStringMenuItem, this.postMessageJsonMenuItem, @@ -626,7 +626,7 @@ private void InitializeComponent() this.addRemoteObjectMenuItem.Click += new System.EventHandler(this.addRemoteObjectMenuItem_Click); // // domContentLoadedMenuItem - // + // this.domContentLoadedMenuItem.Name = "domContentLoadedMenuItem"; this.domContentLoadedMenuItem.Size = new System.Drawing.Size(359, 44); this.domContentLoadedMenuItem.Text = "DOM Content Loaded"; diff --git a/SampleApps/WebView2WindowsFormsBrowser/ClientCertificateSelectionDialog.Designer.cs b/SampleApps/WebView2WindowsFormsBrowser/ClientCertificateSelectionDialog.Designer.cs index eab8cf06..98d19ef1 100644 --- a/SampleApps/WebView2WindowsFormsBrowser/ClientCertificateSelectionDialog.Designer.cs +++ b/SampleApps/WebView2WindowsFormsBrowser/ClientCertificateSelectionDialog.Designer.cs @@ -1,4 +1,4 @@ - + namespace WebView2WindowsFormsBrowser { partial class ClientCertificateSelectionDialog @@ -34,9 +34,9 @@ private void InitializeComponent() this.txtDescription = new System.Windows.Forms.TextBox(); this.CertificateDataBinding = new System.Windows.Forms.ListView(); this.SuspendLayout(); - // + // // btnOk - // + // this.btnOk.Location = new System.Drawing.Point(464, 295); this.btnOk.Name = "btnOk"; this.btnOk.Size = new System.Drawing.Size(75, 23); @@ -44,9 +44,9 @@ private void InitializeComponent() this.btnOk.Text = "OK"; this.btnOk.UseVisualStyleBackColor = true; this.btnOk.Click += new System.EventHandler(this.btnOk_Click); - // + // // btnCancel - // + // this.btnCancel.Location = new System.Drawing.Point(545, 295); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(75, 23); @@ -54,27 +54,27 @@ private void InitializeComponent() this.btnCancel.Text = "Cancel"; this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); - // + // // txtDescription - // + // this.txtDescription.Location = new System.Drawing.Point(22, 12); this.txtDescription.Multiline = true; this.txtDescription.Name = "txtDescription"; this.txtDescription.ReadOnly = true; this.txtDescription.Size = new System.Drawing.Size(598, 20); this.txtDescription.TabIndex = 3; - // + // // CertificateDataBinding - // + // this.CertificateDataBinding.HideSelection = false; this.CertificateDataBinding.Location = new System.Drawing.Point(22, 51); this.CertificateDataBinding.Name = "CertificateDataBinding"; this.CertificateDataBinding.Size = new System.Drawing.Size(598, 226); this.CertificateDataBinding.TabIndex = 4; this.CertificateDataBinding.UseCompatibleStateImageBehavior = false; - // + // // ClientCertificateSelectionDialog - // + // this.AcceptButton = this.btnOk; this.CancelButton = this.btnCancel; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/SampleApps/WebView2WindowsFormsBrowser/EventMonitor.cs b/SampleApps/WebView2WindowsFormsBrowser/EventMonitor.cs index 3b56931e..9fbc49fb 100644 --- a/SampleApps/WebView2WindowsFormsBrowser/EventMonitor.cs +++ b/SampleApps/WebView2WindowsFormsBrowser/EventMonitor.cs @@ -1,4 +1,4 @@ -// Copyright (C) Microsoft Corporation. All rights reserved. +// 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. @@ -44,9 +44,9 @@ private void InitializeComponent() this._eventsListBox = new System.Windows.Forms.ListBox(); this._eventDetailsListBox = new System.Windows.Forms.ListBox(); this.SuspendLayout(); - // + // // clearButton - // + // this._clearButton.Location = new System.Drawing.Point(0, 0); this._clearButton.Name = "clearButton"; this._clearButton.Size = new System.Drawing.Size(75, 23); diff --git a/SampleApps/WebView2WindowsFormsBrowser/NewWindowOptionsDialog.Designer.cs b/SampleApps/WebView2WindowsFormsBrowser/NewWindowOptionsDialog.Designer.cs index 4347e7bb..9bb0cad2 100644 --- a/SampleApps/WebView2WindowsFormsBrowser/NewWindowOptionsDialog.Designer.cs +++ b/SampleApps/WebView2WindowsFormsBrowser/NewWindowOptionsDialog.Designer.cs @@ -1,4 +1,4 @@ -// Copyright (C) Microsoft Corporation. All rights reserved. +// 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. @@ -59,9 +59,9 @@ private void InitializeComponent() this.flowLayoutPanel6.SuspendLayout(); this.flowLayoutPanel7.SuspendLayout(); this.SuspendLayout(); - // + // // flowLayoutPanel1 - // + // this.flowLayoutPanel1.Controls.Add(this.flowLayoutPanel2); this.flowLayoutPanel1.Controls.Add(this.flowLayoutPanel3); this.flowLayoutPanel1.Controls.Add(this.flowLayoutPanel4); @@ -72,9 +72,9 @@ private void InitializeComponent() this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Size = new System.Drawing.Size(450, 184); this.flowLayoutPanel1.TabIndex = 0; - // + // // flowLayoutPanel2 - // + // this.flowLayoutPanel2.Controls.Add(this.label1); this.flowLayoutPanel2.Controls.Add(this.BrowserExecutableFolder); this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 0); @@ -82,9 +82,9 @@ private void InitializeComponent() this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Size = new System.Drawing.Size(450, 32); this.flowLayoutPanel2.TabIndex = 0; - // + // // label1 - // + // this.label1.Anchor = System.Windows.Forms.AnchorStyles.None; this.label1.Location = new System.Drawing.Point(10, 0); this.label1.Margin = new System.Windows.Forms.Padding(10, 0, 0, 0); @@ -93,9 +93,9 @@ private void InitializeComponent() this.label1.TabIndex = 0; this.label1.Text = "BrowserExecutableFolder:"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // BrowserExecutableFolder - // + // this.BrowserExecutableFolder.Anchor = System.Windows.Forms.AnchorStyles.None; this.BrowserExecutableFolder.Location = new System.Drawing.Point(155, 5); this.BrowserExecutableFolder.Margin = new System.Windows.Forms.Padding(0); @@ -103,9 +103,9 @@ private void InitializeComponent() this.BrowserExecutableFolder.AutoSize = false; this.BrowserExecutableFolder.Size = new System.Drawing.Size(285, 25); this.BrowserExecutableFolder.TabIndex = 1; - // + // // flowLayoutPanel3 - // + // this.flowLayoutPanel3.Controls.Add(this.label2); this.flowLayoutPanel3.Controls.Add(this.UserDataFolder); this.flowLayoutPanel3.Location = new System.Drawing.Point(0, 32); @@ -113,9 +113,9 @@ private void InitializeComponent() this.flowLayoutPanel3.Name = "flowLayoutPanel3"; this.flowLayoutPanel3.Size = new System.Drawing.Size(450, 32); this.flowLayoutPanel3.TabIndex = 1; - // + // // label2 - // + // this.label2.Anchor = System.Windows.Forms.AnchorStyles.None; this.label2.Location = new System.Drawing.Point(10, 0); this.label2.Margin = new System.Windows.Forms.Padding(10, 0, 0, 0); @@ -124,9 +124,9 @@ private void InitializeComponent() this.label2.TabIndex = 0; this.label2.Text = "UserDataFolder:"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // UserDataFolder - // + // this.UserDataFolder.Anchor = System.Windows.Forms.AnchorStyles.None; this.UserDataFolder.Location = new System.Drawing.Point(155, 5); this.UserDataFolder.Margin = new System.Windows.Forms.Padding(0); @@ -134,9 +134,9 @@ private void InitializeComponent() this.UserDataFolder.AutoSize = false; this.UserDataFolder.Size = new System.Drawing.Size(285, 25); this.UserDataFolder.TabIndex = 1; - // + // // flowLayoutPanel4 - // + // this.flowLayoutPanel4.Controls.Add(this.label3); this.flowLayoutPanel4.Controls.Add(this.EnvLanguage); this.flowLayoutPanel4.Location = new System.Drawing.Point(0, 64); @@ -144,9 +144,9 @@ private void InitializeComponent() this.flowLayoutPanel4.Name = "flowLayoutPanel4"; this.flowLayoutPanel4.Size = new System.Drawing.Size(450, 32); this.flowLayoutPanel4.TabIndex = 2; - // + // // label3 - // + // this.label3.Anchor = System.Windows.Forms.AnchorStyles.None; this.label3.Location = new System.Drawing.Point(10, 0); this.label3.Margin = new System.Windows.Forms.Padding(10, 0, 0, 0); @@ -155,9 +155,9 @@ private void InitializeComponent() this.label3.TabIndex = 0; this.label3.Text = "Language:"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // EnvLanguage - // + // this.EnvLanguage.Anchor = System.Windows.Forms.AnchorStyles.None; this.EnvLanguage.Location = new System.Drawing.Point(155, 5); this.EnvLanguage.Margin = new System.Windows.Forms.Padding(0); @@ -165,9 +165,9 @@ private void InitializeComponent() this.EnvLanguage.AutoSize = false; this.EnvLanguage.Size = new System.Drawing.Size(285, 25); this.EnvLanguage.TabIndex = 1; - // + // // flowLayoutPanel5 - // + // this.flowLayoutPanel5.Controls.Add(this.label4); this.flowLayoutPanel5.Controls.Add(this.ProfileName); this.flowLayoutPanel5.Location = new System.Drawing.Point(0, 96); @@ -175,9 +175,9 @@ private void InitializeComponent() this.flowLayoutPanel5.Name = "flowLayoutPanel5"; this.flowLayoutPanel5.Size = new System.Drawing.Size(450, 32); this.flowLayoutPanel5.TabIndex = 3; - // + // // label4 - // + // this.label4.Anchor = System.Windows.Forms.AnchorStyles.None; this.label4.Location = new System.Drawing.Point(10, 0); this.label4.Margin = new System.Windows.Forms.Padding(10, 0, 0, 0); @@ -186,9 +186,9 @@ private void InitializeComponent() this.label4.TabIndex = 0; this.label4.Text = "ProfileName:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // ProfileName - // + // this.ProfileName.Anchor = System.Windows.Forms.AnchorStyles.None; this.ProfileName.Location = new System.Drawing.Point(155, 5); this.ProfileName.Margin = new System.Windows.Forms.Padding(0); @@ -196,9 +196,9 @@ private void InitializeComponent() this.ProfileName.AutoSize = false; this.ProfileName.Size = new System.Drawing.Size(285, 25); this.ProfileName.TabIndex = 1; - // + // // flowLayoutPanel6 - // + // this.flowLayoutPanel6.Controls.Add(this.label5); this.flowLayoutPanel6.Controls.Add(this.comboBox_IsInPrivateModeEnabled); this.flowLayoutPanel6.Location = new System.Drawing.Point(0, 128); @@ -206,9 +206,9 @@ private void InitializeComponent() this.flowLayoutPanel6.Name = "flowLayoutPanel6"; this.flowLayoutPanel6.Size = new System.Drawing.Size(450, 32); this.flowLayoutPanel6.TabIndex = 4; - // + // // label5 - // + // this.label5.Anchor = System.Windows.Forms.AnchorStyles.None; this.label5.Location = new System.Drawing.Point(10, 0); this.label5.Margin = new System.Windows.Forms.Padding(10, 0, 0, 0); @@ -217,9 +217,9 @@ private void InitializeComponent() this.label5.TabIndex = 0; this.label5.Text = "IsInPrivateModeEnabled:"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // comboBox_IsInPrivateModeEnabled - // + // this.comboBox_IsInPrivateModeEnabled.Anchor = System.Windows.Forms.AnchorStyles.None; this.comboBox_IsInPrivateModeEnabled.FormattingEnabled = true; this.comboBox_IsInPrivateModeEnabled.Items.AddRange(new object[] { @@ -233,18 +233,18 @@ private void InitializeComponent() this.comboBox_IsInPrivateModeEnabled.Size = new System.Drawing.Size(120, 25); this.comboBox_IsInPrivateModeEnabled.TabIndex = 1; this.comboBox_IsInPrivateModeEnabled.Text = "Default"; - // + // // flowLayoutPanel7 - // + // this.flowLayoutPanel7.Controls.Add(this.OKBtn); this.flowLayoutPanel7.Controls.Add(this.CancelBtn); this.flowLayoutPanel7.Location = new System.Drawing.Point(10, 200); this.flowLayoutPanel7.Name = "flowLayoutPanel7"; this.flowLayoutPanel7.Size = new System.Drawing.Size(450, 32); this.flowLayoutPanel7.TabIndex = 1; - // + // // OKBtn - // + // this.OKBtn.Anchor = System.Windows.Forms.AnchorStyles.None; this.OKBtn.Location = new System.Drawing.Point(296, 0); this.OKBtn.Margin = new System.Windows.Forms.Padding(296, 0, 0, 0); @@ -254,9 +254,9 @@ private void InitializeComponent() this.OKBtn.Text = "OK"; this.OKBtn.UseVisualStyleBackColor = true; this.OKBtn.Click += new System.EventHandler(this.OKBtn_Click); - // + // // CancelBtn - // + // this.CancelBtn.Location = new System.Drawing.Point(361, 0); this.CancelBtn.Margin = new System.Windows.Forms.Padding(5, 0, 0, 0); this.CancelBtn.Name = "CancelBtn"; @@ -265,9 +265,9 @@ private void InitializeComponent() this.CancelBtn.Text = "Cancel"; this.CancelBtn.UseVisualStyleBackColor = true; this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click); - // + // // NewWindowOptionsDialog - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(500, 260); diff --git a/SampleApps/WebView2WindowsFormsBrowser/TextInputDialog.Designer.cs b/SampleApps/WebView2WindowsFormsBrowser/TextInputDialog.Designer.cs index 8e0e2d35..07fef06e 100644 --- a/SampleApps/WebView2WindowsFormsBrowser/TextInputDialog.Designer.cs +++ b/SampleApps/WebView2WindowsFormsBrowser/TextInputDialog.Designer.cs @@ -1,4 +1,4 @@ - + namespace WebView2WindowsFormsBrowser { partial class TextInputDialog @@ -34,44 +34,44 @@ private void InitializeComponent() this.txtDescription = new System.Windows.Forms.TextBox(); this.txtInput = new System.Windows.Forms.TextBox(); this.SuspendLayout(); - // + // // btnOk - // + // this.btnOk.Location = new System.Drawing.Point(443, 218); this.btnOk.Name = "btnOk"; this.btnOk.Size = new System.Drawing.Size(93, 40); this.btnOk.TabIndex = 0; this.btnOk.Text = "OK"; this.btnOk.Click += new System.EventHandler(this.btnOk_Click); - // + // // btnCancel - // + // this.btnCancel.Location = new System.Drawing.Point(529, 218); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(93, 40); this.btnCancel.TabIndex = 1; this.btnCancel.Text = "Cancel"; this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); - // + // // txtDescription - // + // this.txtDescription.Location = new System.Drawing.Point(-1, 2); this.txtDescription.Multiline = true; this.txtDescription.Name = "txtDescription"; this.txtDescription.ReadOnly = true; this.txtDescription.Size = new System.Drawing.Size(623, 33); this.txtDescription.TabIndex = 2; - // + // // txtInput - // + // this.txtInput.Location = new System.Drawing.Point(-1, 30); this.txtInput.Multiline = true; this.txtInput.Name = "txtInput"; this.txtInput.Size = new System.Drawing.Size(623, 190); this.txtInput.TabIndex = 3; - // + // // TextInputDialog - // + // this.ClientSize = new System.Drawing.Size(620, 261); this.Controls.Add(this.txtDescription); this.Controls.Add(this.txtInput); diff --git a/SampleApps/WebView2WindowsFormsBrowser/WebView2WindowsFormsBrowser.csproj b/SampleApps/WebView2WindowsFormsBrowser/WebView2WindowsFormsBrowser.csproj index 00513713..84bf3fc2 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 6ac8de13..4d2f58ce 100644 --- a/SampleApps/WebView2WpfBrowser/MainWindow.xaml +++ b/SampleApps/WebView2WpfBrowser/MainWindow.xaml @@ -83,7 +83,7 @@ found in the LICENSE file. - + @@ -209,9 +209,9 @@ found in the LICENSE file. - - - + + + diff --git a/SampleApps/WebView2WpfBrowser/MainWindow.xaml.cs b/SampleApps/WebView2WpfBrowser/MainWindow.xaml.cs index 512f0d9a..9e6435f1 100644 --- a/SampleApps/WebView2WpfBrowser/MainWindow.xaml.cs +++ b/SampleApps/WebView2WpfBrowser/MainWindow.xaml.cs @@ -84,7 +84,7 @@ public partial class MainWindow : Window public static RoutedCommand CreateNewThreadCommand = new RoutedCommand(); public static RoutedCommand ExtensionsCommand = new RoutedCommand(); public static RoutedCommand TrackingPreventionLevelCommand = new RoutedCommand(); - public static RoutedCommand EnhancedSecurityModeLevelCommand = new RoutedCommand(); + public static RoutedCommand EnhancedSecurityModeStateCommand = new RoutedCommand(); public static RoutedCommand WebRtcUdpPortConfigCommand = new RoutedCommand(); public static RoutedCommand PrintDialogCommand = new RoutedCommand(); public static RoutedCommand PrintToDefaultPrinterCommand = new RoutedCommand(); @@ -337,13 +337,13 @@ async Task InitializeWebView(IWebView2 webView2) // CoreWebView2EnvironmentOptions options = new CoreWebView2EnvironmentOptions(); - try + try { // Set allowed port range for WebRTC UDP traffic (example: ports 10000-20000) options.SetAllowedPortRange( - CoreWebView2AllowedPortRangeScope.WebRtc, - CoreWebView2TransportProtocolKind.Udp, - 10000, + CoreWebView2AllowedPortRangeScope.WebRtc, + CoreWebView2TransportProtocolKind.Udp, + 10000, 20000); } @@ -357,9 +357,9 @@ async Task InitializeWebView(IWebView2 webView2) { browserExecutableFolder = webView2.CreationProperties.BrowserExecutableFolder; } - + CoreWebView2Environment environment = await CoreWebView2Environment.CreateAsync(browserExecutableFolder, null, options); - + // Configure WebRTC UDP port range if experimental API is available await webView2.EnsureCoreWebView2Async(environment); // @@ -1034,29 +1034,29 @@ void SetTrackingPreventionLevel(CoreWebView2TrackingPreventionLevel value) } // - void EnhancedSecurityModeLevelCommandExecuted(object target, ExecutedRoutedEventArgs e) + void EnhancedSecurityModeStateCommandExecuted(object target, ExecutedRoutedEventArgs e) { #if USE_WEBVIEW2_EXPERIMENTAL - string level = e.Parameter.ToString(); - if (level == "Off") + string state = e.Parameter.ToString(); + if (state == "Disabled") { - SetEnhancedSecurityModeLevel(CoreWebView2EnhancedSecurityModeLevel.Off); + SetEnhancedSecurityModeState(CoreWebView2EnhancedSecurityModeState.Disabled); } else { - SetEnhancedSecurityModeLevel(CoreWebView2EnhancedSecurityModeLevel.Strict); + SetEnhancedSecurityModeState(CoreWebView2EnhancedSecurityModeState.Enabled); } #endif } #if USE_WEBVIEW2_EXPERIMENTAL - // - void SetEnhancedSecurityModeLevel(CoreWebView2EnhancedSecurityModeLevel value) + // + void SetEnhancedSecurityModeState(CoreWebView2EnhancedSecurityModeState value) { - WebViewProfile.EnhancedSecurityModeLevel = value; - MessageBox.Show(this, "Enhanced security mode level is set successfully", "Enhanced Security Mode Level"); + WebViewProfile.EnhancedSecurityModeState = value; + MessageBox.Show(this, "Enhanced security mode state is set successfully", "Enhanced Security Mode State"); } - // + // #endif void WebRtcUdpPortConfigCommandExecuted(object target, ExecutedRoutedEventArgs e) @@ -1073,7 +1073,7 @@ void WebRtcUdpPortConfigCommandExecuted(object target, ExecutedRoutedEventArgs e MessageBox.Show("WebView2 is not initialized.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning); } #else - MessageBox.Show("WebRTC UDP Port Configuration is only available in prerelease builds", + MessageBox.Show("WebRTC UDP Port Configuration is only available in prerelease builds", "Feature Not Available", MessageBoxButton.OK, MessageBoxImage.Information); #endif } @@ -4556,7 +4556,7 @@ private async void ToggleFindOptionAndRestart(Func optionGetter, Action - + diff --git a/SampleApps/WebView2_WinUI3_Sample/WebView2_WinUI3_Sample/MainWindow.xaml.cs b/SampleApps/WebView2_WinUI3_Sample/WebView2_WinUI3_Sample/MainWindow.xaml.cs index c9d8ada5..7a7ea798 100644 --- a/SampleApps/WebView2_WinUI3_Sample/WebView2_WinUI3_Sample/MainWindow.xaml.cs +++ b/SampleApps/WebView2_WinUI3_Sample/WebView2_WinUI3_Sample/MainWindow.xaml.cs @@ -1,4 +1,4 @@ -using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; using System; diff --git a/SampleApps/webview2_sample_uwp/AddHostObjectBridgeComponent/Properties/AssemblyInfo.cs b/SampleApps/webview2_sample_uwp/AddHostObjectBridgeComponent/Properties/AssemblyInfo.cs index 10545443..8c66d0d7 100644 --- a/SampleApps/webview2_sample_uwp/AddHostObjectBridgeComponent/Properties/AssemblyInfo.cs +++ b/SampleApps/webview2_sample_uwp/AddHostObjectBridgeComponent/Properties/AssemblyInfo.cs @@ -1,8 +1,8 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AddHostObjectBridgeComponent")] @@ -10,18 +10,18 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AddHostObjectBridgeComponent")] -[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/SampleApps/webview2_sample_uwp/properties/AssemblyInfo.cs b/SampleApps/webview2_sample_uwp/properties/AssemblyInfo.cs index 4dad4997..f167106c 100644 --- a/SampleApps/webview2_sample_uwp/properties/AssemblyInfo.cs +++ b/SampleApps/webview2_sample_uwp/properties/AssemblyInfo.cs @@ -1,8 +1,8 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] @@ -13,11 +13,11 @@ // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] @@ -26,4 +26,4 @@ [assembly: AssemblyTitleAttribute("webview2_sample_uwp")] [assembly: AssemblyDescriptionAttribute("A WebView2 WinUI2 UWP test application")] [assembly: AssemblyCompanyAttribute("Microsoft")] -[assembly: AssemblyCopyrightAttribute("Copyright © Microsoft Inc. 2021")] +[assembly: AssemblyCopyrightAttribute("Copyright © Microsoft Inc. 2021")]