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 "config.h" |
| 6 #include "modules/presentation/PresentationController.h" |
| 7 |
| 8 #include "core/frame/LocalFrame.h" |
| 9 #include "public/platform/WebPresentationClient.h" |
| 10 #include "public/platform/WebPresentationController.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 PresentationController::PresentationController(LocalFrame& frame, WebPresentatio
nClient* client) |
| 15 : m_client(client) |
| 16 { |
| 17 if (m_client) |
| 18 m_client->setController(this); |
| 19 } |
| 20 |
| 21 PresentationController::~PresentationController() |
| 22 { |
| 23 if (m_client) |
| 24 m_client->setController(nullptr); |
| 25 } |
| 26 |
| 27 // static |
| 28 PassOwnPtrWillBeRawPtr<PresentationController> PresentationController::create(Lo
calFrame& frame, WebPresentationClient* client) |
| 29 { |
| 30 return adoptPtrWillBeNoop(new PresentationController(frame, client)); |
| 31 } |
| 32 |
| 33 // static |
| 34 const char* PresentationController::supplementName() |
| 35 { |
| 36 return "PresentationController"; |
| 37 } |
| 38 |
| 39 // static |
| 40 PresentationController* PresentationController::from(LocalFrame& frame) |
| 41 { |
| 42 return static_cast<PresentationController*>(WillBeHeapSupplement<LocalFrame>
::from(frame, supplementName())); |
| 43 } |
| 44 |
| 45 // static |
| 46 void PresentationController::provideTo(LocalFrame& frame, WebPresentationClient*
client) |
| 47 { |
| 48 WillBeHeapSupplement<LocalFrame>::provideTo(frame, PresentationController::s
upplementName(), PresentationController::create(frame, client)); |
| 49 } |
| 50 |
| 51 void PresentationController::trace(Visitor* visitor) |
| 52 { |
| 53 visitor->trace(m_presentation); |
| 54 WillBeHeapSupplement<LocalFrame>::trace(visitor); |
| 55 } |
| 56 |
| 57 void PresentationController::didChangeAvailability(bool available) |
| 58 { |
| 59 if (m_presentation) |
| 60 m_presentation->didChangeAvailability(available); |
| 61 } |
| 62 |
| 63 void PresentationController::updateAvailableChangeWatched(bool watched) |
| 64 { |
| 65 if (m_client) |
| 66 m_client->updateAvailableChangeWatched(watched); |
| 67 } |
| 68 |
| 69 void PresentationController::setPresentation(Presentation* presentation) |
| 70 { |
| 71 m_presentation = presentation; |
| 72 } |
| 73 |
| 74 } // namespace blink |
OLD | NEW |