| 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 "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
| 10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
| 11 #include "core/dom/ExceptionCode.h" | 11 #include "core/dom/ExceptionCode.h" |
| 12 #include "core/dom/ExecutionContext.h" |
| 12 #include "core/frame/LocalDOMWindow.h" | 13 #include "core/frame/LocalDOMWindow.h" |
| 13 #include "core/frame/LocalFrame.h" | 14 #include "core/frame/LocalFrame.h" |
| 14 #include "core/frame/Navigator.h" | 15 #include "core/frame/Navigator.h" |
| 15 #include "core/frame/UseCounter.h" | 16 #include "core/frame/UseCounter.h" |
| 16 #include "modules/presentation/NavigatorPresentation.h" | 17 #include "modules/presentation/NavigatorPresentation.h" |
| 17 #include "modules/presentation/Presentation.h" | 18 #include "modules/presentation/Presentation.h" |
| 18 #include "modules/presentation/PresentationConnection.h" | 19 #include "modules/presentation/PresentationConnection.h" |
| 19 #include "modules/presentation/PresentationConnectionList.h" | 20 #include "modules/presentation/PresentationConnectionList.h" |
| 20 #include "public/platform/modules/presentation/WebPresentationClient.h" | 21 #include "public/platform/modules/presentation/WebPresentationClient.h" |
| 21 | 22 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 39 Presentation* presentation = NavigatorPresentation::presentation(navigator); | 40 Presentation* presentation = NavigatorPresentation::presentation(navigator); |
| 40 if (!presentation) | 41 if (!presentation) |
| 41 return nullptr; | 42 return nullptr; |
| 42 | 43 |
| 43 return presentation->receiver(); | 44 return presentation->receiver(); |
| 44 } | 45 } |
| 45 | 46 |
| 46 ScriptPromise PresentationReceiver::connectionList(ScriptState* script_state) { | 47 ScriptPromise PresentationReceiver::connectionList(ScriptState* script_state) { |
| 47 if (!connection_list_property_) | 48 if (!connection_list_property_) |
| 48 connection_list_property_ = | 49 connection_list_property_ = |
| 49 new ConnectionListProperty(script_state->GetExecutionContext(), this, | 50 new ConnectionListProperty(ExecutionContext::From(script_state), this, |
| 50 ConnectionListProperty::kReady); | 51 ConnectionListProperty::kReady); |
| 51 | 52 |
| 52 if (!connection_list_->IsEmpty() && connection_list_property_->GetState() == | 53 if (!connection_list_->IsEmpty() && connection_list_property_->GetState() == |
| 53 ScriptPromisePropertyBase::kPending) | 54 ScriptPromisePropertyBase::kPending) |
| 54 connection_list_property_->Resolve(connection_list_); | 55 connection_list_property_->Resolve(connection_list_); |
| 55 | 56 |
| 56 return connection_list_property_->Promise(script_state->World()); | 57 return connection_list_property_->Promise(script_state->World()); |
| 57 } | 58 } |
| 58 | 59 |
| 59 WebPresentationConnection* PresentationReceiver::OnReceiverConnectionAvailable( | 60 WebPresentationConnection* PresentationReceiver::OnReceiverConnectionAvailable( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 115 } |
| 115 } | 116 } |
| 116 | 117 |
| 117 DEFINE_TRACE(PresentationReceiver) { | 118 DEFINE_TRACE(PresentationReceiver) { |
| 118 visitor->Trace(connection_list_); | 119 visitor->Trace(connection_list_); |
| 119 visitor->Trace(connection_list_property_); | 120 visitor->Trace(connection_list_property_); |
| 120 ContextClient::Trace(visitor); | 121 ContextClient::Trace(visitor); |
| 121 } | 122 } |
| 122 | 123 |
| 123 } // namespace blink | 124 } // namespace blink |
| OLD | NEW |