Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationController.cpp

Issue 2552343009: [Presentation API] Adds DOMString[] constructor to PresentationRequest. (Closed)
Patch Set: resolve code review comments from foolip Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/WebString.h"
11 #include "public/platform/WebVector.h"
10 #include "public/platform/modules/presentation/WebPresentationClient.h" 12 #include "public/platform/modules/presentation/WebPresentationClient.h"
11 #include "wtf/PtrUtil.h" 13 #include "wtf/PtrUtil.h"
12 #include <memory> 14 #include <memory>
13 15
14 namespace blink { 16 namespace blink {
15 17
16 PresentationController::PresentationController(LocalFrame& frame, 18 PresentationController::PresentationController(LocalFrame& frame,
17 WebPresentationClient* client) 19 WebPresentationClient* client)
18 : Supplement<LocalFrame>(frame), 20 : Supplement<LocalFrame>(frame),
19 ContextLifecycleObserver(frame.document()), 21 ContextLifecycleObserver(frame.document()),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 PresentationConnection* connection = findConnection(sessionInfo); 109 PresentationConnection* connection = findConnection(sessionInfo);
108 if (!connection) 110 if (!connection)
109 return; 111 return;
110 connection->didReceiveBinaryMessage(data, length); 112 connection->didReceiveBinaryMessage(data, length);
111 } 113 }
112 114
113 void PresentationController::setPresentation(Presentation* presentation) { 115 void PresentationController::setPresentation(Presentation* presentation) {
114 m_presentation = presentation; 116 m_presentation = presentation;
115 } 117 }
116 118
117 void PresentationController::setDefaultRequestUrl(const KURL& url) { 119 void PresentationController::setDefaultRequestUrl(
120 const WTF::Vector<KURL>& urls) {
118 if (!m_client) 121 if (!m_client)
119 return; 122 return;
120 123
121 // TODO(crbug.com/627655): Accept multiple URLs per PresentationRequest. 124 WebVector<WebURL> presentationUrls(urls.size());
122 WebVector<WebURL> presentationUrls(static_cast<size_t>(1)); 125 for (size_t i = 0; i < urls.size(); ++i) {
123 if (url.isValid()) 126 if (urls[i].isValid())
124 presentationUrls[0] = url; 127 presentationUrls[i] = urls[i];
128 }
125 129
126 m_client->setDefaultPresentationUrls(presentationUrls); 130 m_client->setDefaultPresentationUrls(presentationUrls);
127 } 131 }
128 132
129 void PresentationController::registerConnection( 133 void PresentationController::registerConnection(
130 PresentationConnection* connection) { 134 PresentationConnection* connection) {
131 m_connections.add(connection); 135 m_connections.add(connection);
132 } 136 }
133 137
134 void PresentationController::contextDestroyed() { 138 void PresentationController::contextDestroyed() {
(...skipping 22 matching lines...) Expand all
157 const WebPresentationSessionInfo& sessionInfo) { 161 const WebPresentationSessionInfo& sessionInfo) {
158 for (const auto& connection : m_connections) { 162 for (const auto& connection : m_connections) {
159 if (connection->matches(sessionInfo)) 163 if (connection->matches(sessionInfo))
160 return connection.get(); 164 return connection.get();
161 } 165 }
162 166
163 return nullptr; 167 return nullptr;
164 } 168 }
165 169
166 } // namespace blink 170 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698