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/frame/LocalFrame.h" | 7 #include "core/frame/LocalFrame.h" |
8 #include "modules/presentation/PresentationConnection.h" | 8 #include "modules/presentation/PresentationConnection.h" |
9 #include "public/platform/modules/presentation/WebPresentationClient.h" | 9 #include "public/platform/modules/presentation/WebPresentationClient.h" |
10 #include "wtf/PtrUtil.h" | 10 #include "wtf/PtrUtil.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 void PresentationController::setPresentation(Presentation* presentation) | 113 void PresentationController::setPresentation(Presentation* presentation) |
114 { | 114 { |
115 m_presentation = presentation; | 115 m_presentation = presentation; |
116 } | 116 } |
117 | 117 |
118 void PresentationController::setDefaultRequestUrl(const KURL& url) | 118 void PresentationController::setDefaultRequestUrl(const KURL& url) |
119 { | 119 { |
120 if (!m_client) | 120 if (!m_client) |
121 return; | 121 return; |
122 | 122 |
| 123 // TODO(crbug.com/627655): Accept multiple URLs per PresentationRequest. |
| 124 WebVector<WebString> presentationUrls(static_cast<size_t>(1)); |
123 if (url.isValid()) | 125 if (url.isValid()) |
124 m_client->setDefaultPresentationUrl(url.getString()); | 126 presentationUrls[0] = url.getString(); |
125 else | 127 |
126 m_client->setDefaultPresentationUrl(blink::WebString()); | 128 m_client->setDefaultPresentationUrls(presentationUrls); |
127 } | 129 } |
128 | 130 |
129 void PresentationController::registerConnection(PresentationConnection* connecti
on) | 131 void PresentationController::registerConnection(PresentationConnection* connecti
on) |
130 { | 132 { |
131 m_connections.add(connection); | 133 m_connections.add(connection); |
132 } | 134 } |
133 | 135 |
134 void PresentationController::willDestroyGlobalObjectInFrame() | 136 void PresentationController::willDestroyGlobalObjectInFrame() |
135 { | 137 { |
136 if (m_client) { | 138 if (m_client) { |
137 m_client->setController(nullptr); | 139 m_client->setController(nullptr); |
138 m_client = nullptr; | 140 m_client = nullptr; |
139 } | 141 } |
140 } | 142 } |
141 | 143 |
142 PresentationConnection* PresentationController::findConnection(WebPresentationCo
nnectionClient* connectionClient) | 144 PresentationConnection* PresentationController::findConnection(WebPresentationCo
nnectionClient* connectionClient) |
143 { | 145 { |
144 for (const auto& connection : m_connections) { | 146 for (const auto& connection : m_connections) { |
145 if (connection->matches(connectionClient)) | 147 if (connection->matches(connectionClient)) |
146 return connection.get(); | 148 return connection.get(); |
147 } | 149 } |
148 | 150 |
149 return nullptr; | 151 return nullptr; |
150 } | 152 } |
151 | 153 |
152 } // namespace blink | 154 } // namespace blink |
OLD | NEW |