Skip to content

Commit 2ea7702

Browse files
author
Maura Winstanley
committed
change handler result
1 parent 2a5abeb commit 2ea7702

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

specs/ClearBrowsingData.md

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ HRESULT ClearBrowsingDataInTimeRange(
2020
[in] double endTime,
2121
[in] ICoreWebView2ClearBrowsingDataCompletedHandler* handler);
2222
```
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.
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. 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

@@ -53,9 +53,9 @@ void ClearAutofillData()
5353
CHECK_FAILURE(profile->ClearBrowsingDataInTimeRange(
5454
dataKinds, startTime, endTime,
5555
Callback<ICoreWebView2StagingClearBrowsingDataCompletedHandler>(
56-
[this](HRESULT error, bool isSuccessful)
56+
[this](HRESULT error)
5757
-> HRESULT {
58-
LPCWSTR result = isSuccessful ? L"Succeeded" : L"Failed";
58+
LPCWSTR result = error == S_OK ? L"Succeeded" : L"Failed";
5959
RunAsync([this, result]() {
6060
MessageBox(nullptr, result, L"Clear Browsing Data", MB_OK);
6161
});
@@ -79,11 +79,8 @@ private void ClearAutofillData()
7979
// Get the current time which is the time in which the browsing data will be cleared until.
8080
double startTime = endTime - 3600;
8181
// Offset the current time by 3600 seconds to clear the browsing data from the last hour.
82-
CoreWebView2BrowsingDataKinds dataKinds = (CoreWebView2BrowsingDataKinds)(CoreWebView2BrowsingDataKinds.GeneralAutofill | CoreWebView2BrowsingDataKinds.PasswordAutosave);
83-
bool isSuccessful = await profile.ClearBrowsingDataAsync(dataKinds, startTime, endTime);
84-
MessageBox.Show(this,
85-
(isSuccessful) ? "Succeeded" : "Failed",
86-
"Clear Browsing Data");
82+
CoreWebView2BrowsingDataKinds dataKinds = (CoreWebView2BrowsingDataKinds)(CoreWebView2BrowsingDataKinds.GeneralAutofill | CoreWebView2BrowsingDataKinds.PasswordAutosave);
83+
await profile.ClearBrowsingDataAsync(dataKinds, startTime, endTime);
8784
}
8885
}
8986

@@ -233,14 +230,8 @@ interface ICoreWebView2Profile : IUnknown {
233230
/// The caller implements this interface to receive the `ClearBrowsingData` result.
234231
[uuid(27676699-FE17-4E2B-8C1B-267395A04ED5), object, pointer_default(unique)]
235232
interface ICoreWebView2ClearBrowsingDataCompletedHandler : IUnknown {
236-
/// Provide the completion status and result of the corresponding
237-
/// asynchronous method. The result indicates if the `ClearBrowsingData`
238-
/// call has completed successfully and all intended data has been cleared.
239-
/// If the call has been interrupted and does not clear all the intended data,
240-
/// the `errorCode` is `S_OK` and `isSuccessful` will be `false`.
241-
HRESULT Invoke(
242-
[in] HRESULT errorCode,
243-
[in] BOOL isSuccessful);
233+
/// Provide the completion status of the corresponding asynchronous method.
234+
HRESULT Invoke([in] HRESULT errorCode);
244235
}
245236
246237
```

0 commit comments

Comments
 (0)