Skip to content

Commit f70c3bc

Browse files
committed
changed api name and removed extra methods
1 parent 1deeffe commit f70c3bc

2 files changed

Lines changed: 112 additions & 155 deletions

File tree

specs/StatusBarActivity.md

Lines changed: 0 additions & 155 deletions
This file was deleted.

specs/StatusBarMessage.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<!-- USAGE
2+
* Fill in each of the sections (like Background) below
3+
* Wrap code with `single line of code` or ```code block```
4+
* Before submitting, delete all <!-- TEMPLATE marked comments in this file,
5+
and the following quote banner:
6+
-->
7+
# Background
8+
The browser has a Status bar that displays text when hovering over a link, or performing some activity. Currently,
9+
developers are able to opt in to disable showing the status bar through the browser
10+
settings.
11+
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.
14+
# Description
15+
We propose two new events for WebView2 that would allow developers to
16+
listen for Status bar updates which are triggered by activity on the WebView, and then handle those updates however they want in their applications.
17+
18+
Developers will be able to register an even handler for changes to the status bar message.
19+
# Examples
20+
## Win32 C++ Registering a listener for status bar showing
21+
```
22+
CHECK_FAILURE(m_webView->add_StatusBarMessageChanged(
23+
Microsoft::WRL::Callback<ICoreWebView2StatusBarMessageChangedStagingEventHandler>(
24+
[this](ICoreWebView2* sender, ICoreWebView2StatusBarMessageChangedStagingEventArgs* args) -> HRESULT {
25+
LPWSTR value;
26+
CHECK_FAILURE(args->get_Message(&value));
27+
28+
if (value[0] != 0) {
29+
m_statusBar.show(value);
30+
} else {
31+
m_statusBar.hide();
32+
}
33+
34+
return S_OK;
35+
}
36+
).Get(),
37+
&m_statusBarMessageChangedToken));
38+
```
39+
## .NET / WinRT Registering a listener for status bar showing
40+
```
41+
webView.CoreWebView2.StatusBarMessageChanged += (object sender, CoreWebView2StatusBarMessageChangedEventArgs arg) =>
42+
{
43+
string value = args.value;
44+
/// Handle status bar text in value
45+
if(value != "") {
46+
statusBar.show(value);
47+
} else {
48+
statusBar.hide();
49+
}
50+
51+
};
52+
```
53+
# API Notes
54+
See [API Details](#api-details) Section below for API reference
55+
# API Details
56+
## Win32 C++
57+
```
58+
/// Interface for the statusbar showing event args
59+
/// The value property contains the status bar text
60+
[uuid(56acdbb8-ceac-11eb-b8bc-0242ac130003), object, pointer_default(unique)]
61+
interface ICoreWebView2StatusBarMessageChangedEventArgs : IUnknown {
62+
[propget] HRESULT Value([out, retval] LPWSTR* value);
63+
}
64+
65+
/// Interface for the status bar showing event handler
66+
[uuid(85c8b75a-ceac-11eb-b8bc-0242ac130003), object, pointer_default(unique)]
67+
interface ICoreWebView2StatusBarMessageChangedEventHandler : IUnknown {
68+
/// Called to provide the implementer with the event args for the
69+
/// corresponding event.
70+
HRESULT Invoke(
71+
[in] ICoreWebView2* sender,
72+
[in] ICoreWebView2StatusBarMessageChangedEventArgs* args);
73+
}
74+
75+
[uuid(b2c01782-ceaf-11eb-b8bc-0242ac130003), object, pointer_default(unique)]
76+
interface ICoreWebView2_5 : ICoreWebView2_4 {
77+
/// Add an event handler for the `StatusBarMessageChanged` event.
78+
/// `StatusBarMessageChanged` runs when the WebView statusbar content changes
79+
/// status bar
80+
HRESULT add_StatusBarMessageChanged(
81+
[in] ICoreWebView2StatusBarMessageChangedEventHandler* eventHandler,
82+
[out] EventRegistrationToken* token);
83+
84+
/// Removing the event handler for `StatusBarMessageChanged` event
85+
HRESULT remove_StatusBarMessageChanged(
86+
[in] EventRegistrationToken token);
87+
88+
}
89+
```
90+
## .Net/ WinRT
91+
```
92+
namespace Microsoft.Web.WebView2.Core {
93+
94+
/// Interface for the statusbar showing event args
95+
/// The value property contains the status bar text
96+
runtimeclass CoreWebView2StatusBarMessageChangedEventArgs {
97+
string value {get;};
98+
}
99+
100+
/// Interface for the status bar showing event handler
101+
runtimeclass CoreWebView2 {
102+
event Windows.Foundation.TypedEventHandler<CoreWebView2, CoreWebView2StatusBarMessageChangedEventArgs> StatusBarMessageChanged;
103+
}
104+
}
105+
```
106+
# Appendix
107+
<!-- TEMPLATE
108+
Anything else that you want to write down for posterity, but
109+
that isn't necessary to understand the purpose and usage of the API.
110+
For example, implementation details or links to other resources.
111+
-->
112+
See here for more details about the Status bar: <a href="https://www.computerhope.com/jargon/s/statusbar.htm">Here</a>

0 commit comments

Comments
 (0)