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/renderer/presentation/presentation_dispatcher.h" | 5 #include "content/renderer/presentation/presentation_dispatcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 } | 414 } |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() { | 418 void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() { |
419 if (presentation_service_.get()) | 419 if (presentation_service_.get()) |
420 return; | 420 return; |
421 | 421 |
422 render_frame()->GetServiceRegistry()->ConnectToRemoteService( | 422 render_frame()->GetServiceRegistry()->ConnectToRemoteService( |
423 mojo::GetProxy(&presentation_service_)); | 423 mojo::GetProxy(&presentation_service_)); |
424 presentation::PresentationServiceClientPtr client_ptr; | 424 presentation_service_->SetClient(binding_.CreateInterfacePtrAndBind()); |
425 binding_.Bind(GetProxy(&client_ptr)); | |
426 presentation_service_->SetClient(std::move(client_ptr)); | |
427 } | 425 } |
428 | 426 |
429 void PresentationDispatcher::UpdateListeningState(AvailabilityStatus* status) { | 427 void PresentationDispatcher::UpdateListeningState(AvailabilityStatus* status) { |
430 bool should_listen = !status->availability_callbacks.IsEmpty() || | 428 bool should_listen = !status->availability_callbacks.IsEmpty() || |
431 !status->availability_observers.empty(); | 429 !status->availability_observers.empty(); |
432 bool is_listening = status->listening_state != ListeningState::INACTIVE; | 430 bool is_listening = status->listening_state != ListeningState::INACTIVE; |
433 | 431 |
434 if (should_listen == is_listening) | 432 if (should_listen == is_listening) |
435 return; | 433 return; |
436 | 434 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( | 493 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( |
496 const std::string& availability_url) | 494 const std::string& availability_url) |
497 : url(availability_url), | 495 : url(availability_url), |
498 last_known_availability(false), | 496 last_known_availability(false), |
499 listening_state(ListeningState::INACTIVE) {} | 497 listening_state(ListeningState::INACTIVE) {} |
500 | 498 |
501 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { | 499 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { |
502 } | 500 } |
503 | 501 |
504 } // namespace content | 502 } // namespace content |
OLD | NEW |