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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
457 | 457 |
458 PresentationSessionInfo session_info(session.To<PresentationSessionInfo>()); | 458 PresentationSessionInfo session_info(session.To<PresentationSessionInfo>()); |
459 delegate_->ListenForSessionMessages( | 459 delegate_->ListenForSessionMessages( |
460 render_process_id_, render_frame_id_, session_info, | 460 render_process_id_, render_frame_id_, session_info, |
461 base::Bind(&PresentationServiceImpl::OnSessionMessages, | 461 base::Bind(&PresentationServiceImpl::OnSessionMessages, |
462 weak_factory_.GetWeakPtr(), session_info)); | 462 weak_factory_.GetWeakPtr(), session_info)); |
463 } | 463 } |
464 | 464 |
465 void PresentationServiceImpl::OnSessionMessages( | 465 void PresentationServiceImpl::OnSessionMessages( |
466 const PresentationSessionInfo& session, | 466 const PresentationSessionInfo& session, |
467 const ScopedVector<PresentationSessionMessage>& messages, | 467 const std::vector<std::unique_ptr<PresentationSessionMessage>>& messages, |
468 bool pass_ownership) { | 468 bool pass_ownership) { |
469 DCHECK(client_); | 469 DCHECK(client_); |
470 | 470 |
471 DVLOG(2) << "OnSessionMessages"; | 471 DVLOG(2) << "OnSessionMessages"; |
472 std::vector<blink::mojom::SessionMessagePtr> mojo_messages(messages.size()); | 472 std::vector<blink::mojom::SessionMessagePtr> mojo_messages(messages.size()); |
473 std::transform(messages.begin(), messages.end(), mojo_messages.begin(), | 473 for (size_t i = 0; i < messages.size(); i++) { |
Avi (use Gerrit)
2016/12/13 04:45:31
for (const auto& message : messages)
?
Also, why
CJ
2016/12/13 23:01:31
Done.
Was having a hard time getting it to compil
| |
474 [pass_ownership](PresentationSessionMessage* message) { | 474 mojo_messages.push_back( |
475 return ToMojoSessionMessage(message, pass_ownership); | 475 ToMojoSessionMessage(messages[i].get(), pass_ownership)); |
476 }); | 476 } |
477 | 477 |
478 client_->OnSessionMessagesReceived( | 478 client_->OnSessionMessagesReceived( |
479 blink::mojom::PresentationSessionInfo::From(session), | 479 blink::mojom::PresentationSessionInfo::From(session), |
480 std::move(mojo_messages)); | 480 std::move(mojo_messages)); |
481 } | 481 } |
482 | 482 |
483 void PresentationServiceImpl::DidNavigateAnyFrame( | 483 void PresentationServiceImpl::DidNavigateAnyFrame( |
484 content::RenderFrameHost* render_frame_host, | 484 content::RenderFrameHost* render_frame_host, |
485 const content::LoadCommittedDetails& details, | 485 const content::LoadCommittedDetails& details, |
486 const content::FrameNavigateParams& params) { | 486 const content::FrameNavigateParams& params) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
605 | 605 |
606 void PresentationServiceImpl::NewSessionCallbackWrapper::Run( | 606 void PresentationServiceImpl::NewSessionCallbackWrapper::Run( |
607 blink::mojom::PresentationSessionInfoPtr session, | 607 blink::mojom::PresentationSessionInfoPtr session, |
608 blink::mojom::PresentationErrorPtr error) { | 608 blink::mojom::PresentationErrorPtr error) { |
609 DCHECK(!callback_.is_null()); | 609 DCHECK(!callback_.is_null()); |
610 callback_.Run(std::move(session), std::move(error)); | 610 callback_.Run(std::move(session), std::move(error)); |
611 callback_.Reset(); | 611 callback_.Reset(); |
612 } | 612 } |
613 | 613 |
614 } // namespace content | 614 } // namespace content |
OLD | NEW |