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

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

Issue 2951523002: Media Remoting: Add mojo interfaces between browser and extension. (Closed)
Patch Set: Fix compile failure on Android bots. Created 3 years, 6 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.cc
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
index e101f47c7322a3760f03919c4094bc2c294644f4..cd45e11211d0514655ddf3d7b15847a8b36d8470 100644
--- a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
+++ b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_tab_helper.h"
#include "chrome/common/media_router/media_source_helper.h"
+#include "chrome/common/media_router/mojo/media_router.mojom.h"
#include "chrome/common/media_router/route_message.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/process_manager.h"
@@ -1130,4 +1131,44 @@ void MediaRouterMojoImpl::OnMediaControllerCreated(
MediaRouterMojoMetrics::RecordMediaRouteControllerCreationResult(success);
}
+void MediaRouterMojoImpl::RegisterRemotingSource(
imcheng 2017/06/22 01:13:27 It seems this logic could actually go into MediaRo
xjz 2017/06/23 19:02:41 Done.
+ int32_t tab_id,
+ CastRemotingConnector* remoting_source) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ DVLOG_WITH_INSTANCE(1) << "RegisterRemotingSource " << tab_id;
+
+ auto it = remoting_sources_.find(tab_id);
+ if (it != remoting_sources_.end()) {
+ DCHECK(remoting_source == it->second);
+ return;
+ }
+ remoting_sources_.emplace(tab_id, std::move(remoting_source));
+}
+
+void MediaRouterMojoImpl::UnRegisterRemotingSource(
+ int32_t tab_id,
+ CastRemotingConnector* remoting_source) {
imcheng 2017/06/22 01:13:27 I'm not sure if you need to pass in remoting_sourc
xjz 2017/06/23 19:02:41 Removed.
+ auto it = remoting_sources_.find(tab_id);
+ DCHECK(it != remoting_sources_.end());
+ DCHECK(it->second == remoting_source);
+ remoting_sources_.erase(it);
+}
+
+void MediaRouterMojoImpl::OnMediaRemoterCreated(
+ int32_t tab_id,
+ media::mojom::MirrorServiceRemoterPtr remoter,
+ media::mojom::MirrorServiceRemotingSourceRequest source_request) {
+ DVLOG_WITH_INSTANCE(1) << __func__ << ": tab_id = " << tab_id;
+
+ auto it = remoting_sources_.find(tab_id);
+ if (it == remoting_sources_.end()) {
+ LOG(WARNING) << __func__
+ << ": No registered remoting source for tab_id = " << tab_id;
+ return;
+ }
+
+ CastRemotingConnector* connector = it->second;
+ connector->ConnectToService(std::move(source_request), std::move(remoter));
+}
+
} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698