Chromium Code Reviews| Index: chrome/browser/ui/webui/media_router/media_router_dialog_controller.h |
| diff --git a/chrome/browser/ui/webui/media_router/media_router_dialog_controller.h b/chrome/browser/ui/webui/media_router/media_router_dialog_controller.h |
| index f357d00bb173adb44d65fe467591b1280f31dc7a..65b1a721a354826f5ec577c831512f9d96c82282 100644 |
| --- a/chrome/browser/ui/webui/media_router/media_router_dialog_controller.h |
| +++ b/chrome/browser/ui/webui/media_router/media_router_dialog_controller.h |
| @@ -6,7 +6,9 @@ |
| #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_H_ |
| #include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
|
mark a. foltz
2015/07/14 21:36:32
Not used
|
| #include "chrome/browser/media/router/create_session_request.h" |
| +#include "chrome/browser/media/router/media_router.h" |
| #include "content/public/browser/web_contents_observer.h" |
| #include "content/public/browser/web_contents_user_data.h" |
| @@ -50,9 +52,26 @@ class MediaRouterDialogController |
| // It is an error to call this function if there is currently no dialog. |
| void CloseMediaRouterDialog(); |
| + // Called by the dialog when it is about to make a presentation route request |
|
haibinlu
2015/07/14 01:44:55
create route
imcheng
2015/07/14 16:45:37
This is specific to presentation route requests.
|
| + // to ensure the response can be received and handled properly even when |
| + // the dialog is destroyed while the request is in progress. |
| + // Returns a MediaRouteResponseCallback that can be used to be used as the |
| + // callback argument in |MediaRouter::CreateRoute()|. |
| + // |route_response_callback|: Callback to the dialog to invoke when the |
| + // presentation route response comes back, if the dialog still exists. |
| + // |presentation_request|: The Presentation API request to respond to when |
| + // route reponse comes back, or nullptr if the request did not originate from |
| + // Presentation API. |
|
mark a. foltz
2015/07/14 21:36:32
The comment above suggests that this is only for P
|
| + MediaRouteResponseCallback AddPresentationRouteRequest( |
| + const MediaRouteResponseCallback& route_response_callback, |
| + scoped_ptr<CreateSessionRequest> presentation_request); |
|
mark a. foltz
2015/07/14 21:36:32
CreateSessionRequest -> CreatePresentationSessionR
imcheng
2015/07/16 01:06:52
Done.
|
| + |
| private: |
| + class BrowserInitiatedCallbacks; |
| class DialogWebContentsObserver; |
| class InitiatorWebContentsObserver; |
| + class MediaRouterDialogCallbacks; |
| + class PresentationInitiatedCallbacks; |
| friend class content::WebContentsUserData<MediaRouterDialogController>; |
| // Use MediaRouterDialogController::CreateForWebContents() to create an |
| @@ -70,6 +89,12 @@ class MediaRouterDialogController |
| void PopulateDialog(content::WebContents* media_router_dialog); |
| + // Destroys |callbacks| by removing it from |pending_dialog_callbacks_|. |
| + // Called by MediaRouterDialogCallbacks after it receives route response and |
| + // is done processing it. |
| + // |callbacks|: The MediaRouterDialogCallbacks to destroy. |
| + void DestroyDialogCallbacks(MediaRouterDialogCallbacks* callbacks); |
|
mark a. foltz
2015/07/14 21:36:32
This might be better named RemoveDialogCallbacks()
|
| + |
| scoped_ptr<InitiatorWebContentsObserver> initiator_observer_; |
| scoped_ptr<DialogWebContentsObserver> dialog_observer_; |
| @@ -84,6 +109,11 @@ class MediaRouterDialogController |
| // passed to the MediaRouterUI when it is initialized. |
| scoped_ptr<CreateSessionRequest> presentation_request_; |
| + // MediaRouterDialogCallbacks corresponding to presentation route requests |
|
haibinlu
2015/07/14 01:44:55
create route requests
imcheng
2015/07/14 16:45:37
ditto
|
| + // made from dialogs created from this instance. Note that they may outlive |
| + // their corresponding dialogs. |
| + ScopedVector<MediaRouterDialogCallbacks> pending_dialog_callbacks_; |
| + |
| base::ThreadChecker thread_checker_; |
| DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogController); |