| Index: Source/modules/presentation/PresentationController.cpp
|
| diff --git a/Source/modules/presentation/PresentationController.cpp b/Source/modules/presentation/PresentationController.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a32cedee31c0220d5bcbca92b98240a9355ded9e
|
| --- /dev/null
|
| +++ b/Source/modules/presentation/PresentationController.cpp
|
| @@ -0,0 +1,80 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "config.h"
|
| +#include "modules/presentation/PresentationController.h"
|
| +
|
| +#include "core/frame/LocalFrame.h"
|
| +#include "public/platform/WebPresentationClient.h"
|
| +#include "public/platform/WebPresentationController.h"
|
| +
|
| +namespace blink {
|
| +
|
| +PresentationController::PresentationController(LocalFrame& frame, WebPresentationClient* client)
|
| + : m_client(client)
|
| +{
|
| + if (m_client)
|
| + m_client->setController(this);
|
| +}
|
| +
|
| +PresentationController::~PresentationController()
|
| +{
|
| + if (m_client)
|
| + m_client->setController(nullptr);
|
| +}
|
| +
|
| +// static
|
| +PassOwnPtrWillBeRawPtr<PresentationController> PresentationController::create(LocalFrame& frame, WebPresentationClient* client)
|
| +{
|
| + return adoptPtrWillBeNoop(new PresentationController(frame, client));
|
| +}
|
| +
|
| +// static
|
| +const char* PresentationController::supplementName()
|
| +{
|
| + return "PresentationController";
|
| +}
|
| +
|
| +// static
|
| +PresentationController* PresentationController::from(LocalFrame& frame)
|
| +{
|
| + return static_cast<PresentationController*>(WillBeHeapSupplement<LocalFrame>::from(frame, supplementName()));
|
| +}
|
| +
|
| +// static
|
| +void PresentationController::provideTo(LocalFrame& frame, WebPresentationClient* client)
|
| +{
|
| + WillBeHeapSupplement<LocalFrame>::provideTo(frame, PresentationController::supplementName(), PresentationController::create(frame, client));
|
| +}
|
| +
|
| +void PresentationController::trace(Visitor* visitor)
|
| +{
|
| + visitor->trace(m_presentation);
|
| + WillBeHeapSupplement<LocalFrame>::trace(visitor);
|
| +}
|
| +
|
| +void PresentationController::didChangeAvailability(bool available)
|
| +{
|
| + if (m_presentation)
|
| + m_presentation->didChangeAvailability(available);
|
| +}
|
| +
|
| +void PresentationController::addDeviceAvailabilityListener()
|
| +{
|
| + if (m_client)
|
| + m_client->addDeviceAvailabilityListener();
|
| +}
|
| +
|
| +void PresentationController::removeDeviceAvailabilityListener()
|
| +{
|
| + if (m_client)
|
| + m_client->removeDeviceAvailabilityListener();
|
| +}
|
| +
|
| +void PresentationController::setPresentation(Presentation* presentation)
|
| +{
|
| + m_presentation = presentation;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|