Skip to content

Commit 2a5abeb

Browse files
author
Maura Winstanley
committed
syntax fixes
1 parent c406830 commit 2a5abeb

1 file changed

Lines changed: 17 additions & 32 deletions

File tree

specs/ClearBrowsingData.md

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,28 @@ In this document we describe the updated API. We'd appreciate your feedback.
1111
We expose browsing data clearing in two asynchronous APIs:
1212
```IDL
1313
HRESULT ClearBrowsingData(
14-
[in] uint64 dataKinds,
14+
[in] COREWEBVIEW2_BROWSING_DATA_KINDS dataKinds,
1515
[in] ICoreWebView2ClearBrowsingDataCompletedHandler* handler);
1616
1717
HRESULT ClearBrowsingDataInTimeRange(
18-
[in] uint64 dataKinds,
18+
[in] COREWEBVIEW2_BROWSING_DATA_KINDS dataKinds,
1919
[in] double startTime,
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_KINDS 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.
23+
The first method takes `COREWEBVIEW2_BROWSING_DATA_KINDS` which corresponds to the data type(s) to clear 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 operation successfully cleared the intended data. This method clears the data for all time.
2424

2525
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

27-
Both methods clear the data with the associated profile in which the method is called on.
28-
29-
The browsing data kinds that are supported are listed below. These data kinds follow a hierarchical structure in which nested bullet points are included in their parent bullet point's data kind.
30-
Ex: DOM storage is included in site data which is included in the profile data. Each of the following bullets correspond to a COREWEBVIEW2_BROWSING_DATA_KINDS.
31-
32-
* Profile
33-
* Site Data
34-
* DOM Storage: App Cache, File Systems, Indexed DB, Local Storage, Web SQL, Cache Storage
35-
Storage
36-
* Cookies
37-
* HTTP Cache
38-
* Download History
39-
* General Autofill
40-
* Password Autosave
41-
* Browsing History
42-
* Settings
27+
Both methods clear the data for the associated profile in which the method is called on.
4328

4429
# Examples
4530

4631
## Win32 C++
4732
```cpp
4833

4934
/// Function to clear the autofill data from the last hour
50-
bool EnvironmentComponent::ClearAutofillData()
35+
void ClearAutofillData()
5136
{
5237
wwil::com_ptr<ICoreWebView2> coreWebView2;
5338
CHECK_FAILURE(m_controller->get_CoreWebView2(&coreWebView2));
@@ -62,7 +47,7 @@ bool EnvironmentComponent::ClearAutofillData()
6247
/// Get the current time and offset the current time by 3600 seconds to clear the data
6348
/// from the start time (one hour ago), until the end time (present time).
6449
/// This will clear the data for the last hour.
65-
COREWEBVIEW2_BROWSING_DATA_KINDS data_kindSs = (COREWEBVIEW2_BROWSING_DATA_KINDS)
50+
COREWEBVIEW2_BROWSING_DATA_KINDS dataKinds = (COREWEBVIEW2_BROWSING_DATA_KINDS)
6651
(COREWEBVIEW2_BROWSING_DATA_KINDS_GENERAL_AUTOFILL |
6752
COREWEBVIEW2_BROWSING_DATA_KINDS_PASSWORD_AUTOSAVE));
6853
CHECK_FAILURE(profile->ClearBrowsingDataInTimeRange(
@@ -94,8 +79,8 @@ private void ClearAutofillData()
9479
// Get the current time which is the time in which the browsing data will be cleared until.
9580
double startTime = endTime - 3600;
9681
// Offset the current time by 3600 seconds to clear the browsing data from the last hour.
97-
CoreWebView2BrowsingDataKind dataKinds = CoreWebView2BrowsingDataKind.GeneralAutofill | CoreWebView2BrowsingDataKind.PasswordAutosave;
98-
bool isSuccessful = await WebViewProfile.ClearBrowsingDataAsync((UInt64)dataKinds, startTime, endTime);
82+
CoreWebView2BrowsingDataKinds dataKinds = (CoreWebView2BrowsingDataKinds)(CoreWebView2BrowsingDataKinds.GeneralAutofill | CoreWebView2BrowsingDataKinds.PasswordAutosave);
83+
bool isSuccessful = await profile.ClearBrowsingDataAsync(dataKinds, startTime, endTime);
9984
MessageBox.Show(this,
10085
(isSuccessful) ? "Succeeded" : "Failed",
10186
"Clear Browsing Data");
@@ -205,9 +190,9 @@ typedef enum COREWEBVIEW2_BROWSING_DATA_KINDS {
205190
interface ICoreWebView2Profile : IUnknown {
206191
207192
/// Clear browsing data based on a data type. This method takes two parameters,
208-
/// the first being a mask of one or more `COREWEBVIEW2_BROWSING_DATAKINDS`. OR operation(s)
193+
/// the first being a mask of one or more `COREWEBVIEW2_BROWSING_DATA_KINDS`. OR operation(s)
209194
/// can be applied to multiple `COREWEBVIEW2_BROWSING_DATA_KINDS` to create a mask
210-
/// representing multiple data types. The browsing data kinds that are supported
195+
/// representing those data types. The browsing data kinds that are supported
211196
/// are listed below. These data kinds follow a hierarchical structure in which
212197
/// nested bullet points are included in their parent bullet point's data kind.
213198
/// Ex: DOM storage is encompassed in site data which is encompassed in the profile data.
@@ -229,27 +214,27 @@ interface ICoreWebView2Profile : IUnknown {
229214
/// the clear browsing data operation may or may not be completed.
230215
/// ClearBrowsingData clears the `dataKinds` for all time.
231216
HRESULT ClearBrowsingData(
232-
[in] UINT64 dataKinds,
217+
[in] COREWEBVIEW2_BROWSING_DATA_KINDS dataKinds,
233218
[in] ICoreWebView2ClearBrowsingDataCompletedHandler* handler);
234219
235220
/// ClearBrowsingDataInTimeRange behaves like ClearBrowsingData except that it
236221
/// takes in two additional parameters for the start and end time for which it
237-
/// should clear the data between. The startTime and endTime
222+
/// should clear the data between. The `startTime` and `endTime`
238223
/// parameters correspond to the number of seconds since the UNIX epoch.
239224
///
240225
/// \snippet AppWindow.cpp ClearBrowsingData
241226
HRESULT ClearBrowsingDataInTimeRange(
242-
[in] UINT64 dataKinds,
227+
[in] COREWEBVIEW2_BROWSING_DATA_KINDS dataKinds,
243228
[in] double startTime,
244229
[in] double endTime,
245230
[in] ICoreWebView2ClearBrowsingDataCompletedHandler* handler);
246231
}
247232
248-
/// The caller implements this interface to receive the ClearBrowsingData result.
233+
/// The caller implements this interface to receive the `ClearBrowsingData` result.
249234
[uuid(27676699-FE17-4E2B-8C1B-267395A04ED5), object, pointer_default(unique)]
250235
interface ICoreWebView2ClearBrowsingDataCompletedHandler : IUnknown {
251236
/// Provide the completion status and result of the corresponding
252-
/// asynchronous method. The result indicates if the ClearBrowsingData
237+
/// asynchronous method. The result indicates if the `ClearBrowsingData`
253238
/// call has completed successfully and all intended data has been cleared.
254239
/// If the call has been interrupted and does not clear all the intended data,
255240
/// the `errorCode` is `S_OK` and `isSuccessful` will be `false`.
@@ -285,8 +270,8 @@ namespace Microsoft.Web.WebView2.Core
285270

286271
public partial class CoreWebView2Profile
287272
{
288-
public async Task<CoreWebView2ClearBrowsingDataResultKind> ClearBrowsingDataAsync(CoreWebView2BrowsingDataKinds dataKinds);
289-
public async Task<CoreWebView2ClearBrowsingDataResultKind> ClearBrowsingDataAsync(CoreWebView2BrowsingDataKinds dataKinds, double startTime, double endTime);
273+
public async Task<bool> ClearBrowsingDataAsync(CoreWebView2BrowsingDataKinds dataKinds);
274+
public async Task<bool> ClearBrowsingDataAsync(CoreWebView2BrowsingDataKinds dataKinds, double startTime, double endTime);
290275
}
291276
}
292277
```

0 commit comments

Comments
 (0)