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++) { |
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 //} |
Avi (use Gerrit)
2016/12/14 03:32:09
Don't commit commented-out code.
CJ
2016/12/14 19:56:13
Done.
| |
477 std::transform( | |
478 messages.begin(), messages.end(), mojo_messages.begin(), | |
479 [pass_ownership]( | |
480 const std::unique_ptr<PresentationSessionMessage>& message) { | |
481 return ToMojoSessionMessage(message.get(), pass_ownership); | |
482 }); | |
477 | 483 |
478 client_->OnSessionMessagesReceived( | 484 client_->OnSessionMessagesReceived( |
479 blink::mojom::PresentationSessionInfo::From(session), | 485 blink::mojom::PresentationSessionInfo::From(session), |
480 std::move(mojo_messages)); | 486 std::move(mojo_messages)); |
481 } | 487 } |
482 | 488 |
483 void PresentationServiceImpl::DidNavigateAnyFrame( | 489 void PresentationServiceImpl::DidNavigateAnyFrame( |
484 content::RenderFrameHost* render_frame_host, | 490 content::RenderFrameHost* render_frame_host, |
485 const content::LoadCommittedDetails& details, | 491 const content::LoadCommittedDetails& details, |
486 const content::FrameNavigateParams& params) { | 492 const content::FrameNavigateParams& params) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
605 | 611 |
606 void PresentationServiceImpl::NewSessionCallbackWrapper::Run( | 612 void PresentationServiceImpl::NewSessionCallbackWrapper::Run( |
607 blink::mojom::PresentationSessionInfoPtr session, | 613 blink::mojom::PresentationSessionInfoPtr session, |
608 blink::mojom::PresentationErrorPtr error) { | 614 blink::mojom::PresentationErrorPtr error) { |
609 DCHECK(!callback_.is_null()); | 615 DCHECK(!callback_.is_null()); |
610 callback_.Run(std::move(session), std::move(error)); | 616 callback_.Run(std::move(session), std::move(error)); |
611 callback_.Reset(); | 617 callback_.Reset(); |
612 } | 618 } |
613 | 619 |
614 } // namespace content | 620 } // namespace content |
OLD | NEW |