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 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 class PresentationScreenAvailabilityListener; | 21 class PresentationScreenAvailabilityListener; |
21 | 22 |
22 using PresentationSessionStartedCallback = | 23 using PresentationSessionStartedCallback = |
23 base::Callback<void(const PresentationSessionInfo&)>; | 24 base::Callback<void(const PresentationSessionInfo&)>; |
24 using PresentationSessionErrorCallback = | 25 using PresentationSessionErrorCallback = |
25 base::Callback<void(const PresentationError&)>; | 26 base::Callback<void(const PresentationError&)>; |
26 | 27 |
(...skipping 13 matching lines...) Expand all Loading... |
40 PresentationConnectionState state; | 41 PresentationConnectionState state; |
41 | 42 |
42 // |close_reason| and |messsage| are only used for state change to CLOSED. | 43 // |close_reason| and |messsage| are only used for state change to CLOSED. |
43 PresentationConnectionCloseReason close_reason; | 44 PresentationConnectionCloseReason close_reason; |
44 std::string message; | 45 std::string message; |
45 }; | 46 }; |
46 | 47 |
47 using PresentationConnectionStateChangedCallback = | 48 using PresentationConnectionStateChangedCallback = |
48 base::Callback<void(const PresentationConnectionStateChangeInfo&)>; | 49 base::Callback<void(const PresentationConnectionStateChangeInfo&)>; |
49 | 50 |
| 51 using PresentationConnectionPtr = blink::mojom::PresentationConnectionPtr; |
| 52 |
| 53 using ReceiverConnectionAvailableCallback = |
| 54 base::Callback<void(const content::PresentationSessionInfo&, |
| 55 PresentationConnectionPtr&&)>; |
| 56 |
50 // An interface implemented by embedders to handle presentation API calls | 57 // An interface implemented by embedders to handle presentation API calls |
51 // forwarded from PresentationServiceImpl. | 58 // forwarded from PresentationServiceImpl. |
52 class CONTENT_EXPORT PresentationServiceDelegate { | 59 class CONTENT_EXPORT PresentationServiceDelegate { |
53 public: | 60 public: |
54 // Observer interface to listen for changes to PresentationServiceDelegate. | 61 // Observer interface to listen for changes to PresentationServiceDelegate. |
55 class CONTENT_EXPORT Observer { | 62 class CONTENT_EXPORT Observer { |
56 public: | 63 public: |
57 // Called when the PresentationServiceDelegate is being destroyed. | 64 // Called when the PresentationServiceDelegate is being destroyed. |
58 virtual void OnDelegateDestroyed() = 0; | 65 virtual void OnDelegateDestroyed() = 0; |
59 | 66 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // frame. | 203 // frame. |
197 // |render_process_id|, |render_frame_id|: ID of frame. | 204 // |render_process_id|, |render_frame_id|: ID of frame. |
198 // |connection|: PresentationConnection to listen for state changes. | 205 // |connection|: PresentationConnection to listen for state changes. |
199 // |state_changed_cb|: Invoked with the PresentationConnection and its new | 206 // |state_changed_cb|: Invoked with the PresentationConnection and its new |
200 // state whenever there is a state change. | 207 // state whenever there is a state change. |
201 virtual void ListenForConnectionStateChange( | 208 virtual void ListenForConnectionStateChange( |
202 int render_process_id, | 209 int render_process_id, |
203 int render_frame_id, | 210 int render_frame_id, |
204 const PresentationSessionInfo& connection, | 211 const PresentationSessionInfo& connection, |
205 const PresentationConnectionStateChangedCallback& state_changed_cb) = 0; | 212 const PresentationConnectionStateChangedCallback& state_changed_cb) = 0; |
| 213 |
| 214 // In receiverPSDImpl, register receiver_available_callback with |
| 215 // OffscreenPresentationManager; |
| 216 // In controllerPSDImpl, no-op. |
| 217 // |receiver_available_callback|: Invoked when successfully starting a |
| 218 // offscreen presentation session. |
| 219 virtual void RegisterReceiverAvailableCallback( |
| 220 const content::ReceiverConnectionAvailableCallback& |
| 221 receiver_available_callback) = 0; |
| 222 |
| 223 // In receiverPSDImpl, no-op; |
| 224 // In controllerPSDImpl, register controller presentation connection mojo |
| 225 // object to OffscreenPresentationManager (OPM). |
| 226 // |render_process_id|, |render_frame_id|: ID of originating frame. |
| 227 // |connection|: Pointer to controller presentation connection, |
| 228 // pass ownership to OPM. To be used in |
| 229 // offscreen_presentation_manager->RegisterOffscreenPresentationController(). |
| 230 virtual void RegisterOffscreenPresentationConnection( |
| 231 int render_process_id, |
| 232 int render_frame_id, |
| 233 const PresentationSessionInfo& session, |
| 234 PresentationConnectionPtr connection) = 0; |
206 }; | 235 }; |
207 | 236 |
208 } // namespace content | 237 } // namespace content |
209 | 238 |
210 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ | 239 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_ |
OLD | NEW |