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