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 "content/browser/presentation/presentation_service_impl.h" | 5 #include "content/browser/presentation/presentation_service_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 | 448 |
449 PresentationSessionInfo session_info(session.To<PresentationSessionInfo>()); | 449 PresentationSessionInfo session_info(session.To<PresentationSessionInfo>()); |
450 delegate_->ListenForConnectionMessages( | 450 delegate_->ListenForConnectionMessages( |
451 render_process_id_, render_frame_id_, session_info, | 451 render_process_id_, render_frame_id_, session_info, |
452 base::Bind(&PresentationServiceImpl::OnConnectionMessages, | 452 base::Bind(&PresentationServiceImpl::OnConnectionMessages, |
453 weak_factory_.GetWeakPtr(), session_info)); | 453 weak_factory_.GetWeakPtr(), session_info)); |
454 } | 454 } |
455 | 455 |
456 void PresentationServiceImpl::OnConnectionMessages( | 456 void PresentationServiceImpl::OnConnectionMessages( |
457 const PresentationSessionInfo& session, | 457 const PresentationSessionInfo& session, |
458 const ScopedVector<PresentationConnectionMessage>& messages, | 458 const std::vector<std::unique_ptr<PresentationConnectionMessage>>& messages, |
459 bool pass_ownership) { | 459 bool pass_ownership) { |
460 DCHECK(client_); | 460 DCHECK(client_); |
461 | 461 |
462 DVLOG(2) << "OnConnectionMessages"; | 462 DVLOG(2) << "OnConnectionMessages"; |
463 std::vector<blink::mojom::ConnectionMessagePtr> mojo_messages( | 463 std::vector<blink::mojom::ConnectionMessagePtr> mojo_messages( |
464 messages.size()); | 464 messages.size()); |
465 std::transform(messages.begin(), messages.end(), mojo_messages.begin(), | 465 std::transform( |
466 [pass_ownership](PresentationConnectionMessage* message) { | 466 messages.begin(), messages.end(), mojo_messages.begin(), |
467 return ToMojoConnectionMessage(message, pass_ownership); | 467 [pass_ownership]( |
468 }); | 468 const std::unique_ptr<PresentationConnectionMessage>& message) { |
| 469 return ToMojoConnectionMessage(message.get(), pass_ownership); |
| 470 }); |
469 | 471 |
470 client_->OnConnectionMessagesReceived( | 472 client_->OnConnectionMessagesReceived( |
471 blink::mojom::PresentationSessionInfo::From(session), | 473 blink::mojom::PresentationSessionInfo::From(session), |
472 std::move(mojo_messages)); | 474 std::move(mojo_messages)); |
473 } | 475 } |
474 | 476 |
475 void PresentationServiceImpl::DidNavigateAnyFrame( | 477 void PresentationServiceImpl::DidNavigateAnyFrame( |
476 content::RenderFrameHost* render_frame_host, | 478 content::RenderFrameHost* render_frame_host, |
477 const content::LoadCommittedDetails& details, | 479 const content::LoadCommittedDetails& details, |
478 const content::FrameNavigateParams& params) { | 480 const content::FrameNavigateParams& params) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 | 599 |
598 void PresentationServiceImpl::NewSessionCallbackWrapper::Run( | 600 void PresentationServiceImpl::NewSessionCallbackWrapper::Run( |
599 blink::mojom::PresentationSessionInfoPtr session, | 601 blink::mojom::PresentationSessionInfoPtr session, |
600 blink::mojom::PresentationErrorPtr error) { | 602 blink::mojom::PresentationErrorPtr error) { |
601 DCHECK(!callback_.is_null()); | 603 DCHECK(!callback_.is_null()); |
602 callback_.Run(std::move(session), std::move(error)); | 604 callback_.Run(std::move(session), std::move(error)); |
603 callback_.Reset(); | 605 callback_.Reset(); |
604 } | 606 } |
605 | 607 |
606 } // namespace content | 608 } // namespace content |
OLD | NEW |