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

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

Issue 2562603002: Updates SessionMessage to ConnectionMessage. (Closed)
Patch Set: Created 4 years 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
(...skipping 22 matching lines...) Expand all
33 UNKNOWN, 33 UNKNOWN,
34 }; 34 };
35 35
36 struct PresentationError { 36 struct PresentationError {
37 PresentationErrorType error_type; 37 PresentationErrorType error_type;
38 string message; 38 string message;
39 }; 39 };
40 40
41 enum PresentationMessageType { 41 enum PresentationMessageType {
42 TEXT, 42 TEXT,
43 ARRAY_BUFFER, 43 BINARY,
44 BLOB,
45 }; 44 };
46 45
47 struct SessionMessage { 46 struct ConnectionMessage {
48 PresentationMessageType type; 47 PresentationMessageType type;
49 // Used when message type is TEXT. 48 // Used when message type is TEXT.
50 string? message; 49 string? message;
51 // Used when message type is ARRAY_BUFFER or BLOB. 50 // Used when message type is BINARY.
dcheng 2016/12/13 08:25:14 Please add a TODO to make this a mojo union (I'd s
CJ 2016/12/13 22:05:35 Done. Ah is this related to your other comment?
52 array<uint8>? data; 51 array<uint8>? data;
53 }; 52 };
54 53
55 interface PresentationService { 54 interface PresentationService {
56 // Sets the PresentationServiceClient. 55 // Sets the PresentationServiceClient.
57 SetClient(PresentationServiceClient client); 56 SetClient(PresentationServiceClient client);
58 57
59 // Called when the frame sets or changes the default presentation URLs. 58 // Called when the frame sets or changes the default presentation URLs.
60 // When the default presentation is started on this frame, 59 // When the default presentation is started on this frame,
61 // PresentationServiceClient::OnDefaultSessionStarted will be invoked. 60 // PresentationServiceClient::OnDefaultSessionStarted will be invoked.
(...skipping 26 matching lines...) Expand all
88 // session (i.e. when the page navigates or the user opens another tab) 87 // session (i.e. when the page navigates or the user opens another tab)
89 // silently and without user action. 88 // silently and without user action.
90 JoinSession(array<url.mojom.Url> presentation_urls, string? presentation_id) 89 JoinSession(array<url.mojom.Url> presentation_urls, string? presentation_id)
91 => (PresentationSessionInfo? sessionInfo, PresentationError? error); 90 => (PresentationSessionInfo? sessionInfo, PresentationError? error);
92 91
93 // Called when send() is called by the frame. The true in the 92 // Called when send() is called by the frame. The true in the
94 // result callback notifies that the service is ready for next message. 93 // result callback notifies that the service is ready for next message.
95 // The false in the result callback notifies the renderer to stop sending 94 // The false in the result callback notifies the renderer to stop sending
96 // the send requests and invalidate all pending requests. This occurs 95 // the send requests and invalidate all pending requests. This occurs
97 // for eg., when frame is deleted or navigated away. 96 // for eg., when frame is deleted or navigated away.
98 SendSessionMessage(PresentationSessionInfo sessionInfo, 97 SendConnectionMessage(PresentationSessionInfo sessionInfo,
99 SessionMessage message_request) => (bool success); 98 ConnectionMessage message_request) => (bool success);
100 99
101 // Called when close() is called by the frame. 100 // Called when close() is called by the frame.
102 CloseConnection(url.mojom.Url presentation_url, string presentation_id); 101 CloseConnection(url.mojom.Url presentation_url, string presentation_id);
103 102
104 // Called when terminate() is called by the frame. 103 // Called when terminate() is called by the frame.
105 Terminate(url.mojom.Url presentation_url, string presentation_id); 104 Terminate(url.mojom.Url presentation_url, string presentation_id);
106 105
107 // Starts listening for messages for session with |sessionInfo|. 106 // Starts listening for messages for session with |sessionInfo|.
108 // Messages will be received in 107 // Messages will be received in
109 // PresentationServiceClient::OnSessionMessagesReceived. 108 // PresentationServiceClient::OnConnectionMessagesReceived.
110 // This is called after a presentation session is created. 109 // This is called after a presentation session is created.
111 ListenForSessionMessages(PresentationSessionInfo sessionInfo); 110 ListenForConnectionMessages(PresentationSessionInfo sessionInfo);
112 }; 111 };
113 112
114 interface PresentationServiceClient { 113 interface PresentationServiceClient {
115 // Called when the client tries to listen for screen availability changes for 114 // Called when the client tries to listen for screen availability changes for
116 // presentation of |url| but it is not supported by the device or underlying 115 // 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 116 // 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). 117 // where it can't do screen discoveries (eg. low battery).
119 OnScreenAvailabilityNotSupported(url.mojom.Url url); 118 OnScreenAvailabilityNotSupported(url.mojom.Url url);
120 119
121 // Called when the client is listening for screen availability for 120 // Called when the client is listening for screen availability for
122 // presentation of |url| and the state changes. When the client starts to 121 // 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 122 // 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. 123 // the current known state. It will then be called to notify of state updates.
125 OnScreenAvailabilityUpdated(url.mojom.Url url, bool available); 124 OnScreenAvailabilityUpdated(url.mojom.Url url, bool available);
126 125
127 // Called when the state of PresentationConnection |connection| started on 126 // Called when the state of PresentationConnection |connection| started on
128 // this frame has changed to |newState|. 127 // this frame has changed to |newState|.
129 OnConnectionStateChanged(PresentationSessionInfo connection, 128 OnConnectionStateChanged(PresentationSessionInfo connection,
130 PresentationConnectionState newState); 129 PresentationConnectionState newState);
131 130
132 // Caled when the state of |connection| started on this frame has changed to 131 // Caled when the state of |connection| started on this frame has changed to
133 // CLOSED. 132 // CLOSED.
134 OnConnectionClosed(PresentationSessionInfo connection, 133 OnConnectionClosed(PresentationSessionInfo connection,
135 PresentationConnectionCloseReason reason, 134 PresentationConnectionCloseReason reason,
136 string message); 135 string message);
137 136
138 // See PresentationService::ListenForSessionMessages. 137 // See PresentationService::ListenForConnectionMessages.
139 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo, 138 OnConnectionMessagesReceived(PresentationSessionInfo sessionInfo,
140 array<SessionMessage> messages); 139 array<ConnectionMessage> messages);
141 140
142 // See PresentationService::SetDefaultPresentationURL. 141 // See PresentationService::SetDefaultPresentationURL.
143 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo); 142 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo);
144 143
145 // See PresentationService::ListeningForReceiverPageRendered. 144 // See PresentationService::ListeningForReceiverPageRendered.
146 OnReceiverConnectionAvailable(PresentationSessionInfo sessionInfo); 145 OnReceiverConnectionAvailable(PresentationSessionInfo sessionInfo);
147 }; 146 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698