Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3967)

Unified Diff: chrome/browser/media/router/mojo/media_router_mojo_impl.h

Issue 2728543009: [Media Router] Custom Controls 2 - add MediaRouter::GetRouteController() (Closed)
Patch Set: Address Daniel's and Derek's comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/router/mojo/media_router_mojo_impl.h
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl.h b/chrome/browser/media/router/mojo/media_router_mojo_impl.h
index 8601ffeac592a74f94f67a6ec435b5ce1fc446a4..a9430c253e6ac167e64722e1166c7ffc54b53b7c 100644
--- a/chrome/browser/media/router/mojo/media_router_mojo_impl.h
+++ b/chrome/browser/media/router/mojo/media_router_mojo_impl.h
@@ -109,6 +109,8 @@ class MediaRouterMojoImpl : public MediaRouterBase,
const std::string& search_input,
const std::string& domain,
const MediaSinkSearchResponseCallback& sink_callback) override;
+ scoped_refptr<MediaRouteController> GetRouteController(
+ const MediaRoute::Id& route_id) override;
const std::string& media_route_provider_extension_id() const {
return media_route_provider_extension_id_;
@@ -142,6 +144,8 @@ class MediaRouterMojoImpl : public MediaRouterBase,
FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest,
RouteMessagesMultipleObservers);
FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest, HandleIssue);
+ FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoImplTest,
+ GetRouteControllerAfterRouteInvalidation);
FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest,
DeferredBindingAndSuspension);
FRIEND_TEST_ALL_PREFIXES(MediaRouterMojoExtensionTest,
@@ -234,6 +238,8 @@ class MediaRouterMojoImpl : public MediaRouterBase,
void UnregisterIssuesObserver(IssuesObserver* observer) override;
void RegisterRouteMessageObserver(RouteMessageObserver* observer) override;
void UnregisterRouteMessageObserver(RouteMessageObserver* observer) override;
+ void DetachRouteController(const MediaRoute::Id& route_id,
+ MediaRouteController* controller) override;
// Notifies |observer| of any existing cached routes, if it is still
// registered.
@@ -373,6 +379,13 @@ class MediaRouterMojoImpl : public MediaRouterBase,
void UpdateMediaSinks(const MediaSource::Id& source_id);
void DoUpdateMediaSinks(const MediaSource::Id& source_id);
+ // Invalidates and removes controllers from |route_controllers_| whose media
+ // routes do not appear in |routes|.
+ void RemoveInvalidRouteControllers(const std::vector<MediaRoute>& routes);
+
+ // Callback called by MRP's CreateMediaRouteController().
+ void OnMediaControllerCreated(const MediaRoute::Id& route_id, bool success);
+
// Pending requests queued to be executed once component extension
// becomes ready.
std::deque<base::Closure> pending_requests_;
@@ -426,6 +439,10 @@ class MediaRouterMojoImpl : public MediaRouterBase,
// initial event page wakeup attempt.
bool provider_version_was_recorded_ = false;
+ // Stores route controllers that can be used to send media commands to the
+ // extension.
+ std::unordered_map<MediaRoute::Id, MediaRouteController*> route_controllers_;
+
#if defined(OS_WIN)
// A pair of flags to ensure that mDNS discovery is only enabled on Windows
// when there will be appropriate context for the user to associate a firewall

Powered by Google App Engine
This is Rietveld 408576698