Skip to content

Commit 05627f8

Browse files
author
Maura Winstanley
committed
api review changes
1 parent cc435c7 commit 05627f8

1 file changed

Lines changed: 46 additions & 28 deletions

File tree

specs/Autofill.md

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Background
2-
The WebView2 team has been asked for an API to allow end developers to set the autofill preferences. We are exposing two of the autofill preferences that will allow enabling and disabling general and password autofill. General autofill includes things like email addresses, shipping addresses, phone numbers, and names. Password autofill includes things like usernames and passwords for login. Password information is not included in the general autofill.
2+
The WebView2 team has been asked for an API to allow end developers to set the autofill preferences. We are exposing two of the autofill preferences that will allow enabling and disabling general and password autosave. General autofill includes things like email addresses, shipping addresses, phone numbers, and names. Password autosave includes things like usernames and passwords for login. Password information is not included in the general autofill.
33

44
In this document we describe the updated API. We'd appreciate your feedback.
55

@@ -11,31 +11,46 @@ Autofill has three components
1111
* Suggest - When the user clicks on the form field, drop down suggestions of previously saved forms will be displayed.
1212
* Populate - When clicking on one of the suggestions, the form data will populate the respective fields.
1313

14-
The general autofill setting and password autofill setting behave independently. Their behavior differs as well.
15-
When the password autofill setting is disabled, no new password data is saved and no Save/Update Password prompts are displayed. However, if there was password data already saved before disabling this setting, then that password information is auto-populated, suggestions are shown and clicking on one will populate the fields. When the password autofill setting is enabled, password information is auto-populated, suggestions are shown and clicking on one will populate the fields, new data is saved, and a Save/Update Password prompt is displayed. The password autofill setting default behavior is enabled.
16-
When the general autofill setting is disabled, no suggestions appear, and no new information is saved. When the general autofill setting is enabled, information is saved, suggestions appear and clicking on one will populate the form fields.
14+
The general autofill setting and password autosave setting behave independently. Their behavior differs as well.
15+
The default behavior for the general autofill setting is enabled.
16+
The default behavior for the password autosave setting is disabled.
1717

18+
| Behavior | IsPasswordAutosaveEnabled = false | IsGeneralAutofillEnabled = false | IsPasswordAutoSaveEnabled = true | IsGeneralAutofillEnabled = true |
19+
|-|-|-|-|-|
20+
| Populate on accepted suggestion | Yes | No | Yes | Yes |
21+
| Suggestions | Yes | No | Yes | Yes |
22+
| Auto-populate | Yes | No | Yes | Yes |
23+
| Save/Update prompt | No | N/A | Yes | N/A |
24+
| Input saved | No | No | Yes | Yes |
25+
26+
The information that is autofilled, auto-populated, or suggested when the IsPasswordAutosaveEnabled is false is previously saved information when the IsPasswordAutosaveEnabled property has been set to true.
1827

1928
# Examples
2029

2130
## Win32 C++
2231
```cpp
2332
void SettingsComponent::TogglePasswordAutofill() {
2433
wil::com_ptr<ICoreWebView2Settings> settings;
25-
webView->get_Settings(&settings);
34+
CHECK_FAILURE(webView->get_Settings(&settings));
2635
wil::com_ptr<ICoreWebView2Settings4> settings4 = settings.try_query<ICoreWebView2Settings4>();
27-
bool enabled;
28-
settings4->get_IsPasswordAutofillEnabled(&enabled);
29-
settings4->put_IsPasswordAutofillEnabled(!enabled);
36+
if (settings4)
37+
{
38+
bool enabled;
39+
CHECK_FAILURE(settings4->get_IsPasswordAutofillEnabled(&enabled));
40+
CHECK_FAILURE(settings4->put_IsPasswordAutofillEnabled(!enabled));
41+
}
3042
}
3143

3244
void SettingsComponent::ToggleGeneralAutofill() {
3345
wil::com_ptr<ICoreWebView2Settings> settings;
34-
webView->get_Settings(&settings);
46+
CHECK_FAILURE(webView->get_Settings(&settings));
3547
wil::com_ptr<ICoreWebView2Settings4> settings4 = settings.try_query<ICoreWebView2Settings4>();
36-
bool enabled;
37-
settings4->get_IsGeneralAutofillEnabled(&enabled);
38-
settings4->put_IsGeneralAutofillEnabled(!enabled);
48+
if (settings4)
49+
{
50+
bool enabled;
51+
CHECK_FAILURE(settings4->get_IsGeneralAutofillEnabled(&enabled));
52+
CHECK_FAILURE(settings4->put_IsGeneralAutofillEnabled(!enabled));
53+
}
3954
}
4055
```
4156

@@ -68,34 +83,37 @@ See [API Details](#api-details) section below for API reference.
6883
```IDL
6984
interface ICoreWebView2Settings4
7085
71-
[uuid(f051013e-4bb3-46b2-b6e4-6ee3fe4f43c2), object, pointer_default(unique)]
86+
/// A continuation of the ICoreWebView2Settings interface.
87+
[uuid(cb56846c-4168-4d53-b04f-03b6d6796ff2), object, pointer_default(unique)]
7288
interface ICoreWebView2Settings4 : ICoreWebView2Settings3 {
73-
/// IsPasswordAutofillEnabled controls whether autofill for password
74-
/// information is enabled. The IsPasswordAutofillEnabled property behaves
75-
/// independently of the IsGeneralAutofillEnabled property. When
76-
/// IsPasswordAutofillEnabled is false, password information is auto-populated,
77-
/// suggestions are shown and clicking on one will populate the fields,
78-
/// but no new data is saved and no Save/Update Password prompts are displayed.
79-
/// When IsPasswordAutofillEnabled is true, password information is auto-populated,
89+
/// IsPasswordAutosaveEnabled controls whether autosave for password
90+
/// information is enabled. The IsPasswordAutosaveEnabled property behaves
91+
/// independently of the IsGeneralAutofillEnabled property. When IsPasswordAutosaveEnabled is
92+
/// false, no new password data is saved and no Save/Update Password prompts are displayed.
93+
/// However, if there was password data already saved before disabling this setting,
94+
/// then that password information is auto-populated, suggestions are shown and clicking on
95+
/// one will populate the fields.
96+
/// When IsPasswordAutosaveEnabled is true, password information is auto-populated,
8097
/// suggestions are shown and clicking on one will populate the fields, new data
8198
/// is saved, and a Save/Update Password prompt is displayed.
8299
/// The default value is `FALSE`.
83-
[propget] HRESULT IsPasswordAutofillEnabled([out, retval] BOOL* isPasswordAutofillEnabled);
84-
// Set the IsPasswordAutofillEnabled property.
85-
[propput] HRESULT IsPasswordAutofillEnabled([in] BOOL isPasswordAutofillEnabled);
100+
[propget] HRESULT IsPasswordAutosaveEnabled([out, retval] BOOL* isPasswordAutosaveEnabled);
101+
// Set the IsPasswordAutosaveEnabled property.
102+
[propput] HRESULT IsPasswordAutosaveEnabled([in] BOOL isPasswordAutosaveEnabled);
86103
87104
/// IsGeneralAutofillEnabled controls whether autofill for information
88-
/// like names, street and email addresses, phone numbers, and aribtrary input
89-
/// is enabled. This excludes password information. When IsGeneralAutofillEnabled
90-
/// is false, no suggestions appear, and no new information is saved.
91-
/// When IsGeneralAutofillEnabled is true, information is saved, suggestions appear
92-
/// and clicking on one will populate the form fields.
105+
/// like names, street and email addresses, phone numbers, and arbitrary input
106+
/// is enabled. This excludes password and credit card information. When
107+
/// IsGeneralAutofillEnabled is false, no suggestions appear, and no new information
108+
/// is saved. When IsGeneralAutofillEnabled is true, information is saved, suggestions
109+
/// appear and clicking on one will populate the form fields.
93110
/// The default value is `TRUE`.
94111
[propget] HRESULT IsGeneralAutofillEnabled([out, retval] BOOL* isGeneralAutofillEnabled);
95112
/// Set the IsGeneralAutofillEnabled property.
96113
[propput] HRESULT IsGeneralAutofillEnabled([in] BOOL isGeneralAutofillEnabled);
97114
}
98115
```
116+
99117
## .NET and WinRT
100118
```c#
101119
namespace Microsoft.Web.WebView2.Core

0 commit comments

Comments
 (0)