OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // TODO(crbug.com/647290): Rename "Session" to "Connection" | 5 // TODO(crbug.com/647290): Rename "Session" to "Connection" |
6 | 6 |
7 module blink.mojom; | 7 module blink.mojom; |
8 | 8 |
9 import "url/mojo/url.mojom"; | 9 import "url/mojo/url.mojom"; |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 SetTargetConnection(PresentationConnection connection); | 61 SetTargetConnection(PresentationConnection connection); |
62 | 62 |
63 // Called when a message is sent by the target connection. | 63 // Called when a message is sent by the target connection. |
64 OnMessage(SessionMessage message); | 64 OnMessage(SessionMessage message); |
65 }; | 65 }; |
66 | 66 |
67 interface PresentationService { | 67 interface PresentationService { |
68 // Sets the PresentationServiceClient. | 68 // Sets the PresentationServiceClient. |
69 SetClient(PresentationServiceClient client); | 69 SetClient(PresentationServiceClient client); |
70 | 70 |
| 71 ///////////// Functions here are for the controller part of the API. ///////// |
| 72 |
71 // Called when the frame sets or changes the default presentation URLs. | 73 // Called when the frame sets or changes the default presentation URLs. |
72 // When the default presentation is started on this frame, | 74 // When the default presentation is started on this frame, |
73 // PresentationServiceClient::OnDefaultSessionStarted will be invoked. | 75 // PresentationServiceClient::OnDefaultSessionStarted will be invoked. |
74 SetDefaultPresentationUrls(array<url.mojom.Url> presentation_urls); | 76 SetDefaultPresentationUrls(array<url.mojom.Url> presentation_urls); |
75 | 77 |
76 // Starts listening for screen availability for presentation of | 78 // Starts listening for screen availability for presentation of |
77 // |availability_url|. Availability results will be returned to the client via | 79 // |availability_url|. Availability results will be returned to the client via |
78 // PresentationServiceClient::OnScreenAvailabilityUpdated. | 80 // PresentationServiceClient::OnScreenAvailabilityUpdated. |
79 ListenForScreenAvailability(url.mojom.Url availability_url); | 81 ListenForScreenAvailability(url.mojom.Url availability_url); |
80 | 82 |
(...skipping 14 matching lines...) Expand all Loading... |
95 StartSession(array<url.mojom.Url> presentation_urls) | 97 StartSession(array<url.mojom.Url> presentation_urls) |
96 => (PresentationSessionInfo? sessionInfo, PresentationError? error); | 98 => (PresentationSessionInfo? sessionInfo, PresentationError? error); |
97 | 99 |
98 // Called when joinSession() is called by the frame. The result callback | 100 // Called when joinSession() is called by the frame. The result callback |
99 // works the same as for the method above. JoinSession will join a known | 101 // works the same as for the method above. JoinSession will join a known |
100 // session (i.e. when the page navigates or the user opens another tab) | 102 // session (i.e. when the page navigates or the user opens another tab) |
101 // silently and without user action. | 103 // silently and without user action. |
102 JoinSession(array<url.mojom.Url> presentation_urls, string? presentation_id) | 104 JoinSession(array<url.mojom.Url> presentation_urls, string? presentation_id) |
103 => (PresentationSessionInfo? sessionInfo, PresentationError? error); | 105 => (PresentationSessionInfo? sessionInfo, PresentationError? error); |
104 | 106 |
| 107 // Called in StartSession's callback function for offscreen presentation only. |
| 108 // It passes in controlling frame's PresentationConnection to |
| 109 // PresentationService. |
| 110 SetPresentationConnection(PresentationSessionInfo sessionInfo, |
| 111 PresentationConnection connection); |
| 112 |
| 113 ////////////////////////////////////////////////////////////////////////////// |
| 114 |
105 // Called when send() is called by the frame. The true in the | 115 // Called when send() is called by the frame. The true in the |
106 // result callback notifies that the service is ready for next message. | 116 // result callback notifies that the service is ready for next message. |
107 // The false in the result callback notifies the renderer to stop sending | 117 // The false in the result callback notifies the renderer to stop sending |
108 // the send requests and invalidate all pending requests. This occurs | 118 // the send requests and invalidate all pending requests. This occurs |
109 // for eg., when frame is deleted or navigated away. | 119 // for eg., when frame is deleted or navigated away. |
110 SendSessionMessage(PresentationSessionInfo sessionInfo, | 120 SendSessionMessage(PresentationSessionInfo sessionInfo, |
111 SessionMessage message_request) => (bool success); | 121 SessionMessage message_request) => (bool success); |
112 | 122 |
113 // Called when close() is called by the frame. | 123 // Called when close() is called by the frame. |
114 CloseConnection(url.mojom.Url presentation_url, string presentation_id); | 124 CloseConnection(url.mojom.Url presentation_url, string presentation_id); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // See PresentationService::ListenForSessionMessages. | 160 // See PresentationService::ListenForSessionMessages. |
151 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo, | 161 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo, |
152 array<SessionMessage> messages); | 162 array<SessionMessage> messages); |
153 | 163 |
154 // See PresentationService::SetDefaultPresentationURL. | 164 // See PresentationService::SetDefaultPresentationURL. |
155 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo); | 165 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo); |
156 | 166 |
157 // See PresentationService::OnReceiverConnectionAvailable. | 167 // See PresentationService::OnReceiverConnectionAvailable. |
158 OnReceiverConnectionAvailable(PresentationSessionInfo sessionInfo); | 168 OnReceiverConnectionAvailable(PresentationSessionInfo sessionInfo); |
159 }; | 169 }; |
OLD | NEW |