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

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

Issue 2477573002: [Presentation API] (3rd) (1-UA) Split PresentationServiceDelegateImpl(PSDImpl) (Closed)
Patch Set: fix windows compile error Created 3 years, 11 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
« no previous file with comments | « content/renderer/presentation/presentation_dispatcher_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 struct ConnectionMessage { 46 struct ConnectionMessage {
47 PresentationMessageType type; 47 PresentationMessageType type;
48 // Used when message type is TEXT. 48 // Used when message type is TEXT.
49 string? message; 49 string? message;
50 // Used when message type is BINARY. 50 // Used when message type is BINARY.
51 // TODO(lethalantidote): Make this a mojo union. 51 // TODO(lethalantidote): Make this a mojo union.
52 // See https://crbug.com/632623. 52 // See https://crbug.com/632623.
53 array<uint8>? data; 53 array<uint8>? data;
54 }; 54 };
55 55
56 interface PresentationConnection {
57 // TODO(zhaobin): migrate SendConnectionMessage from PresentationService =>
58 // PresentationConnection.Send(). http://crbug.com/658474
59
60 // Called when a message is sent by the target connection.
61 OnMessage(ConnectionMessage message) => (bool success);
62
63 // Called when target connection notifies connection state change.
64 DidChangeState(PresentationConnectionState state);
65 };
66
56 interface PresentationService { 67 interface PresentationService {
57 // Sets the PresentationServiceClient. 68 // Sets the PresentationServiceClient.
58 SetClient(PresentationServiceClient client); 69 SetClient(PresentationServiceClient client);
59 70
71 ///////////// Functions here are for the controller part of the API. /////////
72
60 // Called when the frame sets or changes the default presentation URLs. 73 // Called when the frame sets or changes the default presentation URLs.
61 // When the default presentation is started on this frame, 74 // When the default presentation is started on this frame,
62 // PresentationServiceClient::OnDefaultSessionStarted will be invoked. 75 // PresentationServiceClient::OnDefaultSessionStarted will be invoked.
63 SetDefaultPresentationUrls(array<url.mojom.Url> presentation_urls); 76 SetDefaultPresentationUrls(array<url.mojom.Url> presentation_urls);
64 77
65 // Starts listening for screen availability for presentation of 78 // Starts listening for screen availability for presentation of
66 // |availability_url|. Availability results will be returned to the client via 79 // |availability_url|. Availability results will be returned to the client via
67 // PresentationServiceClient::OnScreenAvailabilityUpdated. 80 // PresentationServiceClient::OnScreenAvailabilityUpdated.
68 ListenForScreenAvailability(url.mojom.Url availability_url); 81 ListenForScreenAvailability(url.mojom.Url availability_url);
69 82
(...skipping 14 matching lines...) Expand all
84 StartSession(array<url.mojom.Url> presentation_urls) 97 StartSession(array<url.mojom.Url> presentation_urls)
85 => (PresentationSessionInfo? sessionInfo, PresentationError? error); 98 => (PresentationSessionInfo? sessionInfo, PresentationError? error);
86 99
87 // Called when joinSession() is called by the frame. The result callback 100 // Called when joinSession() is called by the frame. The result callback
88 // works the same as for the method above. JoinSession will join a known 101 // works the same as for the method above. JoinSession will join a known
89 // session (i.e. when the page navigates or the user opens another tab) 102 // session (i.e. when the page navigates or the user opens another tab)
90 // silently and without user action. 103 // silently and without user action.
91 JoinSession(array<url.mojom.Url> presentation_urls, string? presentation_id) 104 JoinSession(array<url.mojom.Url> presentation_urls, string? presentation_id)
92 => (PresentationSessionInfo? sessionInfo, PresentationError? error); 105 => (PresentationSessionInfo? sessionInfo, PresentationError? error);
93 106
107 // Called in StartSession's callback function for offscreen presentation only.
108 // It passes in controlling frame's PresentationConnection and
109 // PresentationConnectionRequest to PresentationService.
110 SetPresentationConnection(
111 PresentationSessionInfo sessionInfo,
112 PresentationConnection controller_connection_ptr,
113 PresentationConnection& receiver_connection_request);
114
115 //////////////////////////////////////////////////////////////////////////////
116
94 // Called when send() is called by the frame. The true in the 117 // Called when send() is called by the frame. The true in the
95 // result callback notifies that the service is ready for next message. 118 // result callback notifies that the service is ready for next message.
96 // The false in the result callback notifies the renderer to stop sending 119 // The false in the result callback notifies the renderer to stop sending
97 // the send requests and invalidate all pending requests. This occurs 120 // the send requests and invalidate all pending requests. This occurs
98 // for eg., when frame is deleted or navigated away. 121 // for eg., when frame is deleted or navigated away.
99 SendConnectionMessage(PresentationSessionInfo sessionInfo, 122 SendConnectionMessage(PresentationSessionInfo sessionInfo,
100 ConnectionMessage message_request) => (bool success); 123 ConnectionMessage message_request) => (bool success);
101 124
102 // Called when close() is called by the frame. 125 // Called when close() is called by the frame.
103 CloseConnection(url.mojom.Url presentation_url, string presentation_id); 126 CloseConnection(url.mojom.Url presentation_url, string presentation_id);
104 127
105 // Called when terminate() is called by the frame. 128 // Called when terminate() is called by the frame.
106 Terminate(url.mojom.Url presentation_url, string presentation_id); 129 Terminate(url.mojom.Url presentation_url, string presentation_id);
107 130
108 // Starts listening for messages for session with |sessionInfo|. 131 // Starts listening for messages for session with |sessionInfo|.
109 // Messages will be received in 132 // Messages will be received in
110 // PresentationServiceClient::OnConnectionMessagesReceived. 133 // PresentationServiceClient::OnConnectionMessagesReceived.
111 // This is called after a presentation session is created. 134 // This is called after a presentation session is created.
112 ListenForConnectionMessages(PresentationSessionInfo sessionInfo); 135 ListenForConnectionMessages(PresentationSessionInfo sessionInfo);
113 }; 136 };
114 137
115 interface PresentationServiceClient { 138 interface PresentationServiceClient {
139
140 ////////////Functions here are called only on the controlling page.///////////
141
116 // Called when the client tries to listen for screen availability changes for 142 // Called when the client tries to listen for screen availability changes for
117 // presentation of |url| but it is not supported by the device or underlying 143 // presentation of |url| but it is not supported by the device or underlying
118 // platform. This can also be called if the device is currently in a mode 144 // platform. This can also be called if the device is currently in a mode
119 // where it can't do screen discoveries (eg. low battery). 145 // where it can't do screen discoveries (eg. low battery).
120 OnScreenAvailabilityNotSupported(url.mojom.Url url); 146 OnScreenAvailabilityNotSupported(url.mojom.Url url);
121 147
122 // Called when the client is listening for screen availability for 148 // Called when the client is listening for screen availability for
123 // presentation of |url| and the state changes. When the client starts to 149 // presentation of |url| and the state changes. When the client starts to
124 // listen for screen availability, this method will always be called to give 150 // listen for screen availability, this method will always be called to give
125 // the current known state. It will then be called to notify of state updates. 151 // the current known state. It will then be called to notify of state updates.
126 OnScreenAvailabilityUpdated(url.mojom.Url url, bool available); 152 OnScreenAvailabilityUpdated(url.mojom.Url url, bool available);
127 153
154 // See PresentationService::SetDefaultPresentationURL.
155 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo);
156
157 //////////////////////////////////////////////////////////////////////////////
158
128 // Called when the state of PresentationConnection |connection| started on 159 // Called when the state of PresentationConnection |connection| started on
129 // this frame has changed to |newState|. 160 // this frame has changed to |newState|.
130 OnConnectionStateChanged(PresentationSessionInfo connection, 161 OnConnectionStateChanged(PresentationSessionInfo connection,
131 PresentationConnectionState newState); 162 PresentationConnectionState newState);
132 163
133 // Caled when the state of |connection| started on this frame has changed to 164 // Caled when the state of |connection| started on this frame has changed to
134 // CLOSED. 165 // CLOSED.
135 OnConnectionClosed(PresentationSessionInfo connection, 166 OnConnectionClosed(PresentationSessionInfo connection,
136 PresentationConnectionCloseReason reason, 167 PresentationConnectionCloseReason reason,
137 string message); 168 string message);
138 169
139 // See PresentationService::ListenForConnectionMessages. 170 // See PresentationService::ListenForConnectionMessages.
140 OnConnectionMessagesReceived(PresentationSessionInfo sessionInfo, 171 OnConnectionMessagesReceived(PresentationSessionInfo sessionInfo,
141 array<ConnectionMessage> messages); 172 array<ConnectionMessage> messages);
142 173
143 // See PresentationService::SetDefaultPresentationURL. 174 // Called on a presentation receiver when presentation connection is available
144 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo); 175 // from the controlling page.
145 176 OnReceiverConnectionAvailable(
146 // See PresentationService::OnReceiverConnectionAvailable. 177 PresentationSessionInfo sessionInfo,
147 OnReceiverConnectionAvailable(PresentationSessionInfo sessionInfo); 178 PresentationConnection controller_connection_ptr,
179 PresentationConnection& receiver_connection_request);
148 }; 180 };
OLDNEW
« no previous file with comments | « content/renderer/presentation/presentation_dispatcher_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698