Chromium Code Reviews| 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..4e1a7c939316f0694d9be241af7bfb20add4da55 100644 |
| --- a/content/browser/presentation/presentation_service_impl.h |
| +++ b/content/browser/presentation/presentation_service_impl.h |
| @@ -48,7 +48,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 +95,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 +147,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( |
|
mark a. foltz
2016/11/08 23:40:52
API design opinion:
It would be better to make
zhaobin
2016/11/10 04:14:00
Done.
|
| RenderFrameHost* render_frame_host, |
| WebContents* web_contents, |
| - PresentationServiceDelegate* delegate); |
| + ControllerPresentationServiceDelegate* controller_delegate, |
| + ReceiverPresentationServiceDelegate* receiver_delegate); |
| // PresentationService implementation. |
| void SetDefaultPresentationUrls( |
| @@ -170,6 +179,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 +238,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 |
|
mark a. foltz
2016/11/08 23:40:52
the PresentationServiceImpl for the presentation r
zhaobin
2016/11/10 04:14:00
Done.
|
| + // 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 +264,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. |