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

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

Issue 2148643002: [Presentation API] Adds DOMString[] constructor to PresentationRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix PresentationAvailabilityCallbacks Created 4 years, 5 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/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/WebString.h"
10 #include "public/platform/WebVector.h"
9 #include "public/platform/modules/presentation/WebPresentationClient.h" 11 #include "public/platform/modules/presentation/WebPresentationClient.h"
10 #include "wtf/PtrUtil.h" 12 #include "wtf/PtrUtil.h"
11 #include <memory> 13 #include <memory>
12 14
13 namespace blink { 15 namespace blink {
14 16
15 PresentationController::PresentationController(LocalFrame& frame, WebPresentatio nClient* client) 17 PresentationController::PresentationController(LocalFrame& frame, WebPresentatio nClient* client)
16 : LocalFrameLifecycleObserver(&frame) 18 : LocalFrameLifecycleObserver(&frame)
17 , m_client(client) 19 , m_client(client)
18 { 20 {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 { 116 {
115 m_presentation = presentation; 117 m_presentation = presentation;
116 } 118 }
117 119
118 void PresentationController::setDefaultRequestUrl(const KURL& url) 120 void PresentationController::setDefaultRequestUrls(const WTF::Vector<KURL>& urls )
119 { 121 {
120 if (!m_client) 122 if (!m_client)
121 return; 123 return;
122 124
123 if (url.isValid()) 125 WebVector<WebString> data(urls.size());
124 m_client->setDefaultPresentationUrl(url.getString()); 126 for (size_t i = 0; i < urls.size(); ++i) {
125 else 127 data[i] = urls[i].getString();
126 m_client->setDefaultPresentationUrl(blink::WebString()); 128 }
mlamouri (slow - plz ping) 2016/07/19 12:45:03 style: maybe no { } ?
mark a. foltz 2016/07/19 17:38:47 Done.
129 m_client->setDefaultPresentationUrls(data);
127 } 130 }
128 131
129 void PresentationController::registerConnection(PresentationConnection* connecti on) 132 void PresentationController::registerConnection(PresentationConnection* connecti on)
130 { 133 {
131 m_connections.add(connection); 134 m_connections.add(connection);
132 } 135 }
133 136
134 void PresentationController::contextDestroyed() 137 void PresentationController::contextDestroyed()
135 { 138 {
136 if (m_client) { 139 if (m_client) {
137 m_client->setController(nullptr); 140 m_client->setController(nullptr);
138 m_client = nullptr; 141 m_client = nullptr;
139 } 142 }
140 } 143 }
141 144
142 PresentationConnection* PresentationController::findConnection(WebPresentationCo nnectionClient* connectionClient) 145 PresentationConnection* PresentationController::findConnection(WebPresentationCo nnectionClient* connectionClient)
143 { 146 {
144 for (const auto& connection : m_connections) { 147 for (const auto& connection : m_connections) {
145 if (connection->matches(connectionClient)) 148 if (connection->matches(connectionClient))
146 return connection.get(); 149 return connection.get();
147 } 150 }
148 151
149 return nullptr; 152 return nullptr;
150 } 153 }
151 154
152 } // namespace blink 155 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698