Chromium Code Reviews| 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..53a2a1664e11505c2f1b3067c76d664cccf53502 |
| --- /dev/null |
| +++ b/Source/modules/presentation/PresentationController.cpp |
| @@ -0,0 +1,88 @@ |
| +// 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) |
| + : FrameDestructionObserver(&frame) |
| + , 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); |
| + FrameDestructionObserver::trace(visitor); |
| +} |
| + |
| +void PresentationController::didChangeAvailability(bool available) |
| +{ |
| + if (m_presentation) |
| + m_presentation->didChangeAvailability(available); |
| +} |
| + |
| +bool PresentationController::isAvailableChangeWatched() const |
| +{ |
| + if (!m_presentation) |
| + return false; |
| + return m_presentation->isAvailableChangeWatched(); |
| +} |
| + |
| +void PresentationController::updateAvailableChangeWatched(bool watched) |
| +{ |
| + if (m_client) |
| + m_client->updateAvailableChangeWatched(watched); |
| +} |
| + |
| +void PresentationController::setPresentation(Presentation* presentation) |
| +{ |
| + m_presentation = presentation; |
| +} |
| + |
| +void PresentationController::willDetachFrameHost() |
|
mark a. foltz
2015/01/26 19:53:39
It what circumstances would a PresentationControll
whywhat
2015/01/27 14:26:55
I would hope the event would be deleted but my qui
Mike West
2015/01/27 17:46:08
Moving to DOMWindowProperty makes this clearer. It
whywhat
2015/01/27 22:06:07
Done.
|
| +{ |
| + m_client = nullptr; |
| +} |
| + |
| +} // namespace blink |