| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 struct SessionMessage { | 47 struct SessionMessage { |
| 48 PresentationMessageType type; | 48 PresentationMessageType type; |
| 49 // Used when message type is TEXT. | 49 // Used when message type is TEXT. |
| 50 string? message; | 50 string? message; |
| 51 // Used when message type is ARRAY_BUFFER or BLOB. | 51 // Used when message type is ARRAY_BUFFER or BLOB. |
| 52 array<uint8>? data; | 52 array<uint8>? data; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 interface PresentationConnection { |
| 56 // Called to set the PresentationConnection interface that sends |
| 57 // messages in the opposite direction. |
| 58 SetTargetConnection(PresentationConnection connection); |
| 59 |
| 60 // Called when connection.send() is invoked at the other end of the |
| 61 // connection. |
| 62 OnSessionMessageReceived(SessionMessage message); |
| 63 }; |
| 64 |
| 55 interface PresentationService { | 65 interface PresentationService { |
| 56 // Sets the PresentationServiceClient. | 66 // Sets the PresentationServiceClient. |
| 57 SetClient(PresentationServiceClient client); | 67 SetClient(PresentationServiceClient client); |
| 58 | 68 |
| 59 // Called when the frame sets or changes the default presentation URLs. | 69 // Called when the frame sets or changes the default presentation URLs. |
| 60 // When the default presentation is started on this frame, | 70 // When the default presentation is started on this frame, |
| 61 // PresentationServiceClient::OnDefaultSessionStarted will be invoked. | 71 // PresentationServiceClient::OnDefaultSessionStarted will be invoked. |
| 62 SetDefaultPresentationUrls(array<url.mojom.Url> presentation_urls); | 72 SetDefaultPresentationUrls(array<url.mojom.Url> presentation_urls); |
| 63 | 73 |
| 64 // Starts listening for screen availability for presentation of | 74 // Starts listening for screen availability for presentation of |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 CloseConnection(url.mojom.Url presentation_url, string presentation_id); | 112 CloseConnection(url.mojom.Url presentation_url, string presentation_id); |
| 103 | 113 |
| 104 // Called when terminate() is called by the frame. | 114 // Called when terminate() is called by the frame. |
| 105 Terminate(url.mojom.Url presentation_url, string presentation_id); | 115 Terminate(url.mojom.Url presentation_url, string presentation_id); |
| 106 | 116 |
| 107 // Starts listening for messages for session with |sessionInfo|. | 117 // Starts listening for messages for session with |sessionInfo|. |
| 108 // Messages will be received in | 118 // Messages will be received in |
| 109 // PresentationServiceClient::OnSessionMessagesReceived. | 119 // PresentationServiceClient::OnSessionMessagesReceived. |
| 110 // This is called after a presentation session is created. | 120 // This is called after a presentation session is created. |
| 111 ListenForSessionMessages(PresentationSessionInfo sessionInfo); | 121 ListenForSessionMessages(PresentationSessionInfo sessionInfo); |
| 122 |
| 123 SetPresentationConnection(PresentationSessionInfo sessionInfo, |
| 124 PresentationConnection connection); |
| 112 }; | 125 }; |
| 113 | 126 |
| 114 interface PresentationServiceClient { | 127 interface PresentationServiceClient { |
| 115 // Called when the client tries to listen for screen availability changes for | 128 // Called when the client tries to listen for screen availability changes for |
| 116 // presentation of |url| but it is not supported by the device or underlying | 129 // presentation of |url| but it is not supported by the device or underlying |
| 117 // platform. This can also be called if the device is currently in a mode | 130 // platform. This can also be called if the device is currently in a mode |
| 118 // where it can't do screen discoveries (eg. low battery). | 131 // where it can't do screen discoveries (eg. low battery). |
| 119 OnScreenAvailabilityNotSupported(url.mojom.Url url); | 132 OnScreenAvailabilityNotSupported(url.mojom.Url url); |
| 120 | 133 |
| 121 // Called when the client is listening for screen availability for | 134 // Called when the client is listening for screen availability for |
| (...skipping 14 matching lines...) Expand all Loading... |
| 136 string message); | 149 string message); |
| 137 | 150 |
| 138 // See PresentationService::ListenForSessionMessages. | 151 // See PresentationService::ListenForSessionMessages. |
| 139 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo, | 152 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo, |
| 140 array<SessionMessage> messages); | 153 array<SessionMessage> messages); |
| 141 | 154 |
| 142 // See PresentationService::SetDefaultPresentationURL. | 155 // See PresentationService::SetDefaultPresentationURL. |
| 143 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo); | 156 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo); |
| 144 | 157 |
| 145 // See PresentationService::ListeningForReceiverPageRendered. | 158 // See PresentationService::ListeningForReceiverPageRendered. |
| 146 OnReceiverConnectionAvailable(PresentationSessionInfo sessionInfo); | 159 OnReceiverConnectionAvailable(PresentationSessionInfo sessionInfo, |
| 160 PresentationConnection connection); |
| 147 }; | 161 }; |
| OLD | NEW |