Index: chrome/browser/ui/webui/media_router/media_router_ui.h |
diff --git a/chrome/browser/ui/webui/media_router/media_router_ui.h b/chrome/browser/ui/webui/media_router/media_router_ui.h |
index e3e4a21838fd8bb587d2f305f5520b6429875f1e..e3cf8d13fd3e6ef11e7a1a3d9854f5d6e2e74fa6 100644 |
--- a/chrome/browser/ui/webui/media_router/media_router_ui.h |
+++ b/chrome/browser/ui/webui/media_router/media_router_ui.h |
@@ -31,11 +31,12 @@ namespace media_router { |
class IssuesObserver; |
class MediaRoute; |
class MediaRouter; |
+class MediaRouterDialogCallbacks; |
class MediaRouterWebUIMessageHandler; |
class MediaRoutesObserver; |
class MediaSink; |
class MediaSinksObserver; |
-class CreateSessionRequest; |
+class CreatePresentationSessionRequest; |
// Implements the chrome://media-router user interface. |
class MediaRouterUI |
@@ -48,24 +49,32 @@ class MediaRouterUI |
~MediaRouterUI() override; |
// Initializes internal state (e.g. starts listening for MediaSinks) for |
- // targeting the default MediaSource (if any) of the tab. The contents of the |
- // UI will change as the default MediaSource changes. If there is a default |
- // MediaSource, then DEFAULT MediaCastMode will be added to |cast_modes_|. |
- // |source_manager|: PresentationServiceDelegateImpl of the initiator tab. |
- // Must not be null. |
- // Can only be called once. |
+ // targeting the default MediaSource (if any) of the initiator tab that owns |
+ // |delegate|, as well as mirroring sources of that tab. |
+ // The contents of the UI will change as the default MediaSource changes. |
+ // If there is a default MediaSource, then DEFAULT MediaCastMode will be |
+ // added to |cast_modes_|. |
+ // Init* methods can only be called once. |
+ // |delegate|: PresentationServiceDelegateImpl of the initiator tab. |
+ // Must not be null. |
// TODO(imcheng): Replace use of impl with an intermediate abstract |
// interface. |
- void InitWithDefaultMediaSource(PresentationServiceDelegateImpl* delegate); |
+ void InitWithDefaultMediaSource( |
+ const base::WeakPtr<PresentationServiceDelegateImpl>& delegate); |
// Initializes internal state targeting the presentation specified in |
// |request|. Also sets up mirroring sources based on |initiator|. |
// This is different from |InitWithDefaultMediaSource| in that it does not |
// listen for default media source changes, as the UI is fixed to the source |
// in |request|. |
+ // Init* methods can only be called once. |
+ // |initiator|: Reference to the WebContents that initiated the dialog. |
+ // Must not be null. |
+ // |presentation_request|: The presentation request. This instance will take |
+ // ownership of it. Must not be null. |
void InitWithPresentationSessionRequest( |
- const content::WebContents* initiator, |
- scoped_ptr<CreateSessionRequest> request); |
+ content::WebContents* initiator, |
+ scoped_ptr<CreatePresentationSessionRequest> presentation_request); |
// Closes the media router UI. |
void Close(); |
@@ -125,7 +134,7 @@ class MediaRouterUI |
// Callback passed to MediaRouter to receive response to route creation |
// requests. |
- void OnRouteResponseReceived(scoped_ptr<MediaRoute> route, |
+ void OnRouteResponseReceived(const MediaRoute* route, |
const std::string& error); |
bool DoCreateRoute(const MediaSink::Id& sink_id, MediaCastMode cast_mode); |
@@ -137,15 +146,10 @@ class MediaRouterUI |
// Initializes the dialog with mirroring sources derived from |initiator|, |
// and optional |default_source| and |default_frame_url| if any. |
- void InitCommon(const content::WebContents* initiator, |
+ void InitCommon(content::WebContents* initiator, |
const MediaSource& default_source, |
const GURL& default_frame_url); |
- // Invoke presentation callbacks based on |route| and |error| if the dialog |
- // was created for Presentation API. |
- void HandleRouteResponseForPresentation(const MediaRoute* route, |
- const std::string& error); |
- |
// PresentationServiceDelegateImpl::DefaultMediaSourceObserver |
void OnDefaultMediaSourceChanged(const MediaSource& source, |
const GURL& frame_url) override; |
@@ -174,8 +178,9 @@ class MediaRouterUI |
scoped_ptr<QueryResultManager> query_result_manager_; |
- // Only set if the UI is created as a result of Presentation API. |
- scoped_ptr<CreateSessionRequest> presentation_session_request_; |
+ // If set, then the result of the next presentation route request will |
+ // be handled by this object. |
+ scoped_ptr<CreatePresentationSessionRequest> presentation_request_; |
// It's possible for PresentationServiceDelegateImpl to be destroyed before |
// this class. |
@@ -186,7 +191,7 @@ class MediaRouterUI |
// TODO(imcheng): hold a weak ptr to an abstract type instead. |
base::WeakPtr<PresentationServiceDelegateImpl> presentation_service_delegate_; |
- const content::WebContents* initiator_; |
+ content::WebContents* initiator_; |
// Cached pointer to the MediaRouter for this instance's BrowserContext. |
MediaRouter* router_; |