| 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 d0c574cfd30e5b0d9beee443660035d56d5e9618..cf76fdcec37b6b9ba3d1907bd74da39e39770b47 100644
 | 
| --- a/chrome/browser/media/router/presentation_service_delegate_impl.cc
 | 
| +++ b/chrome/browser/media/router/presentation_service_delegate_impl.cc
 | 
| @@ -461,7 +461,6 @@ void PresentationFrameManager::OnPresentationSessionStarted(
 | 
|  }
 | 
|  
 | 
|  void PresentationFrameManager::OnDefaultPresentationSessionStarted(
 | 
| -    const PresentationRequest& request,
 | 
|      const content::PresentationSessionInfo& session,
 | 
|      const MediaRoute::Id& route_id) {
 | 
|    const auto it = presentation_frames_.find(request.render_frame_host_id());
 | 
| @@ -538,20 +537,20 @@ void PresentationFrameManager::ListenForSessionMessages(
 | 
|    it->second->ListenForSessionMessages(session, message_cb);
 | 
|  }
 | 
|  
 | 
| -void PresentationFrameManager::SetDefaultPresentationUrl(
 | 
| +void PresentationFrameManager::SetDefaultPresentationUrls(
 | 
|      const RenderFrameHostId& render_frame_host_id,
 | 
| -    const GURL& default_presentation_url,
 | 
| +    const vector<GURL>& default_presentation_urls,
 | 
|      const content::PresentationSessionStartedCallback& callback) {
 | 
|    if (!IsMainFrame(render_frame_host_id))
 | 
|      return;
 | 
|  
 | 
| -  if (default_presentation_url.is_empty()) {
 | 
| +  if (default_presentation_urls.is_empty()) {
 | 
|      ClearDefaultPresentationRequest();
 | 
|    } else {
 | 
|      DCHECK(!callback.is_null());
 | 
|      GURL frame_url(GetLastCommittedURLForFrame(render_frame_host_id));
 | 
|      PresentationRequest request(render_frame_host_id,
 | 
| -                                std::vector<GURL>({default_presentation_url}),
 | 
| +                                default_presentation_urls,
 | 
|                                  frame_url);
 | 
|      default_presentation_started_callback_ = callback;
 | 
|      SetDefaultPresentationRequest(request);
 | 
| @@ -718,14 +717,8 @@ void PresentationServiceDelegateImpl::SetDefaultPresentationUrls(
 | 
|      const std::vector<GURL>& default_presentation_urls,
 | 
|      const content::PresentationSessionStartedCallback& callback) {
 | 
|    RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id);
 | 
| -  if (default_presentation_urls.empty()) {
 | 
| -    frame_manager_->SetDefaultPresentationUrl(render_frame_host_id, GURL(),
 | 
| -                                              callback);
 | 
| -  } else {
 | 
| -    // TODO(crbug.com/627655): Handle multiple URLs.
 | 
| -    frame_manager_->SetDefaultPresentationUrl(
 | 
| -        render_frame_host_id, default_presentation_urls[0], callback);
 | 
| -  }
 | 
| +  frame_manager_->SetDefaultPresentationUrls(
 | 
| +      render_frame_host_id, default_presentation_urls, callback);
 | 
|  }
 | 
|  
 | 
|  void PresentationServiceDelegateImpl::OnJoinRouteResponse(
 | 
| @@ -779,9 +772,8 @@ void PresentationServiceDelegateImpl::StartSession(
 | 
|      return;
 | 
|    }
 | 
|  
 | 
| -  // TODO(crbug.com/627655): Handle multiple URLs.
 | 
| -  const GURL& presentation_url = presentation_urls[0];
 | 
| -  if (presentation_url.is_empty() ||
 | 
| +  if (presentation_urls.is_empty() ||
 | 
| +      std::find_if(
 | 
|        !IsValidPresentationUrl(presentation_url)) {
 | 
|      error_cb.Run(content::PresentationError(content::PRESENTATION_ERROR_UNKNOWN,
 | 
|                                              "Invalid presentation arguments."));
 | 
| @@ -791,7 +783,7 @@ void PresentationServiceDelegateImpl::StartSession(
 | 
|    RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id);
 | 
|    std::unique_ptr<CreatePresentationConnectionRequest> request(
 | 
|        new CreatePresentationConnectionRequest(
 | 
| -          render_frame_host_id, presentation_url,
 | 
| +          render_frame_host_id, presentation_urls,
 | 
|            GetLastCommittedURLForFrame(render_frame_host_id),
 | 
|            base::Bind(&PresentationServiceDelegateImpl::OnStartSessionSucceeded,
 | 
|                       weak_factory_.GetWeakPtr(), render_process_id,
 | 
| @@ -820,21 +812,20 @@ void PresentationServiceDelegateImpl::JoinSession(
 | 
|          "Invalid presentation arguments."));
 | 
|    }
 | 
|  
 | 
| -  // TODO(crbug.com/627655): Handle multiple URLs.
 | 
| -  const GURL& presentation_url = presentation_urls[0];
 | 
| -  bool incognito = web_contents_->GetBrowserContext()->IsOffTheRecord();
 | 
| -  std::vector<MediaRouteResponseCallback> route_response_callbacks;
 | 
| -  route_response_callbacks.push_back(base::Bind(
 | 
| -      &PresentationServiceDelegateImpl::OnJoinRouteResponse,
 | 
| -      weak_factory_.GetWeakPtr(), render_process_id, render_frame_id,
 | 
| -      content::PresentationSessionInfo(presentation_url, presentation_id),
 | 
| -      success_cb, error_cb));
 | 
| -  router_->JoinRoute(
 | 
| -      MediaSourceForPresentationUrl(presentation_url).id(), presentation_id,
 | 
| -      GetLastCommittedURLForFrame(
 | 
| -          RenderFrameHostId(render_process_id, render_frame_id))
 | 
| -          .GetOrigin(),
 | 
| -      web_contents_, route_response_callbacks, base::TimeDelta(), incognito);
 | 
| +  // TODO: Needs work
 | 
| +  // bool incognito = web_contents_->GetBrowserContext()->IsOffTheRecord();
 | 
| +  // std::vector<MediaRouteResponseCallback> route_response_callbacks;
 | 
| +  // route_response_callbacks.push_back(base::Bind(
 | 
| +  //     &PresentationServiceDelegateImpl::OnJoinRouteResponse,
 | 
| +  //     weak_factory_.GetWeakPtr(), render_process_id, render_frame_id,
 | 
| +  //     content::PresentationSessionInfo(presentation_urls, presentation_id),
 | 
| +  //     success_cb, error_cb));
 | 
| +  // router_->JoinRoute(
 | 
| +  //     MediaSourceForPresentationUrl(presentation_url).id(), presentation_id,
 | 
| +  //     GetLastCommittedURLForFrame(
 | 
| +  //         RenderFrameHostId(render_process_id, render_frame_id))
 | 
| +  //         .GetOrigin(),
 | 
| +  //     web_contents_, route_response_callbacks, base::TimeDelta(), incognito);
 | 
|  }
 | 
|  
 | 
|  void PresentationServiceDelegateImpl::CloseConnection(
 | 
| @@ -917,12 +908,16 @@ void PresentationServiceDelegateImpl::ListenForConnectionStateChange(
 | 
|  
 | 
|  void PresentationServiceDelegateImpl::OnRouteResponse(
 | 
|      const PresentationRequest& presentation_request,
 | 
| +    const GURL& presentation_url,
 | 
|      const RouteRequestResult& result) {
 | 
| -  if (!result.route())
 | 
| +  if (!result.route() ||
 | 
| +      base::STLCount(presentation_request.presentation_urls(),
 | 
| +                     presentation_url) == 0) {
 | 
|      return;
 | 
| +  }
 | 
|  
 | 
|    content::PresentationSessionInfo session_info(
 | 
| -      presentation_request.presentation_url(), result.presentation_id());
 | 
| +      presentation_url, result.presentation_id());
 | 
|    frame_manager_->OnDefaultPresentationSessionStarted(
 | 
|        presentation_request, session_info, result.route()->media_route_id());
 | 
|  }
 | 
| 
 |