| Index: content/browser/presentation/presentation_service_impl.h
|
| diff --git a/content/browser/presentation/presentation_service_impl.h b/content/browser/presentation/presentation_service_impl.h
|
| index 10d08499c161db6c75173548b31af16e76abc597..a5567802d9fac4f29ece0abf6a6186fdbf76d88b 100644
|
| --- a/content/browser/presentation/presentation_service_impl.h
|
| +++ b/content/browser/presentation/presentation_service_impl.h
|
| @@ -8,6 +8,7 @@
|
| #include <deque>
|
| #include <map>
|
| #include <memory>
|
| +#include <set>
|
| #include <string>
|
| #include <vector>
|
|
|
| @@ -48,7 +49,7 @@ class RenderFrameHost;
|
| class CONTENT_EXPORT PresentationServiceImpl
|
| : public NON_EXPORTED_BASE(blink::mojom::PresentationService),
|
| public WebContentsObserver,
|
| - public PresentationServiceDelegate::Observer {
|
| + public PresentationServiceDelegateBase::Observer {
|
| public:
|
| using NewSessionCallback =
|
| base::Callback<void(blink::mojom::PresentationSessionInfoPtr,
|
| @@ -95,6 +96,10 @@ class CONTENT_EXPORT PresentationServiceImpl
|
| ListenForConnectionStateChange);
|
| FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
|
| ListenForConnectionClose);
|
| + FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
|
| + SetPresentationConnection);
|
| + FRIEND_TEST_ALL_PREFIXES(PresentationServiceImplTest,
|
| + ReceiverPresentationServiceDelegate);
|
|
|
| // Maximum number of pending JoinSession requests at any given time.
|
| static const int kMaxNumQueuedSessionRequests = 10;
|
| @@ -143,12 +148,17 @@ class CONTENT_EXPORT PresentationServiceImpl
|
|
|
| // |render_frame_host|: The RFH this instance is associated with.
|
| // |web_contents|: The WebContents to observe.
|
| - // |delegate|: Where Presentation API requests are delegated to. Not owned
|
| + // |controller_delegate|: Where Presentation API requests are delegated to in
|
| + // controller frame. Set to null if current frame is receiver frame. Not owned
|
| + // by this class.
|
| + // |receiver_delegate|: Where Presentation API requests are delegated to in
|
| + // receiver frame. Set to null if current frame is controller frame. Not owned
|
| // by this class.
|
| PresentationServiceImpl(
|
| RenderFrameHost* render_frame_host,
|
| WebContents* web_contents,
|
| - PresentationServiceDelegate* delegate);
|
| + ControllerPresentationServiceDelegate* controller_delegate,
|
| + ReceiverPresentationServiceDelegate* receiver_delegate);
|
|
|
| // PresentationService implementation.
|
| void SetDefaultPresentationUrls(
|
| @@ -170,6 +180,9 @@ class CONTENT_EXPORT PresentationServiceImpl
|
| const std::string& presentation_id) override;
|
| void ListenForSessionMessages(
|
| blink::mojom::PresentationSessionInfoPtr session) override;
|
| + void SetPresentationConnection(
|
| + blink::mojom::PresentationSessionInfoPtr session,
|
| + blink::mojom::PresentationConnectionPtr connection) override;
|
|
|
| // Creates a binding between this object and |request|.
|
| void Bind(mojo::InterfaceRequest<blink::mojom::PresentationService> request);
|
| @@ -226,13 +239,18 @@ class CONTENT_EXPORT PresentationServiceImpl
|
| void ListenForConnectionStateChange(
|
| const PresentationSessionInfo& connection);
|
|
|
| - // Passed to embedder's implementation of PresentationServiceDelegate for
|
| - // later invocation when session messages arrive.
|
| void OnSessionMessages(
|
| const content::PresentationSessionInfo& session,
|
| const ScopedVector<PresentationSessionMessage>& messages,
|
| bool pass_ownership);
|
|
|
| + // A callback registered to OffscreenPresentationManager when
|
| + // receiver PSImpl inits. Calls |client_| to create a new
|
| + // PresentationConnection on receiver page.
|
| + void OnReceiverConnectionAvailable(
|
| + const content::PresentationSessionInfo& session_info,
|
| + PresentationConnectionPtr&& controller_connection);
|
| +
|
| // Associates a JoinSession |callback| with a unique request ID and
|
| // stores it in a map.
|
| // Returns a positive value on success.
|
| @@ -247,9 +265,19 @@ class CONTENT_EXPORT PresentationServiceImpl
|
| // Returns true if this object is associated with |render_frame_host|.
|
| bool FrameMatches(content::RenderFrameHost* render_frame_host) const;
|
|
|
| - // Embedder-specific delegate to forward Presentation requests to.
|
| - // May be null if embedder does not support Presentation API.
|
| - PresentationServiceDelegate* delegate_;
|
| + // Returns |controller_delegate| if current frame is controller frame; Returns
|
| + // |receiver_delegate| if current frame is receiver frame.
|
| + PresentationServiceDelegateBase* GetPresentationServiceDelegate();
|
| +
|
| + // Embedder-specific delegate for controller to forward Presentation requests
|
| + // to. Must be nullptr if current page is receiver page or
|
| + // embedder does not support Presentation API .
|
| + ControllerPresentationServiceDelegate* controller_delegate_;
|
| +
|
| + // Embedder-specific delegate for receiver to forward Presentation requests
|
| + // to. Must be nullptr if current page is receiver page or
|
| + // embedder does not support Presentation API.
|
| + ReceiverPresentationServiceDelegate* receiver_delegate_;
|
|
|
| // Proxy to the PresentationServiceClient to send results (e.g., screen
|
| // availability) to.
|
|
|