| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "modules/presentation/PresentationReceiver.h" | 5 #include "modules/presentation/PresentationReceiver.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
| 8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
| 9 #include "core/dom/Document.h" | |
| 10 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
| 11 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| 12 #include "modules/EventTargetModules.h" | 11 #include "modules/presentation/PresentationConnectionList.h" |
| 13 | 12 |
| 14 namespace blink { | 13 namespace blink { |
| 15 | 14 |
| 16 PresentationReceiver::PresentationReceiver(LocalFrame* frame) | 15 PresentationReceiver::PresentationReceiver(LocalFrame* frame) |
| 17 : DOMWindowProperty(frame) | 16 : DOMWindowProperty(frame) |
| 18 { | 17 { |
| 19 } | 18 } |
| 20 | 19 |
| 21 const AtomicString& PresentationReceiver::interfaceName() const | 20 ScriptPromise PresentationReceiver::connectionList(ScriptState* scriptState) |
| 22 { | 21 { |
| 23 return EventTargetNames::PresentationReceiver; | 22 if (!m_connectionListProperty) |
| 24 } | 23 m_connectionListProperty = new ConnectionListProperty(scriptState->getEx
ecutionContext(), this, ConnectionListProperty::Loaded); |
| 25 | 24 |
| 26 ExecutionContext* PresentationReceiver::getExecutionContext() const | 25 return m_connectionListProperty->promise(scriptState->world()); |
| 27 { | |
| 28 return frame() ? frame()->document() : nullptr; | |
| 29 } | |
| 30 | |
| 31 ScriptPromise PresentationReceiver::getConnection(ScriptState* scriptState) | |
| 32 { | |
| 33 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea
te(NotSupportedError, "PresentationReceiver::getConnection() is not implemented
yet.")); | |
| 34 } | |
| 35 | |
| 36 ScriptPromise PresentationReceiver::getConnections(ScriptState* scriptState) | |
| 37 { | |
| 38 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea
te(NotSupportedError, "PresentationReceiver::getConnections() is not implemented
yet.")); | |
| 39 } | 26 } |
| 40 | 27 |
| 41 DEFINE_TRACE(PresentationReceiver) | 28 DEFINE_TRACE(PresentationReceiver) |
| 42 { | 29 { |
| 43 EventTargetWithInlineData::trace(visitor); | 30 visitor->trace(m_connectionListProperty); |
| 44 DOMWindowProperty::trace(visitor); | 31 DOMWindowProperty::trace(visitor); |
| 45 } | 32 } |
| 46 | 33 |
| 47 } // namespace blink | 34 } // namespace blink |
| OLD | NEW |