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