Skip to content

Commit cc435c7

Browse files
author
Maura Winstanley
committed
update settings query
1 parent 903a69a commit cc435c7

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

specs/Autofill.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Autofill has three components
1010
* Auto-populate - Populate the corresponding form fields automatically on page load.
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.
13+
1314
The general autofill setting and password autofill setting behave independently. Their behavior differs as well.
1415
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.
1516
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.
@@ -20,19 +21,21 @@ When the general autofill setting is disabled, no suggestions appear, and no new
2021
## Win32 C++
2122
```cpp
2223
void SettingsComponent::TogglePasswordAutofill() {
23-
wil::com_ptr<ICoreWebView2Settings4> settings;
24+
wil::com_ptr<ICoreWebView2Settings> settings;
2425
webView->get_Settings(&settings);
26+
wil::com_ptr<ICoreWebView2Settings4> settings4 = settings.try_query<ICoreWebView2Settings4>();
2527
bool enabled;
26-
settings->get_IsPasswordAutofillEnabled(&enabled);
27-
settings->put_IsPasswordAutofillEnabled(!enabled);
28+
settings4->get_IsPasswordAutofillEnabled(&enabled);
29+
settings4->put_IsPasswordAutofillEnabled(!enabled);
2830
}
2931

3032
void SettingsComponent::ToggleGeneralAutofill() {
31-
wil::com_ptr<ICoreWebView2Settings4> settings;
33+
wil::com_ptr<ICoreWebView2Settings> settings;
3234
webView->get_Settings(&settings);
35+
wil::com_ptr<ICoreWebView2Settings4> settings4 = settings.try_query<ICoreWebView2Settings4>();
3336
bool enabled;
34-
settings->get_IsGeneralAutofillEnabled(&enabled);
35-
settings->put_IsGeneralAutofillEnabled(!enabled);
37+
settings4->get_IsGeneralAutofillEnabled(&enabled);
38+
settings4->put_IsGeneralAutofillEnabled(!enabled);
3639
}
3740
```
3841

0 commit comments

Comments
 (0)