Skip to content

Commit 39e4881

Browse files
committed
Add documentation for <native-messaging> capability
1 parent 24a96ae commit 39e4881

3 files changed

Lines changed: 102 additions & 0 deletions

File tree

docs/specifications/app-list.xsd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
<xsd:element name="desktop-icon" type="apps:desktop-icon" />
6969
<xsd:element name="quick-launch" type="apps:quick-launch" />
7070
<xsd:element name="url-protocol" type="apps:url-protocol" />
71+
<xsd:element name="native-messaging" type="apps:native-messaging" />
7172
<xsd:element name="auto-play" type="apps:auto-play" />
7273
<xsd:element name="context-menu" type="apps:context-menu" />
7374
<xsd:element name="default-program" type="apps:default-program" />
@@ -145,6 +146,14 @@
145146
<xsd:extension base="apps:default-access-point" />
146147
</xsd:complexContent>
147148
</xsd:complexType>
149+
<xsd:complexType name="native-messaging">
150+
<xsd:annotation>
151+
<xsd:documentation>Makes an application a browser native messaging host.</xsd:documentation>
152+
</xsd:annotation>
153+
<xsd:complexContent>
154+
<xsd:extension base="apps:default-access-point" />
155+
</xsd:complexContent>
156+
</xsd:complexType>
148157
<xsd:complexType name="command-access-point" abstract="true">
149158
<xsd:annotation>
150159
<xsd:documentation>Adds a way to explicitly launch the application to the desktop environment.</xsd:documentation>

docs/specifications/capabilities.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,36 @@ See: [Verbs](#verbs), [Icons](#icons)
114114
- a single `<verb>`: creates a simple context menu, named using the `<description>` inside `<verb>`
115115
- multiple `<verb>`s (since version 2.18): creates a cascading context menu, named using the `<description>` inside `<context-menu>`, with sub-entries named using the `<description>` inside `<verb>`
116116

117+
### Browser native messaging
118+
119+
An application's ability to act as a browser native messaging host.
120+
121+
```xml
122+
<native-messaging id='...' browser='...' name='...' command='...' ? explicit-only='true' ?>
123+
<browser-extension id='...'/> *
124+
</native-messaging>
125+
```
126+
127+
`id`
128+
: An ID that uniquely identifies this native messaging entry within the feed. Must be a [safe ID](#safe-id).
129+
130+
`browser`
131+
: The browser the native messaging host can be registered in.
132+
Supported values are: `Chrome`, `Chromium`, `Edge`, `Firefox`, `Opera`, `Brave`, `Vivaldi`
133+
134+
`name`
135+
: The name used to call the native messaging host from browser extensions.
136+
Can only contain lowercase alphanumeric characters, underscores (`_`) and dots (`.`). Can't start or end with a dot, and a dot can't be followed by another dot.
137+
138+
`command`
139+
: The name of the command in the feed to use. Defaults to `run` if not set.
140+
141+
`explicit-only`
142+
: When set to `true` this context menu entry is not added without explicit confirmation from the user.
143+
144+
`<browser-extension>`
145+
: Browser extension that should have access to the native messaging host.
146+
117147
### AutoPlay handlers
118148

119149
An application's ability to handle AutoPlay events.

docs/specifications/capabilities.xsd

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<xs:element name="file-type" type="caps:file-type" />
2222
<xs:element name="url-protocol" type="caps:url-protocol" />
2323
<xs:element name="context-menu" type="caps:context-menu" />
24+
<xs:element name="native-messaging" type="caps:native-messaging" />
2425
<xs:element name="auto-play" type="caps:auto-play" />
2526
<xs:element name="com-server" type="caps:com-server" />
2627
<xs:element name="registration" type="caps:registration" />
@@ -308,6 +309,68 @@
308309
</xs:restriction>
309310
</xs:simpleType>
310311

312+
<xs:complexType name="native-messaging">
313+
<xs:annotation>
314+
<xs:documentation>
315+
An application's ability to act as a browser native messaging host.
316+
</xs:documentation>
317+
</xs:annotation>
318+
<xs:complexContent>
319+
<xs:extension base="caps:default-capability">
320+
<xs:attribute name="browser" type="caps:browser-enum" use="required">
321+
<xs:annotation>
322+
<xs:documentation>
323+
The browser the native messaging host can be registered in.
324+
</xs:documentation>
325+
</xs:annotation>
326+
</xs:attribute>
327+
<xs:attribute name="name" type="caps:native-messaging-name" use="required">
328+
<xs:annotation>
329+
<xs:documentation>
330+
The name used to call the native messaging host from browser extensions.
331+
</xs:documentation>
332+
</xs:annotation>
333+
</xs:attribute>
334+
<xs:attribute name="command" type="xs:string">
335+
<xs:annotation>
336+
<xs:documentation>
337+
The name of the command in the feed to use. Defaults to 'run' if not set.
338+
</xs:documentation>
339+
</xs:annotation>
340+
</xs:attribute>
341+
<xs:sequence>
342+
<xs:element name="browser-extension" minOccurs="1" maxOccurs="unbounded">
343+
<xs:complexType>
344+
<xs:attribute name="id" type="xs:string" use="required">
345+
<xs:annotation>
346+
<xs:documentation>
347+
Browser extension that should have access to the native messaging host.
348+
</xs:documentation>
349+
</xs:annotation>
350+
</xs:attribute>
351+
</xs:complexType>
352+
</xs:element>
353+
</xs:sequence>
354+
</xs:extension>
355+
</xs:complexContent>
356+
</xs:complexType>
357+
<xs:simpleType name="browser-enum">
358+
<xs:restriction base="xs:string">
359+
<xs:enumeration value="Chrome"/>
360+
<xs:enumeration value="Chromium"/>
361+
<xs:enumeration value="Edge"/>
362+
<xs:enumeration value="Firefox"/>
363+
<xs:enumeration value="Opera"/>
364+
<xs:enumeration value="Brave"/>
365+
<xs:enumeration value="Vivaldi"/>
366+
</xs:restriction>
367+
</xs:simpleType>
368+
<xs:simpleType name="native-messaging-name">
369+
<xs:restriction base="xs:string">
370+
<xs:pattern value="[a-z0-9._]+"/>
371+
</xs:restriction>
372+
</xs:simpleType>
373+
311374
<xs:complexType name="auto-play">
312375
<xs:annotation>
313376
<xs:documentation>

0 commit comments

Comments
 (0)