| 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 }; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 struct SessionMessage { | 35 struct SessionMessage { |
| 36 PresentationMessageType type; | 36 PresentationMessageType type; |
| 37 // Used when message type is TEXT. | 37 // Used when message type is TEXT. |
| 38 string? message; | 38 string? message; |
| 39 // Used when message type is ARRAY_BUFFER or BLOB. | 39 // Used when message type is ARRAY_BUFFER or BLOB. |
| 40 array<uint8>? data; | 40 array<uint8>? data; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 interface PresentationService { | 43 interface PresentationService { |
| 44 // Called when the frame sets or changes the default presentation URL. | |
| 45 SetDefaultPresentationURL(string url); | |
| 46 | |
| 47 // Sets the PresentationServiceClient. | 44 // Sets the PresentationServiceClient. |
| 48 SetClient(PresentationServiceClient client); | 45 SetClient(PresentationServiceClient client); |
| 49 | 46 |
| 47 // Called when the frame sets or changes the default presentation URL. |
| 48 // When the default presentation is started on this frame, |
| 49 // PresentationServiceClient::OnDefaultSessionStarted will be invoked. |
| 50 SetDefaultPresentationURL(string url); |
| 51 |
| 50 // Starts listening for screen availability for presentation of | 52 // Starts listening for screen availability for presentation of |
| 51 // |url|. Availability results will be returned to the client via | 53 // |url|. Availability results will be returned to the client via |
| 52 // PresentationServiceClient::OnScreenAvailabilityUpdated. | 54 // PresentationServiceClient::OnScreenAvailabilityUpdated. |
| 53 ListenForScreenAvailability(string url); | 55 ListenForScreenAvailability(string url); |
| 54 | 56 |
| 55 // Stops listening for screen availability for the presentation of |url|. The | 57 // Stops listening for screen availability for the presentation of |url|. The |
| 56 // PresentationServiceClient will stop receiving availability updates for | 58 // PresentationServiceClient will stop receiving availability updates for |
| 57 // |url|. | 59 // |url|. |
| 58 StopListeningForScreenAvailability(string url); | 60 StopListeningForScreenAvailability(string url); |
| 59 | 61 |
| 60 // Called when the renderer is ready to receive the browser initiated | |
| 61 // session. If the default session is started by the embedder before this | |
| 62 // call, the embedder may queue it and run the callback when the call is | |
| 63 // performed. | |
| 64 ListenForDefaultSessionStart() | |
| 65 => (PresentationSessionInfo? defaultSessionInfo); | |
| 66 | |
| 67 // Called when startSession() is called by the frame. The result callback | 62 // Called when startSession() is called by the frame. The result callback |
| 68 // will return a non-null and valid PresentationSessionInfo if starting the | 63 // will return a non-null and valid PresentationSessionInfo if starting the |
| 69 // session succeeded, or null with a PresentationError if starting the | 64 // session succeeded, or null with a PresentationError if starting the |
| 70 // session failed. | 65 // session failed. |
| 71 // The presentation id returned in |sessionInfo| on success is generated by | 66 // The presentation id returned in |sessionInfo| on success is generated by |
| 72 // the UA. | 67 // the UA. |
| 73 // If the UA identifies a matching session (same presentation url), the user | 68 // If the UA identifies a matching session (same presentation url), the user |
| 74 // may choose this existing session and the page will join it rather than get | 69 // may choose this existing session and the page will join it rather than get |
| 75 // a new one. | 70 // a new one. |
| 76 StartSession(string presentation_url) | 71 StartSession(string presentation_url) |
| 77 => (PresentationSessionInfo? sessionInfo, PresentationError? error); | 72 => (PresentationSessionInfo? sessionInfo, PresentationError? error); |
| 78 | 73 |
| 79 // Called when joinSession() is called by the frame. The result callback | 74 // Called when joinSession() is called by the frame. The result callback |
| 80 // works the same as for the method above. JoinSession will join a known | 75 // works the same as for the method above. JoinSession will join a known |
| 81 // session (i.e. when the page navigates or the user opens another tab) | 76 // session (i.e. when the page navigates or the user opens another tab) |
| 82 // silently and without user action. | 77 // silently and without user action. |
| 83 JoinSession(string presentation_url, string? presentation_id) | 78 JoinSession(string presentation_url, string? presentation_id) |
| 84 => (PresentationSessionInfo? sessionInfo, PresentationError? error); | 79 => (PresentationSessionInfo? sessionInfo, PresentationError? error); |
| 85 | 80 |
| 86 // Called when send() is called by the frame. The true in the | 81 // Called when send() is called by the frame. The true in the |
| 87 // result callback notifies that the service is ready for next message. | 82 // result callback notifies that the service is ready for next message. |
| 88 // The false in the result callback notifies the renderer to stop sending | 83 // The false in the result callback notifies the renderer to stop sending |
| 89 // the send requests and invalidate all pending requests. This occurs | 84 // the send requests and invalidate all pending requests. This occurs |
| 90 // for eg., when frame is deleted or navigated away. | 85 // for eg., when frame is deleted or navigated away. |
| 91 SendSessionMessage(PresentationSessionInfo sessionInfo, SessionMessage message
_request) => (bool success); | 86 SendSessionMessage(PresentationSessionInfo sessionInfo, |
| 87 SessionMessage message_request) => (bool success); |
| 92 | 88 |
| 93 // Called when closeSession() is called by the frame. | 89 // Called when closeSession() is called by the frame. |
| 94 CloseSession(string presentation_url, string presentation_id); | 90 CloseSession(string presentation_url, string presentation_id); |
| 95 | 91 |
| 96 // Starts listening for state changes for sessions created on this frame. | 92 // Starts listening for state changes for sessions created on this frame. |
| 97 // When state change occurs, PresentationServiceClient::OnSessionStateChanged | 93 // When state change occurs, PresentationServiceClient::OnSessionStateChanged |
| 98 // will be invoked with the session and its new state. | 94 // will be invoked with the session and its new state. |
| 99 // This is called after a presentation session is created. | 95 // This is called after a presentation session is created. |
| 100 ListenForSessionStateChange(); | 96 ListenForSessionStateChange(); |
| 101 | 97 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 117 // presentation of |url| and the state changes. When the client starts to | 113 // presentation of |url| and the state changes. When the client starts to |
| 118 // listen for screen availability, this method will always be called to give | 114 // listen for screen availability, this method will always be called to give |
| 119 // the current known state. It will then be called to notify of state updates. | 115 // the current known state. It will then be called to notify of state updates. |
| 120 OnScreenAvailabilityUpdated(string url, bool available); | 116 OnScreenAvailabilityUpdated(string url, bool available); |
| 121 | 117 |
| 122 // See PresentationService::ListenForSessionStateChange. | 118 // See PresentationService::ListenForSessionStateChange. |
| 123 OnSessionStateChanged(PresentationSessionInfo sessionInfo, | 119 OnSessionStateChanged(PresentationSessionInfo sessionInfo, |
| 124 PresentationSessionState newState); | 120 PresentationSessionState newState); |
| 125 | 121 |
| 126 // See PresentationService::ListenForSessionMessages. | 122 // See PresentationService::ListenForSessionMessages. |
| 127 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo, array<SessionMe
ssage> messages); | 123 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo, |
| 124 array<SessionMessage> messages); |
| 125 |
| 126 // See PresentationService::SetDefaultPresentationURL. |
| 127 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo); |
| 128 }; | 128 }; |
| OLD | NEW |