OLD | NEW |
---|---|
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 #ifndef CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/public/browser/presentation_connection_message.h" | |
15 #include "content/public/browser/presentation_session.h" | 16 #include "content/public/browser/presentation_session.h" |
16 #include "content/public/browser/presentation_session_message.h" | |
17 | 17 |
18 class GURL; | 18 class GURL; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 class PresentationScreenAvailabilityListener; | 22 class PresentationScreenAvailabilityListener; |
23 | 23 |
24 using PresentationSessionStartedCallback = | 24 using PresentationSessionStartedCallback = |
25 base::Callback<void(const PresentationSessionInfo&)>; | 25 base::Callback<void(const PresentationSessionInfo&)>; |
26 using PresentationSessionErrorCallback = | 26 using PresentationSessionErrorCallback = |
27 base::Callback<void(const PresentationError&)>; | 27 base::Callback<void(const PresentationError&)>; |
28 | 28 |
29 // Param #0: a vector of messages that are received. | 29 // Param #0: a vector of messages that are received. |
30 // Param #1: tells the callback handler that it may reuse strings or buffers | 30 // Param #1: tells the callback handler that it may reuse strings or buffers |
31 // in the messages contained within param #0. | 31 // in the messages contained within param #0. |
32 using PresentationSessionMessageCallback = base::Callback< | 32 using PresentationConnectionMessageCallback = base::Callback< |
33 void(const ScopedVector<content::PresentationSessionMessage>&, bool)>; | 33 void(const ScopedVector<content::PresentationConnectionMessage>&, bool)>; |
Avi (use Gerrit)
2016/12/13 02:23:53
Can you follow up with a removal of ScopedVector i
CJ
2016/12/13 22:05:35
Done.
| |
34 | 34 |
35 struct PresentationConnectionStateChangeInfo { | 35 struct PresentationConnectionStateChangeInfo { |
36 explicit PresentationConnectionStateChangeInfo( | 36 explicit PresentationConnectionStateChangeInfo( |
37 PresentationConnectionState state) | 37 PresentationConnectionState state) |
38 : state(state), | 38 : state(state), |
39 close_reason(PRESENTATION_CONNECTION_CLOSE_REASON_CONNECTION_ERROR) {} | 39 close_reason(PRESENTATION_CONNECTION_CLOSE_REASON_CONNECTION_ERROR) {} |
40 ~PresentationConnectionStateChangeInfo() = default; | 40 ~PresentationConnectionStateChangeInfo() = default; |
41 | 41 |
42 PresentationConnectionState state; | 42 PresentationConnectionState state; |
43 | 43 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 // |presentation_id|: The ID of the presentation to terminate. | 166 // |presentation_id|: The ID of the presentation to terminate. |
167 virtual void Terminate(int render_process_id, | 167 virtual void Terminate(int render_process_id, |
168 int render_frame_id, | 168 int render_frame_id, |
169 const std::string& presentation_id) = 0; | 169 const std::string& presentation_id) = 0; |
170 | 170 |
171 // Listens for messages for a presentation session. | 171 // Listens for messages for a presentation session. |
172 // |render_process_id|, |render_frame_id|: ID for originating frame. | 172 // |render_process_id|, |render_frame_id|: ID for originating frame. |
173 // |session|: URL and ID of presentation session to listen for messages. | 173 // |session|: URL and ID of presentation session to listen for messages. |
174 // |message_cb|: Invoked with a non-empty list of messages whenever there are | 174 // |message_cb|: Invoked with a non-empty list of messages whenever there are |
175 // messages. | 175 // messages. |
176 virtual void ListenForSessionMessages( | 176 virtual void ListenForConnectionMessages( |
177 int render_process_id, | 177 int render_process_id, |
178 int render_frame_id, | 178 int render_frame_id, |
179 const content::PresentationSessionInfo& session, | 179 const content::PresentationSessionInfo& session, |
180 const PresentationSessionMessageCallback& message_cb) = 0; | 180 const PresentationConnectionMessageCallback& message_cb) = 0; |
181 | 181 |
182 // Sends a message (string or binary data) to a presentation session. | 182 // Sends a message (string or binary data) to a presentation session. |
183 // |render_process_id|, |render_frame_id|: ID of originating frame. | 183 // |render_process_id|, |render_frame_id|: ID of originating frame. |
184 // |session|: The presentation session to send the message to. | 184 // |session|: The presentation session to send the message to. |
185 // |message|: The message to send. The embedder takes ownership of |message|. | 185 // |message|: The message to send. The embedder takes ownership of |message|. |
186 // Must not be null. | 186 // Must not be null. |
187 // |send_message_cb|: Invoked after handling the send message request. | 187 // |send_message_cb|: Invoked after handling the send message request. |
188 virtual void SendMessage(int render_process_id, | 188 virtual void SendMessage( |
189 int render_frame_id, | 189 int render_process_id, |
190 const content::PresentationSessionInfo& session, | 190 int render_frame_id, |
191 std::unique_ptr<PresentationSessionMessage> message, | 191 const content::PresentationSessionInfo& session, |
192 const SendMessageCallback& send_message_cb) = 0; | 192 std::unique_ptr<PresentationConnectionMessage> message, |
193 const SendMessageCallback& send_message_cb) = 0; | |
193 | 194 |
194 // Continuously listen for state changes for a PresentationConnection in a | 195 // Continuously listen for state changes for a PresentationConnection in a |
195 // frame. | 196 // frame. |
196 // |render_process_id|, |render_frame_id|: ID of frame. | 197 // |render_process_id|, |render_frame_id|: ID of frame. |
197 // |connection|: PresentationConnection to listen for state changes. | 198 // |connection|: PresentationConnection to listen for state changes. |
198 // |state_changed_cb|: Invoked with the PresentationConnection and its new | 199 // |state_changed_cb|: Invoked with the PresentationConnection and its new |
199 // state whenever there is a state change. | 200 // state whenever there is a state change. |
200 virtual void ListenForConnectionStateChange( | 201 virtual void ListenForConnectionStateChange( |
201 int render_process_id, | 202 int render_process_id, |
202 int render_frame_id, | 203 int render_frame_id, |
203 const PresentationSessionInfo& connection, | 204 const PresentationSessionInfo& connection, |
204 const PresentationConnectionStateChangedCallback& state_changed_cb) = 0; | 205 const PresentationConnectionStateChangedCallback& state_changed_cb) = 0; |
205 }; | 206 }; |
206 | 207 |
207 } // namespace content | 208 } // namespace content |
208 | 209 |
209 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 210 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
OLD | NEW |