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

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 std::vector<MediaRoute::Id>& route_ids = frame_manager_->GetRouteIds(
614 NOTIMPLEMENTED(); 614 RenderFrameHostId(render_process_id, render_frame_id));
615 if (route_ids.empty()) {
616 DVLOG(1) << "No media routes found";
617 scoped_ptr<ScopedVector<content::PresentationSessionMessage>> empty_list(
618 new ScopedVector<content::PresentationSessionMessage>());
619 message_cb.Run(empty_list.Pass());
imcheng (use chromium acct) 2015/06/23 21:59:37 why not just message_cb.Run(scoped_ptr<ScopedVecto
haibinlu 2015/06/23 23:36:14 Done.
620 return;
621 }
622
623 router_->ListenForRouteMessages(route_ids, message_cb);
615 } 624 }
616 625
617 void PresentationServiceDelegateImpl::SendMessage( 626 void PresentationServiceDelegateImpl::SendMessage(
618 int render_process_id, 627 int render_process_id,
619 int render_frame_id, 628 int render_frame_id,
620 scoped_ptr<content::PresentationSessionMessage> message_request, 629 scoped_ptr<content::PresentationSessionMessage> message_request,
621 const SendMessageCallback& send_message_cb) { 630 const SendMessageCallback& send_message_cb) {
622 // BUG=464205 631 if (message_request->is_binary()) {
imcheng (use chromium acct) 2015/06/23 21:59:37 Also need to run callback and return early in this
haibinlu 2015/06/23 23:36:14 Done.
623 NOTIMPLEMENTED(); 632 NOTIMPLEMENTED();
633 }
634 const MediaRoute::Id& route_id = frame_manager_->GetRouteId(
635 RenderFrameHostId(render_process_id, render_frame_id),
636 message_request->presentation_id);
637 if (route_id.empty()) {
638 DVLOG(1) << "No active route for " << message_request->presentation_id;
639 send_message_cb.Run(false);
640 return;
641 }
642 router_->SendRouteMessage(route_id, *(message_request->message),
643 send_message_cb);
624 } 644 }
625 645
626 void PresentationServiceDelegateImpl::OnRouteCreated(const MediaRoute& route) { 646 void PresentationServiceDelegateImpl::OnRouteCreated(const MediaRoute& route) {
627 const MediaSource& source = route.media_source(); 647 const MediaSource& source = route.media_source();
628 DCHECK(!source.Empty()); 648 DCHECK(!source.Empty());
629 if (!default_source_.Equals(source)) 649 if (!default_source_.Equals(source))
630 return; 650 return;
631 RenderFrameHost* main_frame = web_contents_->GetMainFrame(); 651 RenderFrameHost* main_frame = web_contents_->GetMainFrame();
632 if (!main_frame) 652 if (!main_frame)
633 return; 653 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( 686 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest(
667 int render_process_id, 687 int render_process_id,
668 int render_frame_id, 688 int render_frame_id,
669 const MediaSource::Id& source_id) const { 689 const MediaSource::Id& source_id) const {
670 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); 690 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id);
671 return frame_manager_->HasScreenAvailabilityListenerForTest( 691 return frame_manager_->HasScreenAvailabilityListenerForTest(
672 render_frame_host_id, source_id); 692 render_frame_host_id, source_id);
673 } 693 }
674 694
675 } // namespace media_router 695 } // 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