OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/renderer/presentation/presentation_dispatcher.h" |
| 6 |
| 7 #include "content/common/presentation/presentation_service.mojom.h" |
| 8 #include "content/public/common/service_registry.h" |
| 9 #include "content/public/renderer/render_frame.h" |
| 10 #include "third_party/WebKit/public/platform/WebPresentationController.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 PresentationDispatcher::PresentationDispatcher(RenderFrame* render_frame) |
| 15 : RenderFrameObserver(render_frame) {} |
| 16 |
| 17 PresentationDispatcher::~PresentationDispatcher() {} |
| 18 |
| 19 void PresentationDispatcher::setController( |
| 20 blink::WebPresentationController* controller) { |
| 21 controller_ = controller; |
| 22 } |
| 23 |
| 24 void PresentationDispatcher::updateAvailableChangeWatched(bool watched) { |
| 25 ConnectToPresentationServiceIfNeeded(); |
| 26 presentation_service_->UpdateAvailableChangeWatched(watched); |
| 27 } |
| 28 |
| 29 void PresentationDispatcher::DeviceAvailabilityChanged(bool available) { |
| 30 if (controller_) |
| 31 controller_->didChangeAvailability(available); |
| 32 } |
| 33 |
| 34 void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() { |
| 35 if (presentation_service_.get()) |
| 36 return; |
| 37 |
| 38 render_frame()->GetServiceRegistry()->ConnectToRemoteService( |
| 39 &presentation_service_); |
| 40 presentation::PresentationServiceClientPtr clientPointer; |
| 41 mojo::BindToProxy(this, &clientPointer); |
| 42 presentation_service_->SetClient(clientPointer.Pass()); |
| 43 } |
| 44 |
| 45 } // namespace content |
OLD | NEW |