Chromium Code Reviews| Index: third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp |
| diff --git a/third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp b/third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp |
| index d7097b9a0f18dc66eef472f7e884c97ed3cae1eb..02262198f0700313f9b834e5553b2d599df0c6b8 100644 |
| --- a/third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp |
| +++ b/third_party/WebKit/Source/modules/presentation/PresentationReceiver.cpp |
| @@ -9,6 +9,7 @@ |
| #include "core/dom/DOMException.h" |
| #include "core/dom/Document.h" |
| #include "core/dom/ExceptionCode.h" |
| +#include "core/frame/LocalDOMWindow.h" |
| #include "core/frame/LocalFrame.h" |
| #include "modules/presentation/PresentationConnection.h" |
| #include "modules/presentation/PresentationConnectionList.h" |
| @@ -59,6 +60,27 @@ WebPresentationConnection* PresentationReceiver::onReceiverConnectionAvailable( |
| return connection; |
| } |
| +void PresentationReceiver::didChangeSessionState( |
| + WebPresentationConnectionState state) { |
| + // TODO(zhaobin): remove or modify DCHECK when receiver supports more |
| + // connection state change. |
| + DCHECK(state == WebPresentationConnectionState::Terminated); |
| + |
| + for (auto connection : m_connectionList->connections()) |
| + connection->didChangeState(state); |
|
mark a. foltz
2017/02/25 01:43:12
Will this fire a terminated event on the receiver
zhaobin
2017/02/28 04:25:19
Done.
|
| +} |
| + |
| +void PresentationReceiver::closeWindow() { |
| + if (!frame()) |
| + return; |
| + |
| + auto* window = frame()->domWindow(); |
| + if (!window || window->closed()) |
| + return; |
| + |
| + window->close(frame()->document()); |
| +} |
| + |
| void PresentationReceiver::registerConnection( |
| PresentationConnection* connection) { |
| DCHECK(m_connectionList); |