| 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 <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "content/public/common/presentation_connection_message.h" | 15 #include "content/public/common/presentation_connection_message.h" |
| 16 #include "content/public/common/presentation_session.h" | 16 #include "content/public/common/presentation_session.h" |
| 17 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" | 17 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" |
| 18 | 18 |
| 19 class GURL; | 19 class GURL; |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 | 22 |
| 23 class PresentationScreenAvailabilityListener; | 23 class PresentationScreenAvailabilityListener; |
| 24 | 24 |
| 25 using PresentationSessionStartedCallback = | 25 using PresentationSessionStartedCallback = |
| 26 base::Callback<void(const PresentationSessionInfo&)>; | 26 base::Callback<void(const PresentationSessionInfo&)>; |
| 27 using PresentationSessionErrorCallback = | 27 using PresentationSessionErrorCallback = |
| 28 base::Callback<void(const PresentationError&)>; | 28 base::Callback<void(const PresentationError&)>; |
| 29 | 29 |
| 30 // Param #0: a vector of messages that are received. | 30 // Param: a vector of messages that are received. |
| 31 // Param #1: tells the callback handler that it may reuse strings or buffers | 31 using PresentationConnectionMessageCallback = |
| 32 // in the messages contained within param #0. | 32 base::Callback<void(std::vector<content::PresentationConnectionMessage>)>; |
| 33 using PresentationConnectionMessageCallback = base::Callback<void( | |
| 34 const std::vector<std::unique_ptr<content::PresentationConnectionMessage>>&, | |
| 35 bool)>; | |
| 36 | 33 |
| 37 struct PresentationConnectionStateChangeInfo { | 34 struct PresentationConnectionStateChangeInfo { |
| 38 explicit PresentationConnectionStateChangeInfo( | 35 explicit PresentationConnectionStateChangeInfo( |
| 39 PresentationConnectionState state) | 36 PresentationConnectionState state) |
| 40 : state(state), | 37 : state(state), |
| 41 close_reason(PRESENTATION_CONNECTION_CLOSE_REASON_CONNECTION_ERROR) {} | 38 close_reason(PRESENTATION_CONNECTION_CLOSE_REASON_CONNECTION_ERROR) {} |
| 42 ~PresentationConnectionStateChangeInfo() = default; | 39 ~PresentationConnectionStateChangeInfo() = default; |
| 43 | 40 |
| 44 PresentationConnectionState state; | 41 PresentationConnectionState state; |
| 45 | 42 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 int render_frame_id, | 190 int render_frame_id, |
| 194 const content::PresentationSessionInfo& session, | 191 const content::PresentationSessionInfo& session, |
| 195 const PresentationConnectionMessageCallback& message_cb) = 0; | 192 const PresentationConnectionMessageCallback& message_cb) = 0; |
| 196 | 193 |
| 197 // Sends a message (string or binary data) to a presentation session. | 194 // Sends a message (string or binary data) to a presentation session. |
| 198 // |render_process_id|, |render_frame_id|: ID of originating frame. | 195 // |render_process_id|, |render_frame_id|: ID of originating frame. |
| 199 // |session|: The presentation session to send the message to. | 196 // |session|: The presentation session to send the message to. |
| 200 // |message|: The message to send. The embedder takes ownership of |message|. | 197 // |message|: The message to send. The embedder takes ownership of |message|. |
| 201 // Must not be null. | 198 // Must not be null. |
| 202 // |send_message_cb|: Invoked after handling the send message request. | 199 // |send_message_cb|: Invoked after handling the send message request. |
| 203 virtual void SendMessage( | 200 virtual void SendMessage(int render_process_id, |
| 204 int render_process_id, | 201 int render_frame_id, |
| 205 int render_frame_id, | 202 const content::PresentationSessionInfo& session, |
| 206 const content::PresentationSessionInfo& session, | 203 PresentationConnectionMessage message, |
| 207 std::unique_ptr<PresentationConnectionMessage> message, | 204 const SendMessageCallback& send_message_cb) = 0; |
| 208 const SendMessageCallback& send_message_cb) = 0; | |
| 209 | 205 |
| 210 // Continuously listen for state changes for a PresentationConnection in a | 206 // Continuously listen for state changes for a PresentationConnection in a |
| 211 // frame. | 207 // frame. |
| 212 // |render_process_id|, |render_frame_id|: ID of frame. | 208 // |render_process_id|, |render_frame_id|: ID of frame. |
| 213 // |connection|: PresentationConnection to listen for state changes. | 209 // |connection|: PresentationConnection to listen for state changes. |
| 214 // |state_changed_cb|: Invoked with the PresentationConnection and its new | 210 // |state_changed_cb|: Invoked with the PresentationConnection and its new |
| 215 // state whenever there is a state change. | 211 // state whenever there is a state change. |
| 216 virtual void ListenForConnectionStateChange( | 212 virtual void ListenForConnectionStateChange( |
| 217 int render_process_id, | 213 int render_process_id, |
| 218 int render_frame_id, | 214 int render_frame_id, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 244 // |receiver_available_callback|: Invoked when successfully starting a | 240 // |receiver_available_callback|: Invoked when successfully starting a |
| 245 // offscreen presentation session. | 241 // offscreen presentation session. |
| 246 virtual void RegisterReceiverConnectionAvailableCallback( | 242 virtual void RegisterReceiverConnectionAvailableCallback( |
| 247 const content::ReceiverConnectionAvailableCallback& | 243 const content::ReceiverConnectionAvailableCallback& |
| 248 receiver_available_callback) = 0; | 244 receiver_available_callback) = 0; |
| 249 }; | 245 }; |
| 250 | 246 |
| 251 } // namespace content | 247 } // namespace content |
| 252 | 248 |
| 253 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 249 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
| OLD | NEW |