| 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 module presentation; | 5 module presentation; |
| 6 | 6 |
| 7 struct PresentationSessionInfo { | 7 struct PresentationSessionInfo { |
| 8 string url; | 8 string url; |
| 9 string id; | 9 string id; |
| 10 }; | 10 }; |
| 11 | 11 |
| 12 enum PresentationSessionState { | 12 enum PresentationSessionState { |
| 13 CONNECTED, | 13 CONNECTED, |
| 14 DISCONNECTED | 14 DISCONNECTED |
| 15 }; | 15 }; |
| 16 | 16 |
| 17 enum PresentationErrorType { | 17 enum PresentationErrorType { |
| 18 NO_AVAILABLE_SCREENS, | 18 NO_AVAILABLE_SCREENS, |
| 19 SESSION_REQUEST_CANCELLED, | 19 SESSION_REQUEST_CANCELLED, |
| 20 NO_PRESENTATION_FOUND, | 20 NO_PRESENTATION_FOUND, |
| 21 UNKNOWN, | 21 UNKNOWN, |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 struct PresentationError { | 24 struct PresentationError { |
| 25 PresentationErrorType error_type; | 25 PresentationErrorType error_type; |
| 26 string message; | 26 string message; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 enum PresentationMessageType { | 29 enum PresentationMessageType { |
| 30 TEXT, | 30 TEXT, |
| 31 ARRAY_BUFFER, | 31 ARRAY_BUFFER, |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 struct SessionMessage { | 34 struct SessionMessage { |
| 35 string presentation_url; | 35 string presentation_url; |
| 36 string presentation_id; | 36 string presentation_id; |
| 37 PresentationMessageType type; | 37 PresentationMessageType type; |
| 38 string? message; | 38 string? message; |
| 39 array<uint8>? data; | 39 array<uint8>? data; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 interface PresentationService { | 42 interface PresentationService { |
| 43 // Called when the frame sets or changes the default presentation URL or | 43 // Called when the frame sets or changes the default presentation URL or |
| 44 // presentation ID. | 44 // presentation ID. |
| 45 SetDefaultPresentationURL( | 45 SetDefaultPresentationURL( |
| 46 string default_presentation_url, | 46 string default_presentation_url, |
| 47 string? default_presentation_id); | 47 string? default_presentation_id); |
| 48 | 48 |
| 49 // Returns the last screen availability state if it’s changed since the last | 49 // Returns the last screen availability state if it’s changed since the last |
| (...skipping 30 matching lines...) Expand all Loading... |
| 80 StartSession(string presentation_url, string? presentation_id) | 80 StartSession(string presentation_url, string? presentation_id) |
| 81 => (PresentationSessionInfo? sessionInfo, PresentationError? error); | 81 => (PresentationSessionInfo? sessionInfo, PresentationError? error); |
| 82 | 82 |
| 83 // Called when joinSession() is called by the frame. The result callback | 83 // Called when joinSession() is called by the frame. The result callback |
| 84 // works the same as for the method above. JoinSession will join a known | 84 // works the same as for the method above. JoinSession will join a known |
| 85 // session (i.e. when the page navigates or the user opens another tab) | 85 // session (i.e. when the page navigates or the user opens another tab) |
| 86 // silently and without user action. | 86 // silently and without user action. |
| 87 JoinSession(string presentation_url, string? presentation_id) | 87 JoinSession(string presentation_url, string? presentation_id) |
| 88 => (PresentationSessionInfo? sessionInfo, PresentationError? error); | 88 => (PresentationSessionInfo? sessionInfo, PresentationError? error); |
| 89 | 89 |
| 90 // Called when send() is called by the frame. The true in the |
| 91 // result callback notifies that the service is ready for next message. |
| 92 // The false in the result callback notifies the renderer to stop sending |
| 93 // the send requests and invalidate all pending requests. This occurs |
| 94 // for eg., when frame is deleted or navigated away. |
| 95 SendSessionMessage(SessionMessage message_request) => (bool success); |
| 96 |
| 90 // Called when closeSession() is called by the frame. | 97 // Called when closeSession() is called by the frame. |
| 91 CloseSession(string presentation_url, string presentation_id); | 98 CloseSession(string presentation_url, string presentation_id); |
| 92 | 99 |
| 93 // Called when the frame is ready to process the next state change. Returns | 100 // Called when the frame is ready to process the next state change. Returns |
| 94 // the last session state if it’s changed since the last time the callback | 101 // the last session state if it’s changed since the last time the callback |
| 95 // was called. Might cause the event fired with the initial state change. | 102 // was called. Might cause the event fired with the initial state change. |
| 96 ListenForSessionStateChange() | 103 ListenForSessionStateChange() |
| 97 => (PresentationSessionInfo sessionInfo, | 104 => (PresentationSessionInfo sessionInfo, |
| 98 PresentationSessionState newState); | 105 PresentationSessionState newState); |
| 99 | 106 |
| 100 // Called when the frame is ready to process the next batch of messages. | 107 // Called when the frame is ready to process the next batch of messages. |
| 101 // When the callback carries null messages, there is an error | 108 // When the callback carries null messages, there is an error |
| 102 // at the presentation service side. | 109 // at the presentation service side. |
| 103 ListenForSessionMessages() | 110 ListenForSessionMessages() |
| 104 => (array<SessionMessage>? messages); | 111 => (array<SessionMessage>? messages); |
| 105 }; | 112 }; |
| OLD | NEW |