Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 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/public/common/service_registry.h" | |
| 8 #include "content/public/renderer/render_frame.h" | |
| 9 #include "third_party/WebKit/public/platform/WebPresentationController.h" | |
| 10 | |
| 11 namespace content { | |
| 12 | |
| 13 PresentationDispatcher::PresentationDispatcher(RenderFrame* render_frame) | |
| 14 : RenderFrameObserver(render_frame) {} | |
| 15 | |
| 16 PresentationDispatcher::~PresentationDispatcher() { | |
| 17 } | |
| 18 | |
| 19 void PresentationDispatcher::setController( | |
| 20 blink::WebPresentationController* controller) { | |
| 21 controller_ = controller; | |
| 22 } | |
| 23 | |
| 24 void PresentationDispatcher::addDeviceAvailabilityListener() { | |
| 25 ConnectToPresentationServiceIfNeeded(); | |
|
Peter Beverloo
2015/01/07 15:13:01
nit: indent. In removeDeviceAvailabilityListener t
whywhat
2015/01/07 18:03:00
Done.
| |
| 26 presentation_service_->AddDeviceAvailabilityListener(); | |
| 27 } | |
| 28 | |
| 29 void PresentationDispatcher::removeDeviceAvailabilityListener() { | |
| 30 ConnectToPresentationServiceIfNeeded(); | |
| 31 presentation_service_->RemoveDeviceAvailabilityListener(); | |
| 32 } | |
| 33 | |
| 34 void PresentationDispatcher::DeviceAvailabilityChanged(bool available) { | |
| 35 if (controller_) | |
| 36 controller_->deviceAvailabilityChanged(available); | |
| 37 } | |
| 38 | |
| 39 void PresentationDispatcher::DefaultPresentationStarted( | |
| 40 presentation::PresentationSessionPtr session) { | |
| 41 } | |
|
Peter Beverloo
2015/01/07 15:13:01
NOTIMPLEMENTED().
whywhat
2015/01/07 18:02:59
Removed.
| |
| 42 | |
| 43 void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() { | |
| 44 if (!presentation_service_.get()) { | |
| 45 render_frame()->GetServiceRegistry()->ConnectToRemoteService( | |
| 46 &presentation_service_); | |
| 47 presentation_service_.set_client(this); | |
| 48 } | |
| 49 } | |
| 50 | |
| 51 } // namespace content | |
| OLD | NEW |