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

Unified Diff: chrome/browser/media/router/presentation_service_delegate_impl.cc

Issue 1199933006: [MediaRouter] wireup send/receive messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update presentation_service_impl_unittest Created 5 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
« no previous file with comments | « no previous file | content/browser/presentation/presentation_service_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/router/presentation_service_delegate_impl.cc
diff --git a/chrome/browser/media/router/presentation_service_delegate_impl.cc b/chrome/browser/media/router/presentation_service_delegate_impl.cc
index b46c3f11e7cb7ed050ce776adb629eaf48912302..46649aed7be80842b89ef346c02aaf776d9f0145 100644
--- a/chrome/browser/media/router/presentation_service_delegate_impl.cc
+++ b/chrome/browser/media/router/presentation_service_delegate_impl.cc
@@ -623,8 +623,16 @@ void PresentationServiceDelegateImpl::ListenForSessionMessages(
int render_process_id,
int render_frame_id,
const PresentationSessionMessageCallback& message_cb) {
- // BUG=464205
- NOTIMPLEMENTED();
+ const std::vector<MediaRoute::Id>& route_ids = frame_manager_->GetRouteIds(
+ RenderFrameHostId(render_process_id, render_frame_id));
+ if (route_ids.empty()) {
+ DVLOG(1) << "No media routes found";
+ message_cb.Run(
+ scoped_ptr<ScopedVector<content::PresentationSessionMessage>>());
+ return;
+ }
+
+ router_->ListenForRouteMessages(route_ids, message_cb);
}
void PresentationServiceDelegateImpl::SendMessage(
@@ -632,8 +640,21 @@ void PresentationServiceDelegateImpl::SendMessage(
int render_frame_id,
scoped_ptr<content::PresentationSessionMessage> message_request,
const SendMessageCallback& send_message_cb) {
- // BUG=464205
- NOTIMPLEMENTED();
+ if (message_request->is_binary()) {
+ NOTIMPLEMENTED();
+ send_message_cb.Run(false);
+ return;
+ }
+ const MediaRoute::Id& route_id = frame_manager_->GetRouteId(
+ RenderFrameHostId(render_process_id, render_frame_id),
+ message_request->presentation_id);
+ if (route_id.empty()) {
+ DVLOG(1) << "No active route for " << message_request->presentation_id;
+ send_message_cb.Run(false);
+ return;
+ }
+ router_->SendRouteMessage(route_id, *(message_request->message),
+ send_message_cb);
}
void PresentationServiceDelegateImpl::OnRouteCreated(const MediaRoute& route) {
« no previous file with comments | « no previous file | content/browser/presentation/presentation_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698