| 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 c2d1dca6bb142f6f89d2a255b89ec4e9d4ee6c49..d59d9cc1988c2bbfb1a6a719efb3278478f1c1d4 100644
|
| --- a/chrome/browser/ui/webui/media_router/media_router_ui.h
|
| +++ b/chrome/browser/ui/webui/media_router/media_router_ui.h
|
| @@ -13,8 +13,10 @@
|
| #include "base/gtest_prod_util.h"
|
| #include "base/macros.h"
|
| #include "base/memory/weak_ptr.h"
|
| +#include "base/optional.h"
|
| #include "base/timer/timer.h"
|
| #include "chrome/browser/media/router/issue.h"
|
| +#include "chrome/browser/media/router/media_route_status_observer.h"
|
| #include "chrome/browser/media/router/media_source.h"
|
| #include "chrome/browser/media/router/presentation_service_delegate_impl.h"
|
| #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
|
| @@ -164,6 +166,20 @@ class MediaRouterUI : public ConstrainedWebDialogUI,
|
|
|
| void UpdateMaxDialogHeight(int height);
|
|
|
| + // Sends media commands to |route_controller_| if it is set.
|
| + void PlayRoute();
|
| + void PauseRoute();
|
| + void SeekRoute(uint32_t time);
|
| + void SetRouteMute(bool mute);
|
| + void SetRouteVolume(float volume);
|
| +
|
| + // Gets a reference to the MediaRouteController for |route_id| and
|
| + // instantiates an observer for media status updates for the route.
|
| + void OnUIDetailsViewOpened(MediaRoute::Id route_id);
|
| +
|
| + // Resets |route_controller_| and |route_status_observer_|.
|
| + void OnUIDetailsViewClosed();
|
| +
|
| void InitForTest(MediaRouter* router,
|
| content::WebContents* initiator,
|
| MediaRouterWebUIMessageHandler* handler,
|
| @@ -212,6 +228,20 @@ class MediaRouterUI : public ConstrainedWebDialogUI,
|
| DISALLOW_COPY_AND_ASSIGN(UIMediaRoutesObserver);
|
| };
|
|
|
| + class UIMediaRouteStatusObserver : public MediaRouteStatusObserver {
|
| + public:
|
| + UIMediaRouteStatusObserver(MediaRouterWebUIMessageHandler* handler);
|
| + ~UIMediaRouteStatusObserver() override;
|
| +
|
| + // MediaRouteStatusObserver
|
| + void OnMediaRouteStatusUpdated(const MediaStatus& status) override;
|
| +
|
| + private:
|
| + MediaRouterWebUIMessageHandler* handler_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(UIMediaRouteStatusObserver);
|
| + };
|
| +
|
| static std::string GetExtensionName(const GURL& url,
|
| extensions::ExtensionRegistry* registry);
|
|
|
| @@ -291,6 +321,9 @@ class MediaRouterUI : public ConstrainedWebDialogUI,
|
| // opaque origin ("null") if |initiator_| is not set.
|
| std::string GetSerializedInitiatorOrigin() const;
|
|
|
| + // Returns true if |routes_| contains a route with |route_id|.
|
| + bool IsValidRouteId(const MediaRoute::Id& route_id) const;
|
| +
|
| // Owned by the |web_ui| passed in the ctor, and guaranteed to be deleted
|
| // only after it has deleted |this|.
|
| MediaRouterWebUIMessageHandler* handler_ = nullptr;
|
| @@ -348,6 +381,16 @@ class MediaRouterUI : public ConstrainedWebDialogUI,
|
| // been painted and initialized with initial data, this should be cleared.
|
| base::Time start_time_;
|
|
|
| + // The ID of the media route shown in the route details view.
|
| + base::Optional<MediaRoute::Id> selected_route_;
|
| +
|
| + // The media controller for |selected_route_|.
|
| + MediaRouteController* route_controller_ = nullptr;
|
| +
|
| + // The observer for the media status of |selected_route_| that notifies
|
| + // |handler_| of updates.
|
| + std::unique_ptr<UIMediaRouteStatusObserver> route_status_observer_;
|
| +
|
| // NOTE: Weak pointers must be invalidated before all other member variables.
|
| // Therefore |weak_factory_| must be placed at the end.
|
| base::WeakPtrFactory<MediaRouterUI> weak_factory_;
|
|
|