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..c5f0c2aee21e1ab8f1c80b0393d0cfa6a2b0676b 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; |
@@ -148,7 +153,8 @@ class CONTENT_EXPORT PresentationServiceImpl |
PresentationServiceImpl( |
RenderFrameHost* render_frame_host, |
WebContents* web_contents, |
- PresentationServiceDelegate* delegate); |
+ ControllerPresentationServiceDelegate* controller_delegate, |
+ ReceiverPresentationServiceDelegate* receiver_delegate); |
// PresentationService implementation. |
void SetDefaultPresentationUrls( |
@@ -170,6 +176,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 +235,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 +261,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_; |
+ PresentationServiceDelegateBase* GetPresentationServiceDelegate(); |
imcheng
2016/11/01 17:20:29
Please add documentation.
zhaobin
2016/11/02 03:55:47
Done.
|
+ |
+ // Embedder-specific delegate for controller to forward Presentation requests |
+ // to. |
+ // May be null if current page is receiver page or |
imcheng
2016/11/01 17:20:29
nit: It is definitely nullptr if either of those a
zhaobin
2016/11/02 03:55:47
Done.
|
+ // embedder does not support Presentation API . |
+ ControllerPresentationServiceDelegate* controller_delegate_; |
imcheng
2016/11/01 17:20:29
* const
zhaobin
2016/11/02 03:55:47
Cannot be const since we set them to nullptr in Re
|
+ |
+ // Embedder-specific delegate for receiver to forward Presentation requests |
+ // to. |
+ // May be null if current page is receiver page or |
imcheng
2016/11/01 17:20:29
ditto about nullptr
zhaobin
2016/11/02 03:55:47
Done.
|
+ // embedder does not support Presentation API. |
+ ReceiverPresentationServiceDelegate* receiver_delegate_; |
imcheng
2016/11/01 17:20:29
* const
zhaobin
2016/11/02 03:55:47
Cannot be const since we set them to nullptr in Re
|
// Proxy to the PresentationServiceClient to send results (e.g., screen |
// availability) to. |