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

Side by Side Diff: content/common/presentation/presentation_service.mojom

Issue 1259073004: [Presentation API] Change ListenForSessionMessages API to client-style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comments Created 5 years, 4 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 module presentation; 5 module presentation;
6 6
7 struct PresentationSessionInfo { 7 struct PresentationSessionInfo {
8 string url; 8 string url;
9 string id; 9 string id;
10 }; 10 };
(...skipping 15 matching lines...) Expand all
26 string message; 26 string message;
27 }; 27 };
28 28
29 enum PresentationMessageType { 29 enum PresentationMessageType {
30 TEXT, 30 TEXT,
31 ARRAY_BUFFER, 31 ARRAY_BUFFER,
32 BLOB, 32 BLOB,
33 }; 33 };
34 34
35 struct SessionMessage { 35 struct SessionMessage {
36 string presentation_url;
37 string presentation_id;
38 PresentationMessageType type; 36 PresentationMessageType type;
39 // Used when message type is TEXT. 37 // Used when message type is TEXT.
40 string? message; 38 string? message;
41 // Used when message type is ARRAY_BUFFER or BLOB. 39 // Used when message type is ARRAY_BUFFER or BLOB.
42 array<uint8>? data; 40 array<uint8>? data;
43 }; 41 };
44 42
45 interface PresentationService { 43 interface PresentationService {
46 // Called when the frame sets or changes the default presentation URL. 44 // Called when the frame sets or changes the default presentation URL.
47 SetDefaultPresentationURL(string url); 45 SetDefaultPresentationURL(string url);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // session (i.e. when the page navigates or the user opens another tab) 81 // session (i.e. when the page navigates or the user opens another tab)
84 // silently and without user action. 82 // silently and without user action.
85 JoinSession(string presentation_url, string? presentation_id) 83 JoinSession(string presentation_url, string? presentation_id)
86 => (PresentationSessionInfo? sessionInfo, PresentationError? error); 84 => (PresentationSessionInfo? sessionInfo, PresentationError? error);
87 85
88 // Called when send() is called by the frame. The true in the 86 // Called when send() is called by the frame. The true in the
89 // result callback notifies that the service is ready for next message. 87 // result callback notifies that the service is ready for next message.
90 // The false in the result callback notifies the renderer to stop sending 88 // The false in the result callback notifies the renderer to stop sending
91 // the send requests and invalidate all pending requests. This occurs 89 // the send requests and invalidate all pending requests. This occurs
92 // for eg., when frame is deleted or navigated away. 90 // for eg., when frame is deleted or navigated away.
93 SendSessionMessage(SessionMessage message_request) => (bool success); 91 SendSessionMessage(PresentationSessionInfo sessionInfo, SessionMessage message _request) => (bool success);
94 92
95 // Called when closeSession() is called by the frame. 93 // Called when closeSession() is called by the frame.
96 CloseSession(string presentation_url, string presentation_id); 94 CloseSession(string presentation_url, string presentation_id);
97 95
98 // Starts listening for state changes for sessions created on this frame. 96 // Starts listening for state changes for sessions created on this frame.
99 // When state change occurs, PresentationServiceClient::OnSessionStateChanged 97 // When state change occurs, PresentationServiceClient::OnSessionStateChanged
100 // will be invoked with the session and its new state. 98 // will be invoked with the session and its new state.
99 // This is called after a presentation session is created.
101 ListenForSessionStateChange(); 100 ListenForSessionStateChange();
102 101
103 // Called when the frame is ready to process the next batch of messages. 102 // Starts listening for messages for session with |sessionInfo|.
104 // When the callback carries null messages, there is an error 103 // Messages will be received in
105 // at the presentation service side. 104 // PresentationServiceClient::OnSessionMessagesReceived.
106 ListenForSessionMessages() 105 // This is called after a presentation session is created.
107 => (array<SessionMessage>? messages); 106 ListenForSessionMessages(PresentationSessionInfo sessionInfo);
108 }; 107 };
109 108
110 interface PresentationServiceClient { 109 interface PresentationServiceClient {
111 // Called when the client tries to listen for screen availability changes but 110 // Called when the client tries to listen for screen availability changes but
112 // it is not supported by the device or underlying platform. This can also be 111 // it is not supported by the device or underlying platform. This can also be
113 // called if the device is currently in a mode where it can't do screen 112 // called if the device is currently in a mode where it can't do screen
114 // discoveries (eg. low battery). 113 // discoveries (eg. low battery).
115 OnScreenAvailabilityNotSupported(); 114 OnScreenAvailabilityNotSupported();
116 115
117 // Called when the client is listening for screen availability and the state 116 // Called when the client is listening for screen availability and the state
118 // changes. When the client starts to listen for screen availability, this 117 // changes. When the client starts to listen for screen availability, this
119 // method will always be called to give the current known state. It will then 118 // method will always be called to give the current known state. It will then
120 // be called to notify of state updates. 119 // be called to notify of state updates.
121 OnScreenAvailabilityUpdated(bool available); 120 OnScreenAvailabilityUpdated(bool available);
122 121
123 // See PresentationService::ListenForSessionStateChange. 122 // See PresentationService::ListenForSessionStateChange.
124 OnSessionStateChanged(PresentationSessionInfo sessionInfo, 123 OnSessionStateChanged(PresentationSessionInfo sessionInfo,
125 PresentationSessionState newState); 124 PresentationSessionState newState);
125
126 // See PresentationService::ListenForSessionMessages.
127 OnSessionMessagesReceived(PresentationSessionInfo sessionInfo, array<SessionMe ssage> messages);
126 }; 128 };
OLDNEW
« no previous file with comments | « content/browser/presentation/presentation_type_converters.h ('k') | content/public/browser/presentation_service_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698