Index: third_party/WebKit/public/platform/modules/presentation/presentation.mojom |
diff --git a/third_party/WebKit/public/platform/modules/presentation/presentation.mojom b/third_party/WebKit/public/platform/modules/presentation/presentation.mojom |
index 0427db2c60e7d0709b13a1b4b2bbbeea73563084..ebb776d96a021a67cffc275214cf3d3fa9e5ee21 100644 |
--- a/third_party/WebKit/public/platform/modules/presentation/presentation.mojom |
+++ b/third_party/WebKit/public/platform/modules/presentation/presentation.mojom |
@@ -11,6 +11,7 @@ import "url/mojo/url.mojom"; |
struct PresentationSessionInfo { |
url.mojom.Url url; |
string id; |
+ bool is_offscreen; |
}; |
enum PresentationConnectionState { |
@@ -52,10 +53,24 @@ struct SessionMessage { |
array<uint8>? data; |
}; |
+interface PresentationConnection { |
+ // TODO(zhaobin): migrate SendSessionMessage from PresenationService => |
+ // PresentationConnection.Send(). http://crbug.com/658474 |
+ |
+ // Called to set the PresentationConnection that is the destination for |
+ // messages sent and the source of messages received by this connection. |
+ SetTargetConnection(PresentationConnection connection); |
+ |
+ // Called when a message is sent by the target connection. |
+ OnMessage(SessionMessage message); |
+}; |
+ |
interface PresentationService { |
// Sets the PresentationServiceClient. |
SetClient(PresentationServiceClient client); |
+ /////////////Functions here are for the controller part of the API./////////// |
+ |
// Called when the frame sets or changes the default presentation URLs. |
// When the default presentation is started on this frame, |
// PresentationServiceClient::OnDefaultSessionStarted will be invoked. |
@@ -90,6 +105,13 @@ interface PresentationService { |
JoinSession(array<url.mojom.Url> presentation_urls, string? presentation_id) |
=> (PresentationSessionInfo? sessionInfo, PresentationError? error); |
+ // Called in StartSession's callback function for 1-UA presentations only. It |
+ // sends controlling frame's PresentationConnection to PresentationService. |
+ SetPresentationConnection(PresentationSessionInfo sessionInfo, |
+ PresentationConnection connection); |
+ |
+ ////////////////////////////////////////////////////////////////////////////// |
+ |
// Called when send() is called by the frame. The true in the |
// result callback notifies that the service is ready for next message. |
// The false in the result callback notifies the renderer to stop sending |
@@ -112,6 +134,9 @@ interface PresentationService { |
}; |
interface PresentationServiceClient { |
+ |
+ ////////////Functions here are called only on the controlling page./////////// |
+ |
// Called when the client tries to listen for screen availability changes for |
// presentation of |url| but it is not supported by the device or underlying |
// platform. This can also be called if the device is currently in a mode |
@@ -124,6 +149,11 @@ interface PresentationServiceClient { |
// the current known state. It will then be called to notify of state updates. |
OnScreenAvailabilityUpdated(url.mojom.Url url, bool available); |
+ // See PresentationService::SetDefaultPresentationURL. |
+ OnDefaultSessionStarted(PresentationSessionInfo sessionInfo); |
+ |
+ ////////////////////////////////////////////////////////////////////////////// |
+ |
// Called when the state of PresentationConnection |connection| started on |
// this frame has changed to |newState|. |
OnConnectionStateChanged(PresentationSessionInfo connection, |
@@ -139,9 +169,8 @@ interface PresentationServiceClient { |
OnSessionMessagesReceived(PresentationSessionInfo sessionInfo, |
array<SessionMessage> messages); |
- // See PresentationService::SetDefaultPresentationURL. |
- OnDefaultSessionStarted(PresentationSessionInfo sessionInfo); |
- |
- // See PresentationService::ListeningForReceiverPageRendered. |
- OnReceiverConnectionAvailable(PresentationSessionInfo sessionInfo); |
+ // Called on a presentation receiver when the first presentation connection is |
+ // available from the controlling page. |
+ OnReceiverConnectionAvailable(PresentationSessionInfo sessionInfo, |
+ PresentationConnection connection); |
}; |