Skip to content

Commit ac62e8a

Browse files
author
Maura Winstanley
committed
typos
1 parent 69a5126 commit ac62e8a

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

specs/ClearBrowsingData.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ HRESULT ClearBrowsingDataInTimeRange(
2020
[in] double endTime,
2121
[in] ICoreWebView2ClearBrowsingDataCompletedHandler* handler);
2222
```
23-
The first method takes a uint64 parameter that consists of one or more COREWEBVIEW2_BROWSING_DATA_KIND passed in as well as a handler which will indicate if the proper data has been cleared successfully. The handler will respond with one of three results, which indicate that the method was successful, interrupted, or failed. This method clears the data for all time.
23+
The first method takes a uint64 parameter that consists of one or more COREWEBVIEW2_BROWSING_DATA_KIND passed in as well as a handler which will indicate if the proper data has been cleared successfully. The handler will respond with a `bool` indicating whether the option successfully cleared the intended data fully. This method clears the data for all time.
2424

25-
The second method takes the same parameters for the dataKinds and handler, as well as a start and end time in which the API should clear the corresponding data between. The double time parameters correspond to how many seconds since the UNIX epoch.
25+
The second method takes the same parameters for the dataKinds and handler, as well as a start and end time in which the API should clear the corresponding data between. The time parameters correspond to how many seconds have passed since the UNIX epoch.
2626

2727
Both methods clear the data with the associated profile in which the method is called on.
2828

@@ -59,6 +59,8 @@ bool EnvironmentComponent::ClearAutofillData()
5959
CHECK_FAILURE(webview7->get_Profile(&profile));
6060
double end_time = (double)std::time(nullptr);
6161
double start_time = end_time - 3600;
62+
COREWEBVIEW2_BROWSING_DATA_KIND data_kinds = COREWEBVIEW2_BROWSING_DATA_KIND_GENERAL_AUTOFILL |
63+
COREWEBVIEW2_BROWSING_DATA_KIND_PASSWORD_AUTOSAVE;
6264
CHECK_FAILURE(profile->ClearBrowsingDataInTimeRange(
6365
data_kinds, start_time, end_time,
6466
Callback<ICoreWebView2StagingClearBrowsingDataCompletedHandler>(
@@ -81,14 +83,17 @@ bool EnvironmentComponent::ClearAutofillData()
8183
private void ClearAutofillData()
8284
{
8385
CoreWebView2Profile profile;
84-
profile = webView.CoreWebView2.Profile;
85-
double endTime = DateTimeOffset.Now.ToUnixTimeSeconds();
86-
double startTime = endTime - 3600;
87-
bool isSuccessful = await WebViewProfile.ClearBrowsingDataAsync((UInt64)dataKind, startTime, endTime);
88-
MessageBox.Show(this,
89-
(isSuccessful) ? "Succeeded" : "Failed",
90-
"Clear Browsing Data");
91-
86+
if (webView.CoreWebView2 != null)
87+
{
88+
profile = webView.CoreWebView2.Profile;
89+
double endTime = DateTimeOffset.Now.ToUnixTimeSeconds();
90+
double startTime = endTime - 3600;
91+
CoreWebView2BrowsingDataKind dataKinds = CoreWebView2BrowsingDataKind.GeneralAutofill | CoreWebView2BrowsingDataKind.PasswordAutosave;
92+
bool isSuccessful = await WebViewProfile.ClearBrowsingDataAsync((UInt64)dataKinds, startTime, endTime);
93+
MessageBox.Show(this,
94+
(isSuccessful) ? "Succeeded" : "Failed",
95+
"Clear Browsing Data");
96+
}
9297
}
9398

9499
```
@@ -102,7 +107,6 @@ See [API Details](#api-details) section below for API reference.
102107
## Win32 C++
103108

104109
```IDL
105-
interface ICoreWebView2Profile
106110
interface ICoreWebView2ClearBrowsingDataCompletedHandler;
107111
108112
/// Specifies the datatype for the
@@ -275,8 +279,9 @@ namespace Microsoft.Web.WebView2.Core
275279
public partial class CoreWebView2Environment
276280
{
277281
/// The ClearBrowsingDataAsync method may be overloaded to take either one parameter - dataKinds, or three parameters - dataKinds, startTime, and endTime.
282+
/// NOTE TO REVIEWERS:
278283
/// We're taking ulong here because we need to accept orred enum values like HttpCache | DownloadHistory which isn't a value in the DataKind enum.
279-
/// We need to take ulong to get the proper masked thru, s it OK to take the enum as the parameter type here in COM, WinRT, and .NET?
284+
/// We need to take ulong to get the proper masked thru, is it OK to take the enum as the parameter type here in COM, WinRT, and .NET?
280285
public async Task<CoreWebView2ClearBrowsingDataResultKind> ClearBrowsingDataAsync(ulong dataKinds);
281286
public async Task<CoreWebView2ClearBrowsingDataResultKind> ClearBrowsingDataAsync(ulong dataKinds, double startTime, double endTime);
282287
}

0 commit comments

Comments
 (0)