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

Side by Side Diff: chrome/browser/media/router/presentation_service_delegate_impl.cc

Issue 1208083004: Presentation API: ignore presentation id passed to startSession(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 frame_manager_->OnPresentationSessionStarted( 541 frame_manager_->OnPresentationSessionStarted(
542 RenderFrameHostId(render_process_id, render_frame_id), false, new_session, 542 RenderFrameHostId(render_process_id, render_frame_id), false, new_session,
543 route_id); 543 route_id);
544 success_cb.Run(new_session); 544 success_cb.Run(new_session);
545 } 545 }
546 546
547 void PresentationServiceDelegateImpl::StartSession( 547 void PresentationServiceDelegateImpl::StartSession(
548 int render_process_id, 548 int render_process_id,
549 int render_frame_id, 549 int render_frame_id,
550 const std::string& presentation_url, 550 const std::string& presentation_url,
551 const std::string& presentation_id,
552 const PresentationSessionSuccessCallback& success_cb, 551 const PresentationSessionSuccessCallback& success_cb,
553 const PresentationSessionErrorCallback& error_cb) { 552 const PresentationSessionErrorCallback& error_cb) {
554 if (presentation_url.empty() || !IsValidPresentationUrl(presentation_url)) { 553 if (presentation_url.empty() || !IsValidPresentationUrl(presentation_url)) {
555 error_cb.Run(content::PresentationError(content::PRESENTATION_ERROR_UNKNOWN, 554 error_cb.Run(content::PresentationError(content::PRESENTATION_ERROR_UNKNOWN,
556 "Invalid presentation arguments.")); 555 "Invalid presentation arguments."));
557 return; 556 return;
558 } 557 }
559 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); 558 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id);
560 std::string final_presentation_id = 559
561 presentation_id.empty() 560 std::string presentation_id =
mark a. foltz 2015/07/06 21:00:57 The code path to retrieve the default presentation
mlamouri (slow - plz ping) 2015/07/08 14:37:09 I will keep it as-is and add a TODO saying that we
562 ? frame_manager_->GetDefaultPresentationId(render_frame_host_id) 561 frame_manager_->GetDefaultPresentationId(render_frame_host_id);
563 : presentation_id; 562 if (presentation_id.empty())
564 if (final_presentation_id.empty()) 563 presentation_id = base::GenerateGUID();
565 // TODO(imcheng): Remove presentation_id argument entirely if required 564
566 // by Presentation API spec.
567 final_presentation_id = base::GenerateGUID();
568 scoped_ptr<CreateSessionRequest> context(new CreateSessionRequest( 565 scoped_ptr<CreateSessionRequest> context(new CreateSessionRequest(
569 presentation_url, final_presentation_id, 566 presentation_url, presentation_id,
570 GetLastCommittedURLForFrame(render_frame_host_id), 567 GetLastCommittedURLForFrame(render_frame_host_id),
571 base::Bind(&PresentationServiceDelegateImpl::OnStartSessionSucceeded, 568 base::Bind(&PresentationServiceDelegateImpl::OnStartSessionSucceeded,
572 weak_factory_.GetWeakPtr(), render_process_id, render_frame_id, 569 weak_factory_.GetWeakPtr(), render_process_id, render_frame_id,
573 success_cb), 570 success_cb),
574 error_cb)); 571 error_cb));
575 // NOTE: Currently this request is ignored if a dialog is already open, e.g. 572 // NOTE: Currently this request is ignored if a dialog is already open, e.g.
576 // via browser action. In practice, this should rarely happen, but log 573 // via browser action. In practice, this should rarely happen, but log
577 // an error message in case it does. 574 // an error message in case it does.
578 MediaRouterDialogController::CreateForWebContents(web_contents_); 575 MediaRouterDialogController::CreateForWebContents(web_contents_);
579 MediaRouterDialogController* controller = 576 MediaRouterDialogController* controller =
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( 696 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest(
700 int render_process_id, 697 int render_process_id,
701 int render_frame_id, 698 int render_frame_id,
702 const MediaSource::Id& source_id) const { 699 const MediaSource::Id& source_id) const {
703 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); 700 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id);
704 return frame_manager_->HasScreenAvailabilityListenerForTest( 701 return frame_manager_->HasScreenAvailabilityListenerForTest(
705 render_frame_host_id, source_id); 702 render_frame_host_id, source_id);
706 } 703 }
707 704
708 } // namespace media_router 705 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698