Skip to content

Commit 70c0ac9

Browse files
Tochibeeoldnewthing
andcommitted
Update specs/StatusBarMessage.md
Co-authored-by: Raymond Chen <oldnewthing@users.noreply.github.com>
1 parent 0584cad commit 70c0ac9

1 file changed

Lines changed: 37 additions & 27 deletions

File tree

specs/StatusBarMessage.md

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,27 @@ The browser has a Status bar that displays text when hovering over a link, or pe
99
developers are able to opt in to disable showing the status bar through the browser
1010
settings.
1111

12-
Developers would also like to be able to opt in to intercept the messages which would
13-
normally be displayed by the Status bar, and show it using thier own custom UI.
12+
Developers would also like to be able to opt in to intercept the text which would
13+
normally be displayed by the Status bar, and show it using their own custom UI.
1414
# Description
1515
We propose a new event for WebView2 that would allow developers to
1616
listen for Status bar updates which are triggered by activity on the WebView, and then handle those updates however they want in their applications.
1717

18-
Developers will be able to register an event handler for changes to the status bar message.
18+
Developers will be able to register an event handler for changes to the status bar text.
1919
# Examples
20-
## Win32 C++ Registering a listener for status bar message changes
20+
## Win32 C++ Registering a listener for status bar text changes
2121
```
22-
CHECK_FAILURE(m_webView->add_StatusBarMessageChanged(
23-
Microsoft::WRL::Callback<ICoreWebView2StatusBarMessageChangedEventHandler>(
24-
[this](ICoreWebView2* sender, IUnknown* args) -> HRESULT
22+
CHECK_FAILURE(m_webView->add_StatusBarTextChanged(
23+
Microsoft::WRL::Callback<ICoreWebView2StatusBarTextChangedEventHandler>(
24+
[this](ICoreWebView2* sender, ICoreWebView2StatusBarTextChangedEventArgs* args) -> HRESULT
2525
{
26+
27+
Microsoft::WRL::ComPtr<ICoreWebView2_5> webview5;
28+
CHECK_FAILURE(sender->QueryInterface(IID_PPV_ARGS(&webview5)));
29+
30+
wil::unique_cotaskmem_string value;
31+
CHECK_FAILURE(webview5->get_StatusBarText(&value));
2632
27-
LPWSTR value;
28-
CHECK_FAILURE(sender->get_StatusBarMessage(&value));
2933
if (wcslen(value) != 0)
3034
{
3135
@@ -38,13 +42,13 @@ CHECK_FAILURE(m_webView->add_StatusBarMessageChanged(
3842
return S_OK;
3943
}
4044
).Get(),
41-
&m_statusBarMessageChangedToken));
45+
&m_statusBarTextChangedToken));
4246
```
43-
## .NET / WinRT Registering a listener for status bar message changes
47+
## .NET / WinRT Registering a listener for status bar text changes
4448
```
45-
webView.CoreWebView2.StatusBarMessageChanged += (CoreWebView2 sender, Object arg) =>
49+
webView.CoreWebView2.StatusBarTextChanged += (CoreWebView2 sender, Object arg) =>
4650
{
47-
string value = sender.statusBarMessage;
51+
string value = sender.StatusBarText;
4852
// Handle status bar text in value
4953
if (value.Length != 0) {
5054
statusBar.show(value);
@@ -59,41 +63,47 @@ See [API Details](#api-details) Section below for API reference
5963
# API Details
6064
## Win32 C++
6165
```
62-
/// Interface for the status bar message changed event handler
66+
/// Interface for the status bar text changed event handler
6367
[uuid(85c8b75a-ceac-11eb-b8bc-0242ac130003), object, pointer_default(unique)]
64-
interface ICoreWebView2StatusBarMessageChangedEventHandler : IUnknown {
68+
interface ICoreWebView2StatusBarTextChangedEventHandler : IUnknown {
6569
/// Called to provide the implementer with the event args for the
6670
/// corresponding event.
6771
HRESULT Invoke(
6872
[in] ICoreWebView2* sender,
69-
[in] IUnknown* args);
73+
[in] ICoreWebView2StatusBarTextChangedEventArgs* args);
74+
}
75+
76+
/// Interface for status bar text change event args
77+
[uuid(2B9CAB1C-BE29-4FC8-BFDD-20AF170ACA7F), object, pointer_default(unique)]
78+
interface ICoreWebView2StatusBarTextChangedEventArgs : IUnknown {
79+
7080
}
7181
7282
[uuid(b2c01782-ceaf-11eb-b8bc-0242ac130003), object, pointer_default(unique)]
7383
interface ICoreWebView2_5 : ICoreWebView2_4 {
74-
/// Add an event handler for the `StatusBarMessageChanged` event.
75-
/// `StatusBarMessageChanged` runs when the WebView statusbar content changes
84+
/// Add an event handler for the `StatusBarTextChanged` event.
85+
/// `StatusBarTextChanged` runs when the WebView statusbar content changes
7686
/// status bar
77-
HRESULT add_StatusBarMessageChanged(
78-
[in] ICoreWebView2StatusBarMessageChangedEventHandler* eventHandler,
87+
HRESULT add_StatusBarTextChanged(
88+
[in] ICoreWebView2StatusBarTextChangedEventHandler* eventHandler,
7989
[out] EventRegistrationToken* token);
8090
81-
/// Removing the event handler for `StatusBarMessageChanged` event
82-
HRESULT remove_StatusBarMessageChanged(
91+
/// Removing the event handler for `StatusBarTextChanged` event
92+
HRESULT remove_StatusBarTextChanged(
8393
[in] EventRegistrationToken token);
8494
85-
/// used to access the current value of the status bar message
86-
[propget] HRESULT StatusBarMessage([out, retval] LPWSTR* value);
95+
/// used to access the current value of the status bar text
96+
[propget] HRESULT StatusBarText([out, retval] LPWSTR* value);
8797
}
8898
```
8999
## .Net/ WinRT
90100
```
91101
namespace Microsoft.Web.WebView2.Core {
92102
93-
/// Interface for the status bar message changed event handler
103+
/// Interface for the status bar text changed event handler
94104
runtimeclass CoreWebView2 {
95-
event Windows.Foundation.TypedEventHandler<CoreWebView2, Object> StatusBarMessageChanged;
96-
string StatusBarMessage {get;};
105+
event Windows.Foundation.TypedEventHandler<CoreWebView2, CoreWebView2StatusBarTextChangedEventArgs> StatusBarTextChanged;
106+
string StatusBarText {get;};
97107
}
98108
}
99109
```

0 commit comments

Comments
 (0)