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

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: resolve code review comments from jam 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 }; 45 };
46 46
47 struct SessionMessage { 47 struct SessionMessage {
48 PresentationMessageType type; 48 PresentationMessageType type;
49 // Used when message type is TEXT. 49 // Used when message type is TEXT.
50 string? message; 50 string? message;
51 // Used when message type is ARRAY_BUFFER or BLOB. 51 // Used when message type is ARRAY_BUFFER or BLOB.
52 array<uint8>? data; 52 array<uint8>? data;
53 }; 53 };
54 54
55 interface PresentationConnection {
56 // TODO(zhaobin): migrate SendSessionMessage from PresentationService =>
57 // PresentationConnection.Send(). http://crbug.com/658474
58
59 // Called to set the PresentationConnection that is the destination for
60 // messages sent and the source of messages received by this connection.
61 SetTargetConnection(PresentationConnection connection);
62
63 // Called when a message is sent by the target connection.
64 OnMessage(SessionMessage message);
65 };
66
55 interface PresentationService { 67 interface PresentationService {
56 // Sets the PresentationServiceClient. 68 // Sets the PresentationServiceClient.
57 SetClient(PresentationServiceClient client); 69 SetClient(PresentationServiceClient client);
58 70
71 ///////////// Functions here are for the controller part of the API. /////////
72
59 // Called when the frame sets or changes the default presentation URLs. 73 // Called when the frame sets or changes the default presentation URLs.
60 // When the default presentation is started on this frame, 74 // When the default presentation is started on this frame,
61 // PresentationServiceClient::OnDefaultSessionStarted will be invoked. 75 // PresentationServiceClient::OnDefaultSessionStarted will be invoked.
62 SetDefaultPresentationUrls(array<url.mojom.Url> presentation_urls); 76 SetDefaultPresentationUrls(array<url.mojom.Url> presentation_urls);
63 77
64 // Starts listening for screen availability for presentation of 78 // Starts listening for screen availability for presentation of
65 // |availability_url|. Availability results will be returned to the client via 79 // |availability_url|. Availability results will be returned to the client via
66 // PresentationServiceClient::OnScreenAvailabilityUpdated. 80 // PresentationServiceClient::OnScreenAvailabilityUpdated.
67 ListenForScreenAvailability(url.mojom.Url availability_url); 81 ListenForScreenAvailability(url.mojom.Url availability_url);
68 82
(...skipping 14 matching lines...) Expand all
83 StartSession(array<url.mojom.Url> presentation_urls) 97 StartSession(array<url.mojom.Url> presentation_urls)
84 => (PresentationSessionInfo? sessionInfo, PresentationError? error); 98 => (PresentationSessionInfo? sessionInfo, PresentationError? error);
85 99
86 // Called when joinSession() is called by the frame. The result callback 100 // 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 101 // 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) 102 // session (i.e. when the page navigates or the user opens another tab)
89 // silently and without user action. 103 // silently and without user action.
90 JoinSession(array<url.mojom.Url> presentation_urls, string? presentation_id) 104 JoinSession(array<url.mojom.Url> presentation_urls, string? presentation_id)
91 => (PresentationSessionInfo? sessionInfo, PresentationError? error); 105 => (PresentationSessionInfo? sessionInfo, PresentationError? error);
92 106
107 // Called in StartSession's callback function for offscreen presentation only.
108 // It passes in controlling frame's PresentationConnection to
109 // PresentationService.
110 SetPresentationConnection(PresentationSessionInfo sessionInfo,
111 PresentationConnection connection);
dcheng 2017/01/06 11:54:22 As far as I can tell, the goal is a 1:1 relationsh
zhaobin 2017/01/10 01:39:17 Done.
mark a. foltz 2017/01/10 23:05:33 I agree it would be slightly better to have an API
dcheng 2017/01/11 09:22:18 I'm not familiar enough with how the presentation
112
113 //////////////////////////////////////////////////////////////////////////////
114
93 // Called when send() is called by the frame. The true in the 115 // Called when send() is called by the frame. The true in the
94 // result callback notifies that the service is ready for next message. 116 // result callback notifies that the service is ready for next message.
95 // The false in the result callback notifies the renderer to stop sending 117 // The false in the result callback notifies the renderer to stop sending
96 // the send requests and invalidate all pending requests. This occurs 118 // the send requests and invalidate all pending requests. This occurs
97 // for eg., when frame is deleted or navigated away. 119 // for eg., when frame is deleted or navigated away.
98 SendSessionMessage(PresentationSessionInfo sessionInfo, 120 SendSessionMessage(PresentationSessionInfo sessionInfo,
99 SessionMessage message_request) => (bool success); 121 SessionMessage message_request) => (bool success);
100 122
101 // Called when close() is called by the frame. 123 // Called when close() is called by the frame.
102 CloseConnection(url.mojom.Url presentation_url, string presentation_id); 124 CloseConnection(url.mojom.Url presentation_url, string presentation_id);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // See PresentationService::ListenForSessionMessages. 160 // See PresentationService::ListenForSessionMessages.
139 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo, 161 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo,
140 array<SessionMessage> messages); 162 array<SessionMessage> messages);
141 163
142 // See PresentationService::SetDefaultPresentationURL. 164 // See PresentationService::SetDefaultPresentationURL.
143 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo); 165 OnDefaultSessionStarted(PresentationSessionInfo sessionInfo);
144 166
145 // See PresentationService::OnReceiverConnectionAvailable. 167 // See PresentationService::OnReceiverConnectionAvailable.
146 OnReceiverConnectionAvailable(PresentationSessionInfo sessionInfo); 168 OnReceiverConnectionAvailable(PresentationSessionInfo sessionInfo);
147 }; 169 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698