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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/presentation/presentation_service_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/media/router/presentation_service_delegate_impl.h" 5 #include "chrome/browser/media/router/presentation_service_delegate_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/containers/scoped_ptr_hash_map.h" 9 #include "base/containers/scoped_ptr_hash_map.h"
10 #include "base/containers/small_map.h" 10 #include "base/containers/small_map.h"
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 &PresentationServiceDelegateImpl::OnJoinRouteResponse, 603 &PresentationServiceDelegateImpl::OnJoinRouteResponse,
604 weak_factory_.GetWeakPtr(), render_process_id, render_frame_id, 604 weak_factory_.GetWeakPtr(), render_process_id, render_frame_id,
605 content::PresentationSessionInfo(presentation_url, presentation_id), 605 content::PresentationSessionInfo(presentation_url, presentation_id),
606 success_cb, error_cb)); 606 success_cb, error_cb));
607 } 607 }
608 608
609 void PresentationServiceDelegateImpl::ListenForSessionMessages( 609 void PresentationServiceDelegateImpl::ListenForSessionMessages(
610 int render_process_id, 610 int render_process_id,
611 int render_frame_id, 611 int render_frame_id,
612 const PresentationSessionMessageCallback& message_cb) { 612 const PresentationSessionMessageCallback& message_cb) {
613 // BUG=464205 613 const auto& route_ids = frame_manager_->GetRouteIds(
imcheng (use chromium acct) 2015/06/22 21:08:07 Please spell out the type instead of using auto he
haibinlu 2015/06/22 23:22:40 Done.
614 NOTIMPLEMENTED(); 614 RenderFrameHostId(render_process_id, render_frame_id));
615 if (route_ids.size() == 0) {
imcheng (use chromium acct) 2015/06/22 21:08:07 nit: if (route_ids.empty())
haibinlu 2015/06/22 23:22:40 Done.
616 DVLOG(1) << "No media routes found";
617 return;
imcheng (use chromium acct) 2015/06/22 21:08:07 It looks like the callback need to be invoked in t
haibinlu 2015/06/22 23:22:40 Done.
618 }
619
620 router_->ListenForRouteMessages(route_ids, message_cb);
615 } 621 }
616 622
617 void PresentationServiceDelegateImpl::SendMessage( 623 void PresentationServiceDelegateImpl::SendMessage(
618 int render_process_id, 624 int render_process_id,
619 int render_frame_id, 625 int render_frame_id,
620 scoped_ptr<content::PresentationSessionMessage> message_request, 626 scoped_ptr<content::PresentationSessionMessage> message_request,
621 const SendMessageCallback& send_message_cb) { 627 const SendMessageCallback& send_message_cb) {
622 // BUG=464205 628 const MediaRoute::Id& route_id = frame_manager_->GetRouteId(
623 NOTIMPLEMENTED(); 629 RenderFrameHostId(render_process_id, render_frame_id),
630 message_request->presentation_id);
631 if (route_id.empty()) {
632 DVLOG(1) << "Presentation session was already closed: "
imcheng (use chromium acct) 2015/06/22 21:08:07 nit: maybe "Presentation session does not exist: "
haibinlu 2015/06/22 23:22:41 Done.
633 << message_request->presentation_id;
634 return;
imcheng (use chromium acct) 2015/06/22 21:08:07 ditto on invoking the callback in early returns he
haibinlu 2015/06/22 23:22:40 Done.
635 }
636 if (message_request->is_binary()) {
637 DVLOG(1) << "Binary message is not supported yet.";
638 return;
639 }
640 router_->SendRouteMessage(route_id, *(message_request->message.get()),
Kevin M 2015/06/22 22:42:26 .get() is unnecessary here.
haibinlu 2015/06/22 23:22:40 Done.
641 send_message_cb);
624 } 642 }
625 643
626 void PresentationServiceDelegateImpl::OnRouteCreated(const MediaRoute& route) { 644 void PresentationServiceDelegateImpl::OnRouteCreated(const MediaRoute& route) {
627 const MediaSource& source = route.media_source(); 645 const MediaSource& source = route.media_source();
628 DCHECK(!source.Empty()); 646 DCHECK(!source.Empty());
629 if (!default_source_.Equals(source)) 647 if (!default_source_.Equals(source))
630 return; 648 return;
631 RenderFrameHost* main_frame = web_contents_->GetMainFrame(); 649 RenderFrameHost* main_frame = web_contents_->GetMainFrame();
632 if (!main_frame) 650 if (!main_frame)
633 return; 651 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( 684 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest(
667 int render_process_id, 685 int render_process_id,
668 int render_frame_id, 686 int render_frame_id,
669 const MediaSource::Id& source_id) const { 687 const MediaSource::Id& source_id) const {
670 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); 688 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id);
671 return frame_manager_->HasScreenAvailabilityListenerForTest( 689 return frame_manager_->HasScreenAvailabilityListenerForTest(
672 render_frame_host_id, source_id); 690 render_frame_host_id, source_id);
673 } 691 }
674 692
675 } // namespace media_router 693 } // namespace media_router
OLDNEW
« 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