OLD | NEW |
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 #include <utility> |
8 | 9 |
9 #include "base/containers/scoped_ptr_hash_map.h" | 10 #include "base/containers/scoped_ptr_hash_map.h" |
10 #include "base/containers/small_map.h" | 11 #include "base/containers/small_map.h" |
11 #include "base/guid.h" | 12 #include "base/guid.h" |
12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
14 #include "chrome/browser/media/router/create_presentation_connection_request.h" | 15 #include "chrome/browser/media/router/create_presentation_connection_request.h" |
15 #include "chrome/browser/media/router/media_route.h" | 16 #include "chrome/browser/media/router/media_route.h" |
16 #include "chrome/browser/media/router/media_router.h" | 17 #include "chrome/browser/media/router/media_router.h" |
17 #include "chrome/browser/media/router/media_router_dialog_controller.h" | 18 #include "chrome/browser/media/router/media_router_dialog_controller.h" |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 scoped_ptr<CreatePresentationConnectionRequest> request( | 712 scoped_ptr<CreatePresentationConnectionRequest> request( |
712 new CreatePresentationConnectionRequest( | 713 new CreatePresentationConnectionRequest( |
713 render_frame_host_id, presentation_url, | 714 render_frame_host_id, presentation_url, |
714 GetLastCommittedURLForFrame(render_frame_host_id), | 715 GetLastCommittedURLForFrame(render_frame_host_id), |
715 base::Bind(&PresentationServiceDelegateImpl::OnStartSessionSucceeded, | 716 base::Bind(&PresentationServiceDelegateImpl::OnStartSessionSucceeded, |
716 weak_factory_.GetWeakPtr(), render_process_id, | 717 weak_factory_.GetWeakPtr(), render_process_id, |
717 render_frame_id, success_cb), | 718 render_frame_id, success_cb), |
718 error_cb)); | 719 error_cb)); |
719 MediaRouterDialogController* controller = | 720 MediaRouterDialogController* controller = |
720 MediaRouterDialogController::GetOrCreateForWebContents(web_contents_); | 721 MediaRouterDialogController::GetOrCreateForWebContents(web_contents_); |
721 if (!controller->ShowMediaRouterDialogForPresentation(request.Pass())) { | 722 if (!controller->ShowMediaRouterDialogForPresentation(std::move(request))) { |
722 LOG(ERROR) << "Media router dialog already exists. Ignoring StartSession."; | 723 LOG(ERROR) << "Media router dialog already exists. Ignoring StartSession."; |
723 error_cb.Run(content::PresentationError(content::PRESENTATION_ERROR_UNKNOWN, | 724 error_cb.Run(content::PresentationError(content::PRESENTATION_ERROR_UNKNOWN, |
724 "Unable to create dialog.")); | 725 "Unable to create dialog.")); |
725 return; | 726 return; |
726 } | 727 } |
727 } | 728 } |
728 | 729 |
729 void PresentationServiceDelegateImpl::JoinSession( | 730 void PresentationServiceDelegateImpl::JoinSession( |
730 int render_process_id, | 731 int render_process_id, |
731 int render_frame_id, | 732 int render_frame_id, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 const MediaRoute::Id& route_id = frame_manager_->GetRouteId( | 801 const MediaRoute::Id& route_id = frame_manager_->GetRouteId( |
801 RenderFrameHostId(render_process_id, render_frame_id), | 802 RenderFrameHostId(render_process_id, render_frame_id), |
802 session.presentation_id); | 803 session.presentation_id); |
803 if (route_id.empty()) { | 804 if (route_id.empty()) { |
804 DVLOG(1) << "No active route for " << session.presentation_id; | 805 DVLOG(1) << "No active route for " << session.presentation_id; |
805 send_message_cb.Run(false); | 806 send_message_cb.Run(false); |
806 return; | 807 return; |
807 } | 808 } |
808 | 809 |
809 if (message->is_binary()) { | 810 if (message->is_binary()) { |
810 router_->SendRouteBinaryMessage(route_id, message->data.Pass(), | 811 router_->SendRouteBinaryMessage(route_id, std::move(message->data), |
811 send_message_cb); | 812 send_message_cb); |
812 } else { | 813 } else { |
813 router_->SendRouteMessage(route_id, message->message, send_message_cb); | 814 router_->SendRouteMessage(route_id, message->message, send_message_cb); |
814 } | 815 } |
815 } | 816 } |
816 | 817 |
817 void PresentationServiceDelegateImpl::ListenForConnectionStateChange( | 818 void PresentationServiceDelegateImpl::ListenForConnectionStateChange( |
818 int render_process_id, | 819 int render_process_id, |
819 int render_frame_id, | 820 int render_frame_id, |
820 const content::PresentationSessionInfo& connection, | 821 const content::PresentationSessionInfo& connection, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( | 874 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( |
874 int render_process_id, | 875 int render_process_id, |
875 int render_frame_id, | 876 int render_frame_id, |
876 const MediaSource::Id& source_id) const { | 877 const MediaSource::Id& source_id) const { |
877 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); | 878 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); |
878 return frame_manager_->HasScreenAvailabilityListenerForTest( | 879 return frame_manager_->HasScreenAvailabilityListenerForTest( |
879 render_frame_host_id, source_id); | 880 render_frame_host_id, source_id); |
880 } | 881 } |
881 | 882 |
882 } // namespace media_router | 883 } // namespace media_router |
OLD | NEW |