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 14aea2196ba1860d7528fa487ad86f398c4263c5..0419e13923f9475d05673d9457da00e657b60b90 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 "core/frame/UseCounter.h" |
| #include "modules/presentation/PresentationConnection.h" |
| @@ -62,6 +63,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()) |
|
imcheng
2017/03/02 01:15:03
Can this be auto* ?
zhaobin
2017/03/02 23:44:33
Cannot... m_connectionList->connections() returns
|
| + connection->didChangeState(state, false /* shouldDispatchEvent */); |
| +} |
| + |
| +void PresentationReceiver::terminateConnection() { |
| + if (!frame()) |
| + return; |
| + |
| + auto* window = frame()->domWindow(); |
| + if (!window || window->closed()) |
| + return; |
| + |
| + window->close(frame()->document()); |
| +} |
| + |
| void PresentationReceiver::registerConnection( |
| PresentationConnection* connection) { |
| DCHECK(m_connectionList); |