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