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