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

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: Update presentation_service_impl_unittest Created 5 years, 5 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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 DVLOG(1) << "No active route for: " << presentation_id; 616 DVLOG(1) << "No active route for: " << presentation_id;
617 return; 617 return;
618 } 618 }
619 router_->CloseRoute(route_id); 619 router_->CloseRoute(route_id);
620 } 620 }
621 621
622 void PresentationServiceDelegateImpl::ListenForSessionMessages( 622 void PresentationServiceDelegateImpl::ListenForSessionMessages(
623 int render_process_id, 623 int render_process_id,
624 int render_frame_id, 624 int render_frame_id,
625 const PresentationSessionMessageCallback& message_cb) { 625 const PresentationSessionMessageCallback& message_cb) {
626 // BUG=464205 626 const std::vector<MediaRoute::Id>& route_ids = frame_manager_->GetRouteIds(
627 NOTIMPLEMENTED(); 627 RenderFrameHostId(render_process_id, render_frame_id));
628 if (route_ids.empty()) {
629 DVLOG(1) << "No media routes found";
630 message_cb.Run(
631 scoped_ptr<ScopedVector<content::PresentationSessionMessage>>());
632 return;
633 }
634
635 router_->ListenForRouteMessages(route_ids, message_cb);
628 } 636 }
629 637
630 void PresentationServiceDelegateImpl::SendMessage( 638 void PresentationServiceDelegateImpl::SendMessage(
631 int render_process_id, 639 int render_process_id,
632 int render_frame_id, 640 int render_frame_id,
633 scoped_ptr<content::PresentationSessionMessage> message_request, 641 scoped_ptr<content::PresentationSessionMessage> message_request,
634 const SendMessageCallback& send_message_cb) { 642 const SendMessageCallback& send_message_cb) {
635 // BUG=464205 643 if (message_request->is_binary()) {
636 NOTIMPLEMENTED(); 644 NOTIMPLEMENTED();
645 send_message_cb.Run(false);
646 return;
647 }
648 const MediaRoute::Id& route_id = frame_manager_->GetRouteId(
649 RenderFrameHostId(render_process_id, render_frame_id),
650 message_request->presentation_id);
651 if (route_id.empty()) {
652 DVLOG(1) << "No active route for " << message_request->presentation_id;
653 send_message_cb.Run(false);
654 return;
655 }
656 router_->SendRouteMessage(route_id, *(message_request->message),
657 send_message_cb);
637 } 658 }
638 659
639 void PresentationServiceDelegateImpl::OnRouteCreated(const MediaRoute& route) { 660 void PresentationServiceDelegateImpl::OnRouteCreated(const MediaRoute& route) {
640 const MediaSource& source = route.media_source(); 661 const MediaSource& source = route.media_source();
641 DCHECK(!source.Empty()); 662 DCHECK(!source.Empty());
642 if (!default_source_.Equals(source)) 663 if (!default_source_.Equals(source))
643 return; 664 return;
644 RenderFrameHost* main_frame = web_contents_->GetMainFrame(); 665 RenderFrameHost* main_frame = web_contents_->GetMainFrame();
645 if (!main_frame) 666 if (!main_frame)
646 return; 667 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( 700 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest(
680 int render_process_id, 701 int render_process_id,
681 int render_frame_id, 702 int render_frame_id,
682 const MediaSource::Id& source_id) const { 703 const MediaSource::Id& source_id) const {
683 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); 704 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id);
684 return frame_manager_->HasScreenAvailabilityListenerForTest( 705 return frame_manager_->HasScreenAvailabilityListenerForTest(
685 render_frame_host_id, source_id); 706 render_frame_host_id, source_id);
686 } 707 }
687 708
688 } // namespace media_router 709 } // 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