| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // silently and without user action. | 88 // silently and without user action. |
| 89 JoinSession(string presentation_url, string? presentation_id) | 89 JoinSession(string presentation_url, string? presentation_id) |
| 90 => (PresentationSessionInfo? sessionInfo, PresentationError? error); | 90 => (PresentationSessionInfo? sessionInfo, PresentationError? error); |
| 91 | 91 |
| 92 // Called when send() is called by the frame. The true in the | 92 // Called when send() is called by the frame. The true in the |
| 93 // result callback notifies that the service is ready for next message. | 93 // result callback notifies that the service is ready for next message. |
| 94 // The false in the result callback notifies the renderer to stop sending | 94 // The false in the result callback notifies the renderer to stop sending |
| 95 // the send requests and invalidate all pending requests. This occurs | 95 // the send requests and invalidate all pending requests. This occurs |
| 96 // for eg., when frame is deleted or navigated away. | 96 // for eg., when frame is deleted or navigated away. |
| 97 SendSessionMessage(SessionMessage message_request) => (bool success); | 97 SendSessionMessage(SessionMessage message_request) => (bool success); |
| 98 | 98 |
| 99 // Called when closeSession() is called by the frame. | 99 // Called when closeSession() is called by the frame. |
| 100 CloseSession(string presentation_url, string presentation_id); | 100 CloseSession(string presentation_url, string presentation_id); |
| 101 | 101 |
| 102 // Starts listening for state changes for sessions created on this frame. | 102 // Starts listening for state changes for sessions created on this frame. |
| 103 // When state change occurs, PresentationServiceClient::OnSessionStateChanged | 103 // When state change occurs, PresentationServiceClient::OnSessionStateChanged |
| 104 // will be invoked with the session and its new state. | 104 // will be invoked with the session and its new state. |
| 105 ListenForSessionStateChange(); | 105 ListenForSessionStateChange(); |
| 106 | 106 |
| 107 // 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. |
| 108 // When the callback carries null messages, there is an error | 108 // When the callback carries null messages, there is an error |
| 109 // at the presentation service side. | 109 // at the presentation service side. |
| 110 ListenForSessionMessages() | 110 ListenForSessionMessages() |
| 111 => (array<SessionMessage>? messages); | 111 => (array<SessionMessage>? messages); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 interface PresentationServiceClient { | 114 interface PresentationServiceClient { |
| 115 // See PresentationSerivce::ListenForScreenAvailability. | 115 // Called when the client tries to listen for screen availability changes but |
| 116 // it is not supported by the device or underlying platform. This can also be |
| 117 // called if the device is currently in a mode where it can't do screen |
| 118 // discoveries (eg. low battery). |
| 119 OnScreenAvailabilityNotSupported(); |
| 120 |
| 121 // Called when the client is listening for screen availability and the state |
| 122 // changes. When the client starts to listen for screen availability, this |
| 123 // method will always be called to give the current known state. It will then |
| 124 // be called to notify of state updates. |
| 116 OnScreenAvailabilityUpdated(bool available); | 125 OnScreenAvailabilityUpdated(bool available); |
| 117 | 126 |
| 118 // See PresentationService::ListenForSessionStateChange. | 127 // See PresentationService::ListenForSessionStateChange. |
| 119 OnSessionStateChanged(PresentationSessionInfo sessionInfo, | 128 OnSessionStateChanged(PresentationSessionInfo sessionInfo, |
| 120 PresentationSessionState newState); | 129 PresentationSessionState newState); |
| 121 }; | 130 }; |
| OLD | NEW |