Chromium Code Reviews| 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..3fe7f52d89fc0400f69d4988f615e9d0cd9721d4 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 |
| @@ -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,34 @@ 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(); |
| + |
| + bool IsMainFrame(const RenderFrameHostId& render_frame_host_id) const; |
|
Kevin M
2017/07/10 19:01:36
Add a comment for all new methods?
imcheng
2017/07/10 19:18:50
Done.
|
| + |
| + 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 +243,25 @@ class PresentationServiceDelegateImpl |
| content::WebContents* const web_contents_; |
| MediaRouter* router_; |
| - std::unique_ptr<PresentationFrameManager> frame_manager_; |
| + // References to the observers listening for changes to this tab WebContent's |
|
Kevin M
2017/07/10 19:01:37
The pluralized WebContents name makes a mess of th
imcheng
2017/07/10 19:18:50
Done.
|
| + // default presentation. |
| + base::ObserverList<DefaultPresentationRequestObserver> |
| + default_presentation_request_observers_; |
| + |
| + // Default presentation request for the owning tab WebContents. |
|
Kevin M
2017/07/10 19:01:36
tab's
imcheng
2017/07/10 19:18:50
Done. Got rid of tab, since it means the same thin
|
| + std::unique_ptr<PresentationRequest> default_presentation_request_; |
| + |
| + // Callback to invoke when default presentation has started. |
|
Kevin M
2017/07/10 19:01:36
the default presentation
imcheng
2017/07/10 19:18:50
Done.
|
| + 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_; |