| 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/PresentationController.h" | 5 #include "modules/presentation/PresentationController.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
| 9 #include "modules/presentation/PresentationConnection.h" | 9 #include "modules/presentation/PresentationConnection.h" |
| 10 #include "public/platform/modules/presentation/WebPresentationClient.h" | 10 #include "public/platform/modules/presentation/WebPresentationClient.h" |
| 11 #include "wtf/PtrUtil.h" | 11 #include "wtf/PtrUtil.h" |
| 12 #include <memory> | 12 #include <memory> |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 PresentationController::PresentationController(LocalFrame& frame, | 16 PresentationController::PresentationController(LocalFrame& frame, |
| 17 WebPresentationClient* client) | 17 WebPresentationClient* client) |
| 18 : ContextLifecycleObserver(frame.document()), m_client(client) { | 18 : Supplement<LocalFrame>(frame), |
| 19 ContextLifecycleObserver(frame.document()), |
| 20 m_client(client) { |
| 19 if (m_client) | 21 if (m_client) |
| 20 m_client->setController(this); | 22 m_client->setController(this); |
| 21 } | 23 } |
| 22 | 24 |
| 23 PresentationController::~PresentationController() { | 25 PresentationController::~PresentationController() { |
| 24 if (m_client) | 26 if (m_client) |
| 25 m_client->setController(nullptr); | 27 m_client->setController(nullptr); |
| 26 } | 28 } |
| 27 | 29 |
| 28 // static | 30 // static |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 const WebPresentationSessionInfo& sessionInfo) { | 157 const WebPresentationSessionInfo& sessionInfo) { |
| 156 for (const auto& connection : m_connections) { | 158 for (const auto& connection : m_connections) { |
| 157 if (connection->matches(sessionInfo)) | 159 if (connection->matches(sessionInfo)) |
| 158 return connection.get(); | 160 return connection.get(); |
| 159 } | 161 } |
| 160 | 162 |
| 161 return nullptr; | 163 return nullptr; |
| 162 } | 164 } |
| 163 | 165 |
| 164 } // namespace blink | 166 } // namespace blink |
| OLD | NEW |