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" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 m_connections.add(connection); | 129 m_connections.add(connection); |
130 } | 130 } |
131 | 131 |
132 void PresentationController::contextDestroyed() { | 132 void PresentationController::contextDestroyed() { |
133 if (m_client) { | 133 if (m_client) { |
134 m_client->setController(nullptr); | 134 m_client->setController(nullptr); |
135 m_client = nullptr; | 135 m_client = nullptr; |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
| 139 PresentationConnection* PresentationController::findExistingConnection( |
| 140 const blink::WebVector<blink::WebURL>& presentationUrls, |
| 141 const blink::WebString& presentationId) { |
| 142 for (const auto& connection : m_connections) { |
| 143 for (const auto& presentationUrl : presentationUrls) { |
| 144 if (connection->getState() != |
| 145 WebPresentationConnectionState::Terminated && |
| 146 connection->matches(presentationId, presentationUrl)) { |
| 147 return connection.get(); |
| 148 } |
| 149 } |
| 150 } |
| 151 return nullptr; |
| 152 } |
| 153 |
139 PresentationConnection* PresentationController::findConnection( | 154 PresentationConnection* PresentationController::findConnection( |
140 const WebPresentationSessionInfo& sessionInfo) { | 155 const WebPresentationSessionInfo& sessionInfo) { |
141 for (const auto& connection : m_connections) { | 156 for (const auto& connection : m_connections) { |
142 if (connection->matches(sessionInfo)) | 157 if (connection->matches(sessionInfo)) |
143 return connection.get(); | 158 return connection.get(); |
144 } | 159 } |
145 | 160 |
146 return nullptr; | 161 return nullptr; |
147 } | 162 } |
148 | 163 |
149 } // namespace blink | 164 } // namespace blink |
OLD | NEW |