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