| 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 // Called when target connection calls close(). | 57 // Called when target connection calls close(). |
| 68 OnClose(); | 58 OnClose(); |
| 69 }; | 59 }; |
| 70 | 60 |
| 71 interface PresentationService { | 61 interface PresentationService { |
| 72 // Sets the PresentationServiceClient. | 62 // Sets the PresentationServiceClient. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 100 |
| 111 // Called in StartSession's callback function for offscreen presentation only. | 101 // Called in StartSession's callback function for offscreen presentation only. |
| 112 // It passes in controlling frame's PresentationConnection and | 102 // It passes in controlling frame's PresentationConnection and |
| 113 // PresentationConnectionRequest to PresentationService. | 103 // PresentationConnectionRequest to PresentationService. |
| 114 SetPresentationConnection( | 104 SetPresentationConnection( |
| 115 PresentationSessionInfo sessionInfo, | 105 PresentationSessionInfo sessionInfo, |
| 116 PresentationConnection controller_connection_ptr, | 106 PresentationConnection controller_connection_ptr, |
| 117 PresentationConnection& receiver_connection_request); | 107 PresentationConnection& receiver_connection_request); |
| 118 | 108 |
| 119 ////////////////////////////////////////////////////////////////////////////// | 109 ////////////////////////////////////////////////////////////////////////////// |
| 120 | |
| 121 // Called when close() is called by the frame. | 110 // Called when close() is called by the frame. |
| 122 CloseConnection(url.mojom.Url presentation_url, string presentation_id); | 111 CloseConnection(url.mojom.Url presentation_url, string presentation_id); |
| 123 | 112 |
| 124 // Called when terminate() is called by the frame. | 113 // Called when terminate() is called by the frame. |
| 125 Terminate(url.mojom.Url presentation_url, string presentation_id); | 114 Terminate(url.mojom.Url presentation_url, string presentation_id); |
| 126 | 115 |
| 127 // Starts listening for messages for session with |sessionInfo|. | 116 // Starts listening for messages for session with |sessionInfo|. |
| 128 // Messages will be received in | 117 // Messages will be received in |
| 129 // PresentationServiceClient::OnConnectionMessagesReceived. | 118 // PresentationServiceClient::OnConnectionMessagesReceived. |
| 130 // This is called after a presentation session is created. | 119 // This is called after a presentation session is created. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 158 PresentationConnectionState newState); | 147 PresentationConnectionState newState); |
| 159 | 148 |
| 160 // Caled when the state of |connection| started on this frame has changed to | 149 // Caled when the state of |connection| started on this frame has changed to |
| 161 // CLOSED. | 150 // CLOSED. |
| 162 OnConnectionClosed(PresentationSessionInfo connection, | 151 OnConnectionClosed(PresentationSessionInfo connection, |
| 163 PresentationConnectionCloseReason reason, | 152 PresentationConnectionCloseReason reason, |
| 164 string message); | 153 string message); |
| 165 | 154 |
| 166 // See PresentationService::ListenForConnectionMessages. | 155 // See PresentationService::ListenForConnectionMessages. |
| 167 OnConnectionMessagesReceived(PresentationSessionInfo sessionInfo, | 156 OnConnectionMessagesReceived(PresentationSessionInfo sessionInfo, |
| 168 array<ConnectionMessage> messages); | 157 array<PresentationConnectionMessage> messages); |
| 169 | 158 |
| 170 // Called on a presentation receiver when presentation connection is available | 159 // Called on a presentation receiver when presentation connection is available |
| 171 // from the controlling page. | 160 // from the controlling page. |
| 172 OnReceiverConnectionAvailable( | 161 OnReceiverConnectionAvailable( |
| 173 PresentationSessionInfo sessionInfo, | 162 PresentationSessionInfo sessionInfo, |
| 174 PresentationConnection controller_connection_ptr, | 163 PresentationConnection controller_connection_ptr, |
| 175 PresentationConnection& receiver_connection_request); | 164 PresentationConnection& receiver_connection_request); |
| 176 }; | 165 }; |
| OLD | NEW |