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 blink.mojom; | 5 module blink.mojom; |
6 | 6 |
| 7 import "url/mojo/url.mojom"; |
| 8 |
7 struct PresentationSessionInfo { | 9 struct PresentationSessionInfo { |
8 string url; | 10 url.mojom.Url url; |
9 string id; | 11 string id; |
10 }; | 12 }; |
11 | 13 |
12 enum PresentationConnectionState { | 14 enum PresentationConnectionState { |
13 CONNECTING, | 15 CONNECTING, |
14 CONNECTED, | 16 CONNECTED, |
15 CLOSED, | 17 CLOSED, |
16 TERMINATED | 18 TERMINATED |
17 }; | 19 }; |
18 | 20 |
(...skipping 26 matching lines...) Expand all Loading... |
45 // Used when message type is TEXT. | 47 // Used when message type is TEXT. |
46 string? message; | 48 string? message; |
47 // Used when message type is ARRAY_BUFFER or BLOB. | 49 // Used when message type is ARRAY_BUFFER or BLOB. |
48 array<uint8>? data; | 50 array<uint8>? data; |
49 }; | 51 }; |
50 | 52 |
51 interface PresentationService { | 53 interface PresentationService { |
52 // Sets the PresentationServiceClient. | 54 // Sets the PresentationServiceClient. |
53 SetClient(PresentationServiceClient client); | 55 SetClient(PresentationServiceClient client); |
54 | 56 |
55 // Called when the frame sets or changes the default presentation URL. | 57 // Called when the frame sets or changes the default presentation URLs. |
56 // When the default presentation is started on this frame, | 58 // When the default presentation is started on this frame, |
57 // PresentationServiceClient::OnDefaultSessionStarted will be invoked. | 59 // PresentationServiceClient::OnDefaultSessionStarted will be invoked. |
58 SetDefaultPresentationURL(string url); | 60 SetDefaultPresentationUrls(array<url.mojom.Url> presentation_urls); |
59 | 61 |
60 // Starts listening for screen availability for presentation of | 62 // Starts listening for screen availability for presentation of |
61 // |url|. Availability results will be returned to the client via | 63 // |availability_url|. Availability results will be returned to the client via |
62 // PresentationServiceClient::OnScreenAvailabilityUpdated. | 64 // PresentationServiceClient::OnScreenAvailabilityUpdated. |
63 ListenForScreenAvailability(string url); | 65 ListenForScreenAvailability(url.mojom.Url availability_url); |
64 | 66 |
65 // Stops listening for screen availability for the presentation of |url|. The | 67 // Stops listening for screen availability for the presentation of |url|. The |
66 // PresentationServiceClient will stop receiving availability updates for | 68 // PresentationServiceClient will stop receiving availability updates for |
67 // |url|. | 69 // |url|. |
68 StopListeningForScreenAvailability(string url); | 70 StopListeningForScreenAvailability(url.mojom.Url availability_url); |
69 | 71 |
70 // Called when startSession() is called by the frame. The result callback | 72 // Called when startSession() is called by the frame. The result callback |
71 // will return a non-null and valid PresentationSessionInfo if starting the | 73 // will return a non-null and valid PresentationSessionInfo if starting the |
72 // session succeeded, or null with a PresentationError if starting the | 74 // session succeeded, or null with a PresentationError if starting the |
73 // session failed. | 75 // session failed. |
74 // The presentation id returned in |sessionInfo| on success is generated by | 76 // The presentation id returned in |sessionInfo| on success is generated by |
75 // the UA. | 77 // the UA. |
76 // If the UA identifies a matching session (same presentation url), the user | 78 // If the UA identifies a matching session (same presentation url), the user |
77 // may choose this existing session and the page will join it rather than get | 79 // may choose this existing session and the page will join it rather than get |
78 // a new one. | 80 // a new one. |
79 StartSession(string presentation_url) | 81 StartSession(array<url.mojom.Url> presentation_urls) |
80 => (PresentationSessionInfo? sessionInfo, PresentationError? error); | 82 => (PresentationSessionInfo? sessionInfo, PresentationError? error); |
81 | 83 |
82 // Called when joinSession() is called by the frame. The result callback | 84 // Called when joinSession() is called by the frame. The result callback |
83 // works the same as for the method above. JoinSession will join a known | 85 // works the same as for the method above. JoinSession will join a known |
84 // session (i.e. when the page navigates or the user opens another tab) | 86 // session (i.e. when the page navigates or the user opens another tab) |
85 // silently and without user action. | 87 // silently and without user action. |
86 JoinSession(string presentation_url, string? presentation_id) | 88 JoinSession(array<url.mojom.Url> presentation_urls, string? presentation_id) |
87 => (PresentationSessionInfo? sessionInfo, PresentationError? error); | 89 => (PresentationSessionInfo? sessionInfo, PresentationError? error); |
88 | 90 |
89 // Called when send() is called by the frame. The true in the | 91 // Called when send() is called by the frame. The true in the |
90 // result callback notifies that the service is ready for next message. | 92 // result callback notifies that the service is ready for next message. |
91 // The false in the result callback notifies the renderer to stop sending | 93 // The false in the result callback notifies the renderer to stop sending |
92 // the send requests and invalidate all pending requests. This occurs | 94 // the send requests and invalidate all pending requests. This occurs |
93 // for eg., when frame is deleted or navigated away. | 95 // for eg., when frame is deleted or navigated away. |
94 SendSessionMessage(PresentationSessionInfo sessionInfo, | 96 SendSessionMessage(PresentationSessionInfo sessionInfo, |
95 SessionMessage message_request) => (bool success); | 97 SessionMessage message_request) => (bool success); |
96 | 98 |
97 // Called when close() is called by the frame. | 99 // Called when close() is called by the frame. |
98 CloseConnection(string presentation_url, string presentation_id); | 100 CloseConnection(url.mojom.Url presentation_url, string presentation_id); |
99 | 101 |
100 // Called when terminate() is called by the frame. | 102 // Called when terminate() is called by the frame. |
101 Terminate(string presentation_url, string presentation_id); | 103 Terminate(url.mojom.Url presentation_url, string presentation_id); |
102 | 104 |
103 // Starts listening for messages for session with |sessionInfo|. | 105 // Starts listening for messages for session with |sessionInfo|. |
104 // Messages will be received in | 106 // Messages will be received in |
105 // PresentationServiceClient::OnSessionMessagesReceived. | 107 // PresentationServiceClient::OnSessionMessagesReceived. |
106 // This is called after a presentation session is created. | 108 // This is called after a presentation session is created. |
107 ListenForSessionMessages(PresentationSessionInfo sessionInfo); | 109 ListenForSessionMessages(PresentationSessionInfo sessionInfo); |
108 }; | 110 }; |
109 | 111 |
110 interface PresentationServiceClient { | 112 interface PresentationServiceClient { |
111 // Called when the client tries to listen for screen availability changes for | 113 // Called when the client tries to listen for screen availability changes for |
112 // presentation of |url| but it is not supported by the device or underlying | 114 // presentation of |url| but it is not supported by the device or underlying |
113 // platform. This can also be called if the device is currently in a mode | 115 // platform. This can also be called if the device is currently in a mode |
114 // where it can't do screen discoveries (eg. low battery). | 116 // where it can't do screen discoveries (eg. low battery). |
115 OnScreenAvailabilityNotSupported(string url); | 117 OnScreenAvailabilityNotSupported(url.mojom.Url url); |
116 | 118 |
117 // Called when the client is listening for screen availability for | 119 // Called when the client is listening for screen availability for |
118 // presentation of |url| and the state changes. When the client starts to | 120 // 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 | 121 // 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. | 122 // the current known state. It will then be called to notify of state updates. |
121 OnScreenAvailabilityUpdated(string url, bool available); | 123 OnScreenAvailabilityUpdated(url.mojom.Url url, bool available); |
122 | 124 |
123 // Called when the state of PresentationConnection |connection| started on | 125 // Called when the state of PresentationConnection |connection| started on |
124 // this frame has changed to |newState|. | 126 // this frame has changed to |newState|. |
125 OnConnectionStateChanged(PresentationSessionInfo connection, | 127 OnConnectionStateChanged(PresentationSessionInfo connection, |
126 PresentationConnectionState newState); | 128 PresentationConnectionState newState); |
127 | 129 |
128 // Caled when the state of |connection| started on this frame has changed to | 130 // Caled when the state of |connection| started on this frame has changed to |
129 // CLOSED. | 131 // CLOSED. |
130 OnConnectionClosed(PresentationSessionInfo connection, | 132 OnConnectionClosed(PresentationSessionInfo connection, |
131 PresentationConnectionCloseReason reason, | 133 PresentationConnectionCloseReason reason, |
132 string message); | 134 string message); |
133 | 135 |
134 // See PresentationService::ListenForSessionMessages. | 136 // See PresentationService::ListenForSessionMessages. |
135 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo, | 137 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo, |
136 array<SessionMessage> messages); | 138 array<SessionMessage> messages); |
137 | 139 |
138 // See PresentationService::SetDefaultPresentationURL. | 140 // See PresentationService::SetDefaultPresentationURL. |
139 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo); | 141 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo); |
140 }; | 142 }; |
OLD | NEW |