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 : FrameDestructionObserver(&frame) | |
16 , m_client(client) | |
17 { | |
18 if (m_client) | |
19 m_client->setController(this); | |
20 } | |
21 | |
22 PresentationController::~PresentationController() | |
23 { | |
24 if (m_client) | |
25 m_client->setController(nullptr); | |
26 } | |
27 | |
28 // static | |
29 PassOwnPtrWillBeRawPtr<PresentationController> PresentationController::create(Lo calFrame& frame, WebPresentationClient* client) | |
30 { | |
31 return adoptPtrWillBeNoop(new PresentationController(frame, client)); | |
32 } | |
33 | |
34 // static | |
35 const char* PresentationController::supplementName() | |
36 { | |
37 return "PresentationController"; | |
38 } | |
39 | |
40 // static | |
41 PresentationController* PresentationController::from(LocalFrame& frame) | |
42 { | |
43 return static_cast<PresentationController*>(WillBeHeapSupplement<LocalFrame> ::from(frame, supplementName())); | |
44 } | |
45 | |
46 // static | |
47 void PresentationController::provideTo(LocalFrame& frame, WebPresentationClient* client) | |
48 { | |
49 WillBeHeapSupplement<LocalFrame>::provideTo(frame, PresentationController::s upplementName(), PresentationController::create(frame, client)); | |
50 } | |
51 | |
52 void PresentationController::trace(Visitor* visitor) | |
53 { | |
54 visitor->trace(m_presentation); | |
55 WillBeHeapSupplement<LocalFrame>::trace(visitor); | |
56 FrameDestructionObserver::trace(visitor); | |
57 } | |
58 | |
59 void PresentationController::didChangeAvailability(bool available) | |
60 { | |
61 if (m_presentation) | |
62 m_presentation->didChangeAvailability(available); | |
63 } | |
64 | |
65 bool PresentationController::isAvailableChangeWatched() const | |
66 { | |
67 if (!m_presentation) | |
68 return false; | |
69 return m_presentation->isAvailableChangeWatched(); | |
70 } | |
71 | |
72 void PresentationController::updateAvailableChangeWatched(bool watched) | |
73 { | |
74 if (m_client) | |
75 m_client->updateAvailableChangeWatched(watched); | |
76 } | |
77 | |
78 void PresentationController::setPresentation(Presentation* presentation) | |
79 { | |
80 m_presentation = presentation; | |
81 } | |
82 | |
83 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.
| |
84 { | |
85 m_client = nullptr; | |
86 } | |
87 | |
88 } // namespace blink | |
OLD | NEW |