| 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 |
| 11 #include "base/bind.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 13 #include "content/public/common/presentation_constants.h" | 14 #include "content/public/common/presentation_constants.h" |
| 14 #include "content/public/common/service_registry.h" | |
| 15 #include "content/public/renderer/render_frame.h" | 15 #include "content/public/renderer/render_frame.h" |
| 16 #include "content/renderer/presentation/presentation_connection_client.h" | 16 #include "content/renderer/presentation/presentation_connection_client.h" |
| 17 #include "services/shell/public/cpp/interface_provider.h" |
| 17 #include "third_party/WebKit/public/platform/WebString.h" | 18 #include "third_party/WebKit/public/platform/WebString.h" |
| 18 #include "third_party/WebKit/public/platform/WebURL.h" | 19 #include "third_party/WebKit/public/platform/WebURL.h" |
| 19 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nAvailabilityObserver.h" | 20 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nAvailabilityObserver.h" |
| 20 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nController.h" | 21 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nController.h" |
| 21 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nError.h" | 22 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nError.h" |
| 22 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" | 23 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" |
| 23 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 24 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 break; | 448 break; |
| 448 } | 449 } |
| 449 } | 450 } |
| 450 } | 451 } |
| 451 } | 452 } |
| 452 | 453 |
| 453 void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() { | 454 void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() { |
| 454 if (presentation_service_.get()) | 455 if (presentation_service_.get()) |
| 455 return; | 456 return; |
| 456 | 457 |
| 457 render_frame()->GetServiceRegistry()->ConnectToRemoteService( | 458 render_frame()->GetRemoteInterfaces()->GetInterface(&presentation_service_); |
| 458 mojo::GetProxy(&presentation_service_)); | |
| 459 presentation_service_->SetClient(binding_.CreateInterfacePtrAndBind()); | 459 presentation_service_->SetClient(binding_.CreateInterfacePtrAndBind()); |
| 460 } | 460 } |
| 461 | 461 |
| 462 void PresentationDispatcher::UpdateListeningState(AvailabilityStatus* status) { | 462 void PresentationDispatcher::UpdateListeningState(AvailabilityStatus* status) { |
| 463 bool should_listen = !status->availability_callbacks.IsEmpty() || | 463 bool should_listen = !status->availability_callbacks.IsEmpty() || |
| 464 !status->availability_observers.empty(); | 464 !status->availability_observers.empty(); |
| 465 bool is_listening = status->listening_state != ListeningState::INACTIVE; | 465 bool is_listening = status->listening_state != ListeningState::INACTIVE; |
| 466 | 466 |
| 467 if (should_listen == is_listening) | 467 if (should_listen == is_listening) |
| 468 return; | 468 return; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( | 528 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( |
| 529 const std::string& availability_url) | 529 const std::string& availability_url) |
| 530 : url(availability_url), | 530 : url(availability_url), |
| 531 last_known_availability(false), | 531 last_known_availability(false), |
| 532 listening_state(ListeningState::INACTIVE) {} | 532 listening_state(ListeningState::INACTIVE) {} |
| 533 | 533 |
| 534 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { | 534 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { |
| 535 } | 535 } |
| 536 | 536 |
| 537 } // namespace content | 537 } // namespace content |
| OLD | NEW |