Skip to content

Commit 4982548

Browse files
Apply suggestions from code review
Co-authored-by: David Risney <dave@deletethis.net>
1 parent d9ef9da commit 4982548

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

specs/IsSmartScreenRequired

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@
55
Currently, end developers can use `options->put_AdditionalBrowserArguments(L"--disable-features=msSmartScreenProtection")` to control SmartScreen in the WebView2 application. It is essentially a startup parameter of the browser process. It must be determined when the WebView2Environment is created. And and cannot be modified at runtime.
66

77
To support more flexibility we introduce a new API.
8+
We initially considered an API like `CoreWebView2Environment.IsSmartScreenEnabled` that would directly change the value for all the processes. The problem is this is not easy to do for apps like Office who have multiple apps connected to the same browser process. In their case each app has IsSmartScreenEnabled and its hard for the browser process to know which change to the property should win.
89

10+
Instead we have CoreWebView2Settings.IsSmartScreenRequired. Each WebView2 declares if it requires SmartScreen. Some WebView2s may be used to display app content and don't require SmartScreen and others may be rendering arbitrary web content and do need SmartScreen. Having SmartScreen on unnecessarily for app content is a detriment to performance but otherwise not a problem. Having SmartScreen off for arbitrary web content is an issue. We have to turn SmartScreen on or off for all the WebView2s in an environment so if any WebView2 requires SmartScreen then we turn it on for all of them. If WebView2 settings change or WebView2s are closed and then all the WebView2s in an environment don't require SmartScreen, then we can turn SmartScreen off.
11+
12+
It is much easier to indicate if individual WebView2s require SmartScreen than to have an end developer explicitly manage if SmartScreen should be enabled as a whole, especially when its different sets of WebView2s in different processes (like Excel's set of WebView2s and Word's set of WebView2s) all sharing the same user data folder.
913
In this document we describe the new setting. We'd appreciate your feedback.
1014

1115

1216
# Description
13-
Users can use ICoreWebView2Settings to control it.When it is changed, all WebView2 applications using the same path of the user data folder will be changed.
14-
`put_IsSmartScreenRequired(true)` will always take effect when multiple WebView2s using the same user data folder call `put_IsSmartScreenRequired` at the same time.`put_IsSmartScreenRequired(false)` only takes effect if all WebView2 settings are false.
15-
The default value for `IsSmartScreenRequired` is the current actual value.After this, this setting does not mean the actual situation, it only represents the intention of current WebView.
16-
When the set `false` takes effect, it will turn off SmartScreen protection when visiting web pages and performing downloads.
17+
You can use CoreWebView2Settings.IsSmartScreen to control SmartScreen. SmartScreen is enabled or disabled per browser process, so all WebView2 applications sharing the same user data folder path also share SmartScreen being enabled or disabled.
18+
If CoreWebView2Setting.IsSmartScreenRequired is true for any CoreWebView2 in its associated CoreWebView2Environment, then SmartScreen is enabled. If CoreWebView2Setting.IsSmartScreenRequired is false for all CoreWebView2s in their CoreWebView2Environment, then SmartScreen is disabled.
19+
The default value for `IsSmartScreenRequired` is true if SmartScreen is enabled when the CoreWebView2 is created and false if SmartScreen is disabled when the CoreWebView2 is created. The value doesn't change if SmartScreen is enabled or disabled later.
1720

18-
Changes to `IsSmartScreenRequired` does not take effect until the next navigation or download.
21+
Changes to `IsSmartScreenRequired` take effect on the next navigation or download.
1922

2023

2124
# Examples
@@ -44,7 +47,6 @@ void ToggleSmartScreenRequired()
4447
```
4548

4649
# Remarks
47-
All WebViews using the same user data folder share the same SmartScreen setting. When it is changed, the change will be applied to all WebViews using the same user data folder.
4850

4951
# API Notes
5052

@@ -58,8 +60,9 @@ See [API Details](#api-details) section below for API reference.
5860
interface ICoreWebView2Settings11 : ICoreWebView2Settings10 {
5961
/// SmartScreen helps you identify reported phishing and malware websites
6062
/// and also helps you make informed decisions about downloads.
61-
/// `IsSmartScreenRequired` is used to control whether SmartScreen is turned on or not.
62-
/// All WebViews using the same user data folder share the same SmartScreen setting.
63+
/// `IsSmartScreenRequired` is used to control whether SmartScreen enabled or not.
64+
/// SmartScreen is enabled or disabled for all CoreWebView2s in a CoreWebView2Environment.
65+
/// If CoreWebView2Setting.IsSmartScreenRequired is true for any CoreWebView2 in its associated CoreWebView2Environment, then SmartScreen is enabled. If CoreWebView2Setting.IsSmartScreenRequired is false for all CoreWebView2s in the associated CoreWebView2Environment, then SmartScreen is disabled.
6366
/// When it is changed, the change will be applied to all WebViews using the
6467
/// same user data folder.
6568
/// By default, it is the current actual state of SmartScreen.

0 commit comments

Comments
 (0)