| Index: chrome/browser/media/router/presentation_service_delegate_impl.h
|
| diff --git a/chrome/browser/media/router/presentation_service_delegate_impl.h b/chrome/browser/media/router/presentation_service_delegate_impl.h
|
| index 0e368db7f81a9754ed5f08483be0de263dc55929..f98a8ebcf122e7e9818044d9f859a5e9ad06c71a 100644
|
| --- a/chrome/browser/media/router/presentation_service_delegate_impl.h
|
| +++ b/chrome/browser/media/router/presentation_service_delegate_impl.h
|
| @@ -38,7 +38,7 @@ class Origin;
|
| namespace media_router {
|
|
|
| class MediaRoute;
|
| -class PresentationFrameManager;
|
| +class PresentationFrame;
|
| class RouteRequestResult;
|
|
|
| // Implementation of PresentationServiceDelegate that interfaces an instance of
|
| @@ -147,7 +147,7 @@ class PresentationServiceDelegateImpl
|
| void RemoveDefaultPresentationRequestObserver(
|
| DefaultPresentationRequestObserver* observer);
|
|
|
| - // Gets the default presentation request for the owning tab WebContents. It
|
| + // Gets the default presentation request for the owning WebContents. It
|
| // is an error to call this method if the default presentation request does
|
| // not exist.
|
| PresentationRequest GetDefaultPresentationRequest() const;
|
| @@ -186,10 +186,8 @@ class PresentationServiceDelegateImpl
|
|
|
| explicit PresentationServiceDelegateImpl(content::WebContents* web_contents);
|
|
|
| - // Returns |listener|'s presentation URL as a MediaSource. If |listener| does
|
| - // not have a persentation URL, returns the tab mirroring MediaSource.
|
| - MediaSource GetMediaSourceFromListener(
|
| - content::PresentationScreenAvailabilityListener* listener);
|
| + PresentationFrame* GetOrAddPresentationFrame(
|
| + const RenderFrameHostId& render_frame_host_id);
|
|
|
| void OnJoinRouteResponse(
|
| int render_process_id,
|
| @@ -207,6 +205,39 @@ class PresentationServiceDelegateImpl
|
| const content::PresentationInfo& new_presentation_info,
|
| const MediaRoute& route);
|
|
|
| + // Notifies the PresentationFrame of |render_frame_host_id| that a
|
| + // presentation and its corresponding MediaRoute has been created.
|
| + // The PresentationFrame will be created if it does not already exist.
|
| + // This must be called before |ConnectToPresentation()|.
|
| + void AddPresentation(const RenderFrameHostId& render_frame_host_id,
|
| + const content::PresentationInfo& presentation_info,
|
| + const MediaRoute& route);
|
| +
|
| + // Notifies the PresentationFrame of |render_frame_host_id| that a
|
| + // presentation and its corresponding MediaRoute has been removed.
|
| + void RemovePresentation(const RenderFrameHostId& render_frame_host_id,
|
| + const std::string& presentation_id);
|
| +
|
| + // Sets the default presentation request for the owning WebContents and
|
| + // notifies observers of changes.
|
| + void SetDefaultPresentationRequest(
|
| + const PresentationRequest& default_presentation_request);
|
| +
|
| + // Clears the default presentation request for the owning WebContents and
|
| + // notifies observers of changes. Also resets
|
| + // |default_presentation_started_callback_|.
|
| + void ClearDefaultPresentationRequest();
|
| +
|
| + // Returns |true| if the given frame is the main frame of the associated
|
| + // WebContents.
|
| + // NOTE: This method will be removed in an upcoming patch.
|
| + bool IsMainFrame(const RenderFrameHostId& render_frame_host_id) const;
|
| +
|
| + // Returns the ID of the route corresponding to |presentation_id| in the given
|
| + // frame, or empty if no such route exist.
|
| + MediaRoute::Id GetRouteId(const RenderFrameHostId& render_frame_host_id,
|
| + const std::string& presentation_id) const;
|
| +
|
| #if !defined(OS_ANDROID)
|
| // Returns true if auto-join requests should be cancelled for |origin|.
|
| bool ShouldCancelAutoJoinForOrigin(const url::Origin& origin) const;
|
| @@ -217,7 +248,25 @@ class PresentationServiceDelegateImpl
|
| content::WebContents* const web_contents_;
|
| MediaRouter* router_;
|
|
|
| - std::unique_ptr<PresentationFrameManager> frame_manager_;
|
| + // References to the observers listening for changes to the default
|
| + // presentation of the associated WebContents.
|
| + base::ObserverList<DefaultPresentationRequestObserver>
|
| + default_presentation_request_observers_;
|
| +
|
| + // Default presentation request for the owning WebContents.
|
| + std::unique_ptr<PresentationRequest> default_presentation_request_;
|
| +
|
| + // Callback to invoke when the default presentation has started.
|
| + content::DefaultPresentationConnectionCallback
|
| + default_presentation_started_callback_;
|
| +
|
| + // Maps a frame identifier to a PresentationFrame object for frames
|
| + // that are using Presentation API.
|
| + std::unordered_map<RenderFrameHostId,
|
| + std::unique_ptr<PresentationFrame>,
|
| + RenderFrameHostIdHasher>
|
| + presentation_frames_;
|
| +
|
| PresentationServiceDelegateObservers observers_;
|
|
|
| base::WeakPtrFactory<PresentationServiceDelegateImpl> weak_factory_;
|
|
|