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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.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_session.h" | 15 #include "content/public/browser/presentation_session.h" |
16 #include "content/public/browser/presentation_session_message.h" | 16 #include "content/public/browser/presentation_session_message.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class PresentationScreenAvailabilityListener; | 20 class PresentationScreenAvailabilityListener; |
21 | 21 |
22 using PresentationSessionStartedCallback = | 22 using PresentationSessionStartedCallback = |
23 base::Callback<void(const PresentationSessionInfo&)>; | 23 base::Callback<void(const PresentationSessionInfo&)>; |
24 using PresentationSessionErrorCallback = | 24 using PresentationSessionErrorCallback = |
25 base::Callback<void(const PresentationError&)>; | 25 base::Callback<void(const PresentationError&)>; |
26 using SessionStateChangedCallback = | 26 using PresentationConnectionStateChangedCallback = |
27 base::Callback<void(const PresentationSessionInfo&, | 27 base::Callback<void(PresentationConnectionState)>; |
28 PresentationConnectionState)>; | |
29 | 28 |
30 // Param #0: a vector of messages that are received. | 29 // Param #0: a vector of messages that are received. |
31 // 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 |
32 // in the messages contained within param #0. | 31 // in the messages contained within param #0. |
33 using PresentationSessionMessageCallback = base::Callback< | 32 using PresentationSessionMessageCallback = base::Callback< |
34 void(const ScopedVector<content::PresentationSessionMessage>&, bool)>; | 33 void(const ScopedVector<content::PresentationSessionMessage>&, bool)>; |
35 | 34 |
36 // An interface implemented by embedders to handle presentation API calls | 35 // An interface implemented by embedders to handle presentation API calls |
37 // forwarded from PresentationServiceImpl. | 36 // forwarded from PresentationServiceImpl. |
38 class CONTENT_EXPORT PresentationServiceDelegate { | 37 class CONTENT_EXPORT PresentationServiceDelegate { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // |session|: The presentation session to send the message to. | 160 // |session|: The presentation session to send the message to. |
162 // |message|: The message to send. The embedder takes ownership of |message|. | 161 // |message|: The message to send. The embedder takes ownership of |message|. |
163 // Must not be null. | 162 // Must not be null. |
164 // |send_message_cb|: Invoked after handling the send message request. | 163 // |send_message_cb|: Invoked after handling the send message request. |
165 virtual void SendMessage(int render_process_id, | 164 virtual void SendMessage(int render_process_id, |
166 int render_frame_id, | 165 int render_frame_id, |
167 const content::PresentationSessionInfo& session, | 166 const content::PresentationSessionInfo& session, |
168 scoped_ptr<PresentationSessionMessage> message, | 167 scoped_ptr<PresentationSessionMessage> message, |
169 const SendMessageCallback& send_message_cb) = 0; | 168 const SendMessageCallback& send_message_cb) = 0; |
170 | 169 |
171 // Continuously listen for presentation session state changes for a frame. | 170 // Continuously listen for state changes for a PresentationConnection in a |
| 171 // frame. |
172 // |render_process_id|, |render_frame_id|: ID of frame. | 172 // |render_process_id|, |render_frame_id|: ID of frame. |
173 // |state_changed_cb|: Invoked with the session and its new state whenever | 173 // |connection|: PresentationConnection to listen for state changes. |
174 // there is a state change. | 174 // |state_changed_cb|: Invoked with the PresentationConnection and its new |
175 virtual void ListenForSessionStateChange( | 175 // state whenever there is a state change. |
| 176 virtual void ListenForConnectionStateChange( |
176 int render_process_id, | 177 int render_process_id, |
177 int render_frame_id, | 178 int render_frame_id, |
178 const SessionStateChangedCallback& state_changed_cb) = 0; | 179 const PresentationSessionInfo& connection, |
| 180 const PresentationConnectionStateChangedCallback& state_changed_cb) = 0; |
179 }; | 181 }; |
180 | 182 |
181 } // namespace content | 183 } // namespace content |
182 | 184 |
183 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 185 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
OLD | NEW |