diff options
Diffstat (limited to 'chromium/chrome/browser/ui/webui/media_router/media_router_ui.h')
-rw-r--r-- | chromium/chrome/browser/ui/webui/media_router/media_router_ui.h | 54 |
1 files changed, 44 insertions, 10 deletions
diff --git a/chromium/chrome/browser/ui/webui/media_router/media_router_ui.h b/chromium/chrome/browser/ui/webui/media_router/media_router_ui.h index ea9474e6c49..bb70fa41482 100644 --- a/chromium/chrome/browser/ui/webui/media_router/media_router_ui.h +++ b/chromium/chrome/browser/ui/webui/media_router/media_router_ui.h @@ -18,6 +18,7 @@ #include "chrome/browser/media/router/presentation_service_delegate_impl.h" #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" #include "chrome/browser/ui/webui/media_router/media_cast_mode.h" +#include "chrome/browser/ui/webui/media_router/media_router_file_dialog.h" #include "chrome/browser/ui/webui/media_router/media_sink_with_cast_modes.h" #include "chrome/browser/ui/webui/media_router/query_result_manager.h" #include "chrome/common/media_router/issue.h" @@ -38,9 +39,12 @@ namespace U_ICU_NAMESPACE { class Collator; } +class Browser; + namespace media_router { class CreatePresentationConnectionRequest; +class EventPageRequestManager; class IssuesObserver; class MediaRoute; class MediaRouter; @@ -50,10 +54,12 @@ class MediaSink; class RouteRequestResult; // Implements the chrome://media-router user interface. -class MediaRouterUI : public ConstrainedWebDialogUI, - public QueryResultManager::Observer, - public PresentationServiceDelegateImpl:: - DefaultPresentationRequestObserver { +class MediaRouterUI + : public ConstrainedWebDialogUI, + public QueryResultManager::Observer, + public PresentationServiceDelegateImpl:: + DefaultPresentationRequestObserver, + public MediaRouterFileDialog::MediaRouterFileDialogDelegate { public: // |web_ui| owns this object and is used to initialize the base class. explicit MediaRouterUI(content::WebUI* web_ui); @@ -65,7 +71,7 @@ class MediaRouterUI : public ConstrainedWebDialogUI, // Must not be null. // |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 + // If there is a default MediaSource, then PRESENTATION MediaCastMode will be // added to |cast_modes_|. // Init* methods can only be called once. // |delegate|: PresentationServiceDelegateImpl of the initiator tab. @@ -119,6 +125,9 @@ class MediaRouterUI : public ConstrainedWebDialogUI, // Calls MediaRouter to clear the given issue. void ClearIssue(const Issue::Id& issue_id); + // Called to open a file dialog with the media_router_ui file dialog handler. + void OpenFileDialog(); + // Calls MediaRouter to search route providers for sinks matching // |search_criteria| with the source that is currently associated with // |cast_mode|. The user's domain |domain| is also used. @@ -135,7 +144,7 @@ class MediaRouterUI : public ConstrainedWebDialogUI, // mode is MediaCastMode::DESKTOP_MIRROR. virtual void RecordCastModeSelection(MediaCastMode cast_mode); - // Returns the hostname of the default source's parent frame URL. + // Returns the hostname of the PresentationRequest's parent frame URL. std::string GetPresentationRequestSourceName() const; std::string GetTruncatedPresentationRequestSourceName() const; bool HasPendingRouteRequest() const { @@ -181,7 +190,8 @@ class MediaRouterUI : public ConstrainedWebDialogUI, content::WebContents* initiator, MediaRouterWebUIMessageHandler* handler, std::unique_ptr<CreatePresentationConnectionRequest> - create_session_request); + create_session_request, + std::unique_ptr<MediaRouterFileDialog> file_dialog); private: friend class MediaRouterUITest; @@ -191,9 +201,9 @@ class MediaRouterUI : public ConstrainedWebDialogUI, FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, FilterNonDisplayRoutes); FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, FilterNonDisplayJoinableRoutes); FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, - UIMediaRoutesObserverAssignsCurrentCastModes); + UIMediaRoutesObserverAssignsCurrentCastModes); FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, - UIMediaRoutesObserverSkipsUnavailableCastModes); + UIMediaRoutesObserverSkipsUnavailableCastModes); FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, GetExtensionNameExtensionPresent); FRIEND_TEST_ALL_PREFIXES(MediaRouterUITest, GetExtensionNameEmptyWhenNotInstalled); @@ -251,6 +261,16 @@ class MediaRouterUI : public ConstrainedWebDialogUI, static std::string GetExtensionName(const GURL& url, extensions::ExtensionRegistry* registry); + // Retrieves the browser associated with this UI. + Browser* GetBrowser(); + + // Opens the URL in a tab which is then |initator_|. + void OpenTabWithUrl(const GURL url); + + // Methods for MediaRouterFileDialogDelegate + void FileDialogFileSelected(const ui::SelectedFileInfo& file_info) override; + void FileDialogSelectionFailed(const IssueInfo& issue) override; + // QueryResultManager::Observer void OnResultsUpdated( const std::vector<MediaSinkWithCastModes>& sinks) override; @@ -274,6 +294,13 @@ class MediaRouterUI : public ConstrainedWebDialogUI, const base::string16& presentation_request_source_name, const RouteRequestResult& result); + // Logs a UMA stat for the source that was cast if the result is successful. + void MaybeReportCastingSource(MediaCastMode cast_mode, + const RouteRequestResult& result); + // Sends a request to the file dialog to log UMA stats for the file that was + // cast if the result is successful. + void MaybeReportFileInformation(const RouteRequestResult& result); + // Closes the dialog after receiving a route response when using // |create_session_request_|. This prevents the dialog from trying to use the // same presentation request again. @@ -319,7 +346,7 @@ class MediaRouterUI : public ConstrainedWebDialogUI, // match the value of |routes_|. void UpdateRoutesToCastModesMapping(); - // Returns the default presentation request's frame URL if there is one. + // Returns the default PresentationRequest's frame URL if there is one. // Otherwise returns an empty GURL. GURL GetFrameURL() const; @@ -388,6 +415,9 @@ class MediaRouterUI : public ConstrainedWebDialogUI, // Pointer to the MediaRouter for this instance's BrowserContext. MediaRouter* router_; + // Request manager for the Media Router component extension. + const EventPageRequestManager* event_page_request_manager_; + // The start time for UI initialization metrics timer. When a dialog has been // been painted and initialized with initial data, this should be cleared. base::Time start_time_; @@ -396,6 +426,10 @@ class MediaRouterUI : public ConstrainedWebDialogUI, // updates. std::unique_ptr<UIMediaRouteControllerObserver> route_controller_observer_; + // The dialog that handles opening the file dialog and validating and + // returning the results. + std::unique_ptr<MediaRouterFileDialog> media_router_file_dialog_; + // If set, a cast mode that is required to be shown first. base::Optional<MediaCastMode> forced_cast_mode_; |