OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "modules/presentation/Presentation.h" | 6 #include "modules/presentation/Presentation.h" |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
11 #include "core/dom/DOMException.h" | 11 #include "core/dom/DOMException.h" |
12 #include "core/dom/Document.h" | 12 #include "core/dom/Document.h" |
13 #include "core/dom/ExceptionCode.h" | 13 #include "core/dom/ExceptionCode.h" |
14 #include "core/frame/LocalFrame.h" | 14 #include "core/frame/LocalFrame.h" |
15 #include "modules/EventTargetModules.h" | 15 #include "modules/EventTargetModules.h" |
16 #include "modules/presentation/AvailableChangeEvent.h" | 16 #include "modules/presentation/AvailableChangeEvent.h" |
| 17 #include "modules/presentation/DefaultSessionStartEvent.h" |
17 #include "modules/presentation/PresentationController.h" | 18 #include "modules/presentation/PresentationController.h" |
18 #include "modules/presentation/PresentationSessionClientCallbacks.h" | 19 #include "modules/presentation/PresentationSessionClientCallbacks.h" |
19 | 20 |
20 namespace blink { | 21 namespace blink { |
21 | 22 |
22 Presentation::Presentation(LocalFrame* frame) | 23 Presentation::Presentation(LocalFrame* frame) |
23 : DOMWindowProperty(frame) | 24 : DOMWindowProperty(frame) |
24 { | 25 { |
25 } | 26 } |
26 | 27 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 void Presentation::didChangeAvailability(bool available) | 139 void Presentation::didChangeAvailability(bool available) |
139 { | 140 { |
140 dispatchEvent(AvailableChangeEvent::create(EventTypeNames::availablechange,
available)); | 141 dispatchEvent(AvailableChangeEvent::create(EventTypeNames::availablechange,
available)); |
141 } | 142 } |
142 | 143 |
143 bool Presentation::isAvailableChangeWatched() const | 144 bool Presentation::isAvailableChangeWatched() const |
144 { | 145 { |
145 return hasEventListeners(EventTypeNames::availablechange); | 146 return hasEventListeners(EventTypeNames::availablechange); |
146 } | 147 } |
147 | 148 |
| 149 void Presentation::didStartDefaultSession(PresentationSession* session) |
| 150 { |
| 151 dispatchEvent(DefaultSessionStartEvent::create(EventTypeNames::defaultsessio
nstart, session)); |
| 152 } |
| 153 |
148 void Presentation::registerSession(PresentationSession* session) | 154 void Presentation::registerSession(PresentationSession* session) |
149 { | 155 { |
150 m_openSessions.add(session); | 156 m_openSessions.add(session); |
151 } | 157 } |
152 | 158 |
153 PresentationController* Presentation::presentationController() | 159 PresentationController* Presentation::presentationController() |
154 { | 160 { |
155 if (!frame()) | 161 if (!frame()) |
156 return nullptr; | 162 return nullptr; |
157 return PresentationController::from(*frame()); | 163 return PresentationController::from(*frame()); |
158 } | 164 } |
159 | 165 |
160 } // namespace blink | 166 } // namespace blink |
OLD | NEW |