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_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 SendMessageCallback = base::Callback<void(bool)>; |
26 | 27 |
27 // Param #0: a vector of messages that are received. | 28 // Param #0: a vector of messages that are received. |
28 // Param #1: tells the callback handler that it may reuse strings or buffers | 29 // Param #1: tells the callback handler that it may reuse strings or buffers |
29 // in the messages contained within param #0. | 30 // in the messages contained within param #0. |
30 using PresentationSessionMessageCallback = base::Callback< | 31 using PresentationSessionMessageCallback = base::Callback< |
31 void(const ScopedVector<content::PresentationSessionMessage>&, bool)>; | 32 void(const ScopedVector<content::PresentationSessionMessage>&, bool)>; |
32 | 33 |
33 struct PresentationConnectionStateChangeInfo { | 34 struct PresentationConnectionStateChangeInfo { |
34 explicit PresentationConnectionStateChangeInfo( | 35 explicit PresentationConnectionStateChangeInfo( |
35 PresentationConnectionState state) | 36 PresentationConnectionState state) |
(...skipping 18 matching lines...) Expand all Loading... |
54 // Observer interface to listen for changes to PresentationServiceDelegate. | 55 // Observer interface to listen for changes to PresentationServiceDelegate. |
55 class CONTENT_EXPORT Observer { | 56 class CONTENT_EXPORT Observer { |
56 public: | 57 public: |
57 // Called when the PresentationServiceDelegate is being destroyed. | 58 // Called when the PresentationServiceDelegate is being destroyed. |
58 virtual void OnDelegateDestroyed() = 0; | 59 virtual void OnDelegateDestroyed() = 0; |
59 | 60 |
60 protected: | 61 protected: |
61 virtual ~Observer() {} | 62 virtual ~Observer() {} |
62 }; | 63 }; |
63 | 64 |
64 using SendMessageCallback = base::Callback<void(bool)>; | |
65 | |
66 virtual ~PresentationServiceDelegate() {} | 65 virtual ~PresentationServiceDelegate() {} |
67 | 66 |
68 // Registers an observer associated with frame with |render_process_id| | 67 // Registers an observer associated with frame with |render_process_id| |
69 // and |render_frame_id| with this class to listen for updates. | 68 // and |render_frame_id| with this class to listen for updates. |
70 // This class does not own the observer. | 69 // This class does not own the observer. |
71 // It is an error to add an observer if there is already an observer for that | 70 // It is an error to add an observer if there is already an observer for that |
72 // frame. | 71 // frame. |
73 virtual void AddObserver(int render_process_id, | 72 virtual void AddObserver(int render_process_id, |
74 int render_frame_id, | 73 int render_frame_id, |
75 Observer* observer) = 0; | 74 Observer* observer) = 0; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // frame. | 192 // frame. |
194 // |render_process_id|, |render_frame_id|: ID of frame. | 193 // |render_process_id|, |render_frame_id|: ID of frame. |
195 // |connection|: PresentationConnection to listen for state changes. | 194 // |connection|: PresentationConnection to listen for state changes. |
196 // |state_changed_cb|: Invoked with the PresentationConnection and its new | 195 // |state_changed_cb|: Invoked with the PresentationConnection and its new |
197 // state whenever there is a state change. | 196 // state whenever there is a state change. |
198 virtual void ListenForConnectionStateChange( | 197 virtual void ListenForConnectionStateChange( |
199 int render_process_id, | 198 int render_process_id, |
200 int render_frame_id, | 199 int render_frame_id, |
201 const PresentationSessionInfo& connection, | 200 const PresentationSessionInfo& connection, |
202 const PresentationConnectionStateChangedCallback& state_changed_cb) = 0; | 201 const PresentationConnectionStateChangedCallback& state_changed_cb) = 0; |
| 202 |
| 203 // Returns the current list of receiver connections for the offscreen |
| 204 // presentation hosted on the offscreen tab containing this frame. |
| 205 // In additions, registers |callback| to be run when a new receiver connection |
| 206 // is available. |
| 207 virtual std::vector<content::PresentationSessionInfo> GetReceiverConnections( |
| 208 int render_process_id, |
| 209 int render_frame_id, |
| 210 const PresentationSessionStartedCallback& callback) = 0; |
203 }; | 211 }; |
204 | 212 |
205 } // namespace content | 213 } // namespace content |
206 | 214 |
207 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 215 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
OLD | NEW |