Chromium Code Reviews| 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 { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 MidiPermissionDescriptor midi; | 28 MidiPermissionDescriptor midi; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 // This struct roughly corresponds to the PermissionDescriptor dictionary as | 31 // This struct roughly corresponds to the PermissionDescriptor dictionary as |
| 32 // defined by the Permissions API. | 32 // defined by the Permissions API. |
| 33 struct PermissionDescriptor { | 33 struct PermissionDescriptor { |
| 34 PermissionName name; | 34 PermissionName name; |
| 35 PermissionDescriptorExtension? extension; | 35 PermissionDescriptorExtension? extension; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 // Interface a client can implement to observe permission changes. | |
| 39 interface PermissionObserver { | |
| 40 OnPermissionStatusChange(PermissionStatus status); | |
| 41 }; | |
| 42 | |
| 38 // The Permission service provides permission handling capabilities by exposing | 43 // The Permission service provides permission handling capabilities by exposing |
| 39 // methods to check, request, and revoke permissions. It also allows a client to | 44 // methods to check, request, and revoke permissions. It also allows a client to |
| 40 // start listening to permission changes. | 45 // start listening to permission changes. |
| 41 interface PermissionService { | 46 interface PermissionService { |
| 42 HasPermission(PermissionDescriptor permission, url.mojom.Origin origin) | 47 HasPermission(PermissionDescriptor permission, url.mojom.Origin origin) |
| 43 => (PermissionStatus status); | 48 => (PermissionStatus status); |
| 44 RequestPermission(PermissionDescriptor permission, url.mojom.Origin origin, | 49 RequestPermission(PermissionDescriptor permission, url.mojom.Origin origin, |
| 45 bool user_gesture) | 50 bool user_gesture) |
| 46 => (PermissionStatus status); | 51 => (PermissionStatus status); |
| 47 RequestPermissions(array<PermissionDescriptor> permission, url.mojom.Origin or igin, | 52 RequestPermissions(array<PermissionDescriptor> permission, url.mojom.Origin or igin, |
| 48 bool user_gesture) | 53 bool user_gesture) |
| 49 => (array<PermissionStatus> statuses); | 54 => (array<PermissionStatus> statuses); |
| 50 RevokePermission(PermissionDescriptor permission, url.mojom.Origin origin) | 55 RevokePermission(PermissionDescriptor permission, url.mojom.Origin origin) |
| 51 => (PermissionStatus status); | 56 => (PermissionStatus status); |
| 52 | 57 AddPermissionObserver(PermissionDescriptor permission, |
|
mlamouri (slow - plz ping)
2016/12/19 13:37:45
It would be good to add a comment. You should be a
Reilly Grant (use Gerrit)
2016/12/19 22:23:59
Done.
| |
| 53 // Runs the callback next time there is a permission status change for the | 58 url.mojom.Origin origin, |
| 54 // given { permission, origin }. Callers of this method will have to call it | 59 PermissionStatus last_known_status, |
| 55 // again if they want to keep listening to the changes. To prevent race | 60 PermissionObserver observer); |
| 56 // conditions, the caller must pass the last known value. | |
| 57 GetNextPermissionChange(PermissionDescriptor permission, | |
| 58 url.mojom.Origin origin, | |
| 59 PermissionStatus last_known_status) | |
| 60 => (PermissionStatus status); | |
| 61 }; | 61 }; |
| OLD | NEW |