OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 module blink.mojom; | 5 module blink.mojom; |
6 | 6 |
7 import "third_party/WebKit/public/platform/modules/permissions/permission_status
.mojom"; | 7 import "third_party/WebKit/public/platform/modules/permissions/permission_status
.mojom"; |
8 import "url/mojo/origin.mojom"; | 8 import "url/mojo/origin.mojom"; |
9 | 9 |
10 enum PermissionName { | 10 enum PermissionName { |
11 GEOLOCATION, | 11 GEOLOCATION, |
12 NOTIFICATIONS, | 12 NOTIFICATIONS, |
13 PUSH_NOTIFICATIONS, | 13 PUSH_NOTIFICATIONS, |
14 MIDI, | 14 MIDI, |
15 MIDI_SYSEX, | |
16 PROTECTED_MEDIA_IDENTIFIER, | 15 PROTECTED_MEDIA_IDENTIFIER, |
17 DURABLE_STORAGE, | 16 DURABLE_STORAGE, |
18 AUDIO_CAPTURE, | 17 AUDIO_CAPTURE, |
19 VIDEO_CAPTURE, | 18 VIDEO_CAPTURE, |
20 BACKGROUND_SYNC, | 19 BACKGROUND_SYNC, |
21 }; | 20 }; |
22 | 21 |
| 22 struct MidiPermissionDescriptor { |
| 23 bool sysex; |
| 24 }; |
| 25 |
| 26 // Union of possible extensions to the base PermissionDescriptor type. |
| 27 union PermissionDescriptorExtension { |
| 28 MidiPermissionDescriptor midi; |
| 29 }; |
| 30 |
| 31 // This struct roughly corresponds to the PermissionDescriptor dictionary as |
| 32 // defined by the Permissions API. |
| 33 struct PermissionDescriptor { |
| 34 PermissionName name; |
| 35 PermissionDescriptorExtension? extension; |
| 36 }; |
| 37 |
23 // The Permission service provides permission handling capabilities by exposing | 38 // The Permission service provides permission handling capabilities by exposing |
24 // methods to check, request, and revoke permissions. It also allows a client to | 39 // methods to check, request, and revoke permissions. It also allows a client to |
25 // start listening to permission changes. | 40 // start listening to permission changes. |
26 interface PermissionService { | 41 interface PermissionService { |
27 HasPermission(PermissionName permission, url.mojom.Origin origin) | 42 HasPermission(PermissionDescriptor permission, url.mojom.Origin origin) |
28 => (PermissionStatus status); | 43 => (PermissionStatus status); |
29 RequestPermission(PermissionName permission, url.mojom.Origin origin, | 44 RequestPermission(PermissionDescriptor permission, url.mojom.Origin origin, |
30 bool user_gesture) | 45 bool user_gesture) |
31 => (PermissionStatus status); | 46 => (PermissionStatus status); |
32 RequestPermissions(array<PermissionName> permission, url.mojom.Origin origin, | 47 RequestPermissions(array<PermissionDescriptor> permission, url.mojom.Origin or
igin, |
33 bool user_gesture) | 48 bool user_gesture) |
34 => (array<PermissionStatus> statuses); | 49 => (array<PermissionStatus> statuses); |
35 RevokePermission(PermissionName permission, url.mojom.Origin origin) | 50 RevokePermission(PermissionDescriptor permission, url.mojom.Origin origin) |
36 => (PermissionStatus status); | 51 => (PermissionStatus status); |
37 | 52 |
38 // Runs the callback next time there is a permission status change for the | 53 // Runs the callback next time there is a permission status change for the |
39 // given { permission, origin }. Callers of this method will have to call it | 54 // given { permission, origin }. Callers of this method will have to call it |
40 // again if they want to keep listening to the changes. To prevent race | 55 // again if they want to keep listening to the changes. To prevent race |
41 // conditions, the caller must pass the last known value. | 56 // conditions, the caller must pass the last known value. |
42 GetNextPermissionChange(PermissionName permission, | 57 GetNextPermissionChange(PermissionDescriptor permission, |
43 url.mojom.Origin origin, | 58 url.mojom.Origin origin, |
44 PermissionStatus last_known_status) | 59 PermissionStatus last_known_status) |
45 => (PermissionStatus status); | 60 => (PermissionStatus status); |
46 }; | 61 }; |
OLD | NEW |