| 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 21 matching lines...) Expand all Loading... |
| 32 NO_PRESENTATION_FOUND, | 32 NO_PRESENTATION_FOUND, |
| 33 PREVIOUS_START_IN_PROGRESS, | 33 PREVIOUS_START_IN_PROGRESS, |
| 34 UNKNOWN, | 34 UNKNOWN, |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 struct PresentationError { | 37 struct PresentationError { |
| 38 PresentationErrorType error_type; | 38 PresentationErrorType error_type; |
| 39 string message; | 39 string message; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 enum PresentationMessageType { | 42 union PresentationConnectionMessage { |
| 43 TEXT, | 43 string message; |
| 44 BINARY, | 44 array<uint8> data; |
| 45 }; | |
| 46 | |
| 47 struct ConnectionMessage { | |
| 48 PresentationMessageType type; | |
| 49 // Used when message type is TEXT. | |
| 50 string? message; | |
| 51 // Used when message type is BINARY. | |
| 52 // TODO(lethalantidote): Make this a mojo union. | |
| 53 // See https://crbug.com/632623. | |
| 54 array<uint8>? data; | |
| 55 }; | 45 }; |
| 56 | 46 |
| 57 interface PresentationConnection { | 47 interface PresentationConnection { |
| 58 // TODO(zhaobin): migrate SendConnectionMessage from PresentationService => | 48 // TODO(zhaobin): migrate SendConnectionMessage from PresentationService => |
| 59 // PresentationConnection.Send(). http://crbug.com/658474 | 49 // PresentationConnection.Send(). http://crbug.com/658474 |
| 60 | 50 |
| 61 // Called when a message is sent by the target connection. | 51 // Called when a message is sent by the target connection. |
| 62 OnMessage(ConnectionMessage message) => (bool success); | 52 OnMessage(PresentationConnectionMessage message) => (bool success); |
| 63 | 53 |
| 64 // Called when target connection notifies connection state change. | 54 // Called when target connection notifies connection state change. |
| 65 DidChangeState(PresentationConnectionState state); | 55 DidChangeState(PresentationConnectionState state); |
| 66 }; | 56 }; |
| 67 | 57 |
| 68 interface PresentationService { | 58 interface PresentationService { |
| 69 // Sets the PresentationServiceClient. | 59 // Sets the PresentationServiceClient. |
| 70 SetClient(PresentationServiceClient client); | 60 SetClient(PresentationServiceClient client); |
| 71 | 61 |
| 72 ///////////// Functions here are for the controller part of the API. ///////// | 62 ///////////// Functions here are for the controller part of the API. ///////// |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 97 |
| 108 // Called in StartSession's callback function for offscreen presentation only. | 98 // Called in StartSession's callback function for offscreen presentation only. |
| 109 // It passes in controlling frame's PresentationConnection and | 99 // It passes in controlling frame's PresentationConnection and |
| 110 // PresentationConnectionRequest to PresentationService. | 100 // PresentationConnectionRequest to PresentationService. |
| 111 SetPresentationConnection( | 101 SetPresentationConnection( |
| 112 PresentationSessionInfo sessionInfo, | 102 PresentationSessionInfo sessionInfo, |
| 113 PresentationConnection controller_connection_ptr, | 103 PresentationConnection controller_connection_ptr, |
| 114 PresentationConnection& receiver_connection_request); | 104 PresentationConnection& receiver_connection_request); |
| 115 | 105 |
| 116 ////////////////////////////////////////////////////////////////////////////// | 106 ////////////////////////////////////////////////////////////////////////////// |
| 117 | |
| 118 // Called when close() is called by the frame. | 107 // Called when close() is called by the frame. |
| 119 CloseConnection(url.mojom.Url presentation_url, string presentation_id); | 108 CloseConnection(url.mojom.Url presentation_url, string presentation_id); |
| 120 | 109 |
| 121 // Called when terminate() is called by the frame. | 110 // Called when terminate() is called by the frame. |
| 122 Terminate(url.mojom.Url presentation_url, string presentation_id); | 111 Terminate(url.mojom.Url presentation_url, string presentation_id); |
| 123 | 112 |
| 124 // Starts listening for messages for session with |sessionInfo|. | 113 // Starts listening for messages for session with |sessionInfo|. |
| 125 // Messages will be received in | 114 // Messages will be received in |
| 126 // PresentationServiceClient::OnConnectionMessagesReceived. | 115 // PresentationServiceClient::OnConnectionMessagesReceived. |
| 127 // This is called after a presentation session is created. | 116 // This is called after a presentation session is created. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 155 PresentationConnectionState newState); | 144 PresentationConnectionState newState); |
| 156 | 145 |
| 157 // Caled when the state of |connection| started on this frame has changed to | 146 // Caled when the state of |connection| started on this frame has changed to |
| 158 // CLOSED. | 147 // CLOSED. |
| 159 OnConnectionClosed(PresentationSessionInfo connection, | 148 OnConnectionClosed(PresentationSessionInfo connection, |
| 160 PresentationConnectionCloseReason reason, | 149 PresentationConnectionCloseReason reason, |
| 161 string message); | 150 string message); |
| 162 | 151 |
| 163 // See PresentationService::ListenForConnectionMessages. | 152 // See PresentationService::ListenForConnectionMessages. |
| 164 OnConnectionMessagesReceived(PresentationSessionInfo sessionInfo, | 153 OnConnectionMessagesReceived(PresentationSessionInfo sessionInfo, |
| 165 array<ConnectionMessage> messages); | 154 array<PresentationConnectionMessage> messages); |
| 166 | 155 |
| 167 // Called on a presentation receiver when presentation connection is available | 156 // Called on a presentation receiver when presentation connection is available |
| 168 // from the controlling page. | 157 // from the controlling page. |
| 169 OnReceiverConnectionAvailable( | 158 OnReceiverConnectionAvailable( |
| 170 PresentationSessionInfo sessionInfo, | 159 PresentationSessionInfo sessionInfo, |
| 171 PresentationConnection controller_connection_ptr, | 160 PresentationConnection controller_connection_ptr, |
| 172 PresentationConnection& receiver_connection_request); | 161 PresentationConnection& receiver_connection_request); |
| 173 }; | 162 }; |
| OLD | NEW |