Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: third_party/WebKit/public/platform/modules/presentation/presentation.mojom

Issue 2379703002: [Presentation API] (alternative) 1-UA: send message between controller and receiver page (Closed)
Patch Set: rebase with master and resolve merge conflicts Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // TODO(crbug.com/647290): Rename "Session" to "Connection" 5 // TODO(crbug.com/647290): Rename "Session" to "Connection"
6 6
7 module blink.mojom; 7 module blink.mojom;
8 8
9 import "url/mojo/url.mojom"; 9 import "url/mojo/url.mojom";
10 10
11 struct PresentationSessionInfo { 11 struct PresentationSessionInfo {
12 url.mojom.Url url; 12 url.mojom.Url url;
13 string id; 13 string id;
14 bool is_offscreen_presentation;
mark a. foltz 2016/10/21 00:53:03 Or just is_offscreen? Since it's part of Presenta
zhaobin 2016/10/22 02:44:14 Done.
14 }; 15 };
15 16
16 enum PresentationConnectionState { 17 enum PresentationConnectionState {
17 CONNECTING, 18 CONNECTING,
18 CONNECTED, 19 CONNECTED,
19 CLOSED, 20 CLOSED,
20 TERMINATED 21 TERMINATED
21 }; 22 };
22 23
23 enum PresentationConnectionCloseReason { 24 enum PresentationConnectionCloseReason {
(...skipping 21 matching lines...) Expand all
45 }; 46 };
46 47
47 struct SessionMessage { 48 struct SessionMessage {
48 PresentationMessageType type; 49 PresentationMessageType type;
49 // Used when message type is TEXT. 50 // Used when message type is TEXT.
50 string? message; 51 string? message;
51 // Used when message type is ARRAY_BUFFER or BLOB. 52 // Used when message type is ARRAY_BUFFER or BLOB.
52 array<uint8>? data; 53 array<uint8>? data;
53 }; 54 };
54 55
56 interface PresentationConnection {
mark a. foltz 2016/10/21 00:53:03 Can you add a TODO to migrate SendSessionMessage f
zhaobin 2016/10/22 02:44:14 Done.
57 // Called to set the PresentationConnection that is the destination for
58 // messages sent and the source of messages received by this connection.
59 SetTargetConnection(PresentationConnection connection);
60
61 // Called when a message is sent by the target connection.
62 OnConnectionMessageReceived(SessionMessage message);
mark a. foltz 2016/10/21 00:53:03 Or just OnMessage() (similar to the Presentation A
zhaobin 2016/10/22 02:44:14 Done.
63 };
64
55 interface PresentationService { 65 interface PresentationService {
56 // Sets the PresentationServiceClient. 66 // Sets the PresentationServiceClient.
57 SetClient(PresentationServiceClient client); 67 SetClient(PresentationServiceClient client);
58 68
mark a. foltz 2016/10/21 00:53:04 Can you add a comment block starting here that the
zhaobin 2016/10/22 02:44:14 Done.
59 // Called when the frame sets or changes the default presentation URLs. 69 // Called when the frame sets or changes the default presentation URLs.
60 // When the default presentation is started on this frame, 70 // When the default presentation is started on this frame,
61 // PresentationServiceClient::OnDefaultSessionStarted will be invoked. 71 // PresentationServiceClient::OnDefaultSessionStarted will be invoked.
62 SetDefaultPresentationUrls(array<url.mojom.Url> presentation_urls); 72 SetDefaultPresentationUrls(array<url.mojom.Url> presentation_urls);
63 73
64 // Starts listening for screen availability for presentation of 74 // Starts listening for screen availability for presentation of
65 // |availability_url|. Availability results will be returned to the client via 75 // |availability_url|. Availability results will be returned to the client via
66 // PresentationServiceClient::OnScreenAvailabilityUpdated. 76 // PresentationServiceClient::OnScreenAvailabilityUpdated.
67 ListenForScreenAvailability(url.mojom.Url availability_url); 77 ListenForScreenAvailability(url.mojom.Url availability_url);
68 78
(...skipping 13 matching lines...) Expand all
82 // a new one. 92 // a new one.
83 StartSession(array<url.mojom.Url> presentation_urls) 93 StartSession(array<url.mojom.Url> presentation_urls)
84 => (PresentationSessionInfo? sessionInfo, PresentationError? error); 94 => (PresentationSessionInfo? sessionInfo, PresentationError? error);
85 95
86 // Called when joinSession() is called by the frame. The result callback 96 // Called when joinSession() is called by the frame. The result callback
87 // works the same as for the method above. JoinSession will join a known 97 // works the same as for the method above. JoinSession will join a known
88 // session (i.e. when the page navigates or the user opens another tab) 98 // session (i.e. when the page navigates or the user opens another tab)
89 // silently and without user action. 99 // silently and without user action.
90 JoinSession(array<url.mojom.Url> presentation_urls, string? presentation_id) 100 JoinSession(array<url.mojom.Url> presentation_urls, string? presentation_id)
91 => (PresentationSessionInfo? sessionInfo, PresentationError? error); 101 => (PresentationSessionInfo? sessionInfo, PresentationError? error);
92 102
mark a. foltz 2016/10/21 00:53:03 ... And end the comment block. The functions belo
zhaobin 2016/10/22 02:44:14 Done.
93 // Called when send() is called by the frame. The true in the 103 // Called when send() is called by the frame. The true in the
94 // result callback notifies that the service is ready for next message. 104 // result callback notifies that the service is ready for next message.
95 // The false in the result callback notifies the renderer to stop sending 105 // The false in the result callback notifies the renderer to stop sending
96 // the send requests and invalidate all pending requests. This occurs 106 // the send requests and invalidate all pending requests. This occurs
97 // for eg., when frame is deleted or navigated away. 107 // for eg., when frame is deleted or navigated away.
98 SendSessionMessage(PresentationSessionInfo sessionInfo, 108 SendSessionMessage(PresentationSessionInfo sessionInfo,
99 SessionMessage message_request) => (bool success); 109 SessionMessage message_request) => (bool success);
100 110
101 // Called when close() is called by the frame. 111 // Called when close() is called by the frame.
102 CloseConnection(url.mojom.Url presentation_url, string presentation_id); 112 CloseConnection(url.mojom.Url presentation_url, string presentation_id);
103 113
104 // Called when terminate() is called by the frame. 114 // Called when terminate() is called by the frame.
105 Terminate(url.mojom.Url presentation_url, string presentation_id); 115 Terminate(url.mojom.Url presentation_url, string presentation_id);
106 116
107 // Starts listening for messages for session with |sessionInfo|. 117 // Starts listening for messages for session with |sessionInfo|.
108 // Messages will be received in 118 // Messages will be received in
109 // PresentationServiceClient::OnSessionMessagesReceived. 119 // PresentationServiceClient::OnSessionMessagesReceived.
110 // This is called after a presentation session is created. 120 // This is called after a presentation session is created.
111 ListenForSessionMessages(PresentationSessionInfo sessionInfo); 121 ListenForSessionMessages(PresentationSessionInfo sessionInfo);
122
123 SetPresentationConnection(PresentationSessionInfo sessionInfo,
mark a. foltz 2016/10/21 00:53:03 Document this function. Is it called on the contr
zhaobin 2016/10/22 02:44:14 Done.
124 PresentationConnection connection);
112 }; 125 };
113 126
114 interface PresentationServiceClient { 127 interface PresentationServiceClient {
115 // Called when the client tries to listen for screen availability changes for 128 // Called when the client tries to listen for screen availability changes for
mark a. foltz 2016/10/21 00:53:03 Can you add a block comment above here that these
zhaobin 2016/10/22 02:44:14 Done.
116 // presentation of |url| but it is not supported by the device or underlying 129 // presentation of |url| but it is not supported by the device or underlying
117 // platform. This can also be called if the device is currently in a mode 130 // platform. This can also be called if the device is currently in a mode
118 // where it can't do screen discoveries (eg. low battery). 131 // where it can't do screen discoveries (eg. low battery).
119 OnScreenAvailabilityNotSupported(url.mojom.Url url); 132 OnScreenAvailabilityNotSupported(url.mojom.Url url);
120 133
121 // Called when the client is listening for screen availability for 134 // Called when the client is listening for screen availability for
122 // presentation of |url| and the state changes. When the client starts to 135 // presentation of |url| and the state changes. When the client starts to
123 // listen for screen availability, this method will always be called to give 136 // listen for screen availability, this method will always be called to give
124 // the current known state. It will then be called to notify of state updates. 137 // the current known state. It will then be called to notify of state updates.
125 OnScreenAvailabilityUpdated(url.mojom.Url url, bool available); 138 OnScreenAvailabilityUpdated(url.mojom.Url url, bool available);
126 139
mark a. foltz 2016/10/21 00:53:03 And end the comment as the functions below except
zhaobin 2016/10/22 02:44:14 Done.
127 // Called when the state of PresentationConnection |connection| started on 140 // Called when the state of PresentationConnection |connection| started on
128 // this frame has changed to |newState|. 141 // this frame has changed to |newState|.
129 OnConnectionStateChanged(PresentationSessionInfo connection, 142 OnConnectionStateChanged(PresentationSessionInfo connection,
130 PresentationConnectionState newState); 143 PresentationConnectionState newState);
131 144
132 // Caled when the state of |connection| started on this frame has changed to 145 // Caled when the state of |connection| started on this frame has changed to
133 // CLOSED. 146 // CLOSED.
134 OnConnectionClosed(PresentationSessionInfo connection, 147 OnConnectionClosed(PresentationSessionInfo connection,
135 PresentationConnectionCloseReason reason, 148 PresentationConnectionCloseReason reason,
136 string message); 149 string message);
137 150
138 // See PresentationService::ListenForSessionMessages. 151 // See PresentationService::ListenForSessionMessages.
139 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo, 152 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo,
140 array<SessionMessage> messages); 153 array<SessionMessage> messages);
141 154
142 // See PresentationService::SetDefaultPresentationURL. 155 // See PresentationService::SetDefaultPresentationURL.
143 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo); 156 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo);
mark a. foltz 2016/10/21 00:53:03 Can this be moved above with the other controller-
zhaobin 2016/10/22 02:44:14 Done.
144 157
145 // See PresentationService::ListeningForReceiverPageRendered. 158 // Called on a presentation receiver when the first presentation connection is
146 OnReceiverConnectionAvailable(PresentationSessionInfo sessionInfo); 159 // available from the controlling page.
160 OnReceiverConnectionAvailable(PresentationSessionInfo sessionInfo,
mark a. foltz 2016/10/21 00:53:03 Maybe this should be OnFirstConnectionAvailable?
zhaobin 2016/10/22 02:44:14 It is called for all connections to the receiver p
161 PresentationConnection connection);
147 }; 162 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698