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

Unified Diff: third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp

Issue 2471263003: [Presentation API] (4th)(1-UA blink side) Add WebPresentationConnection and WebPresentationConnecti… (Closed)
Patch Set: merge and refactor 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
index be94c78b5cbe27f3800a4a7eeafc31a025dc6703..e6d9e530bb57a358a412c9a072ac47baea03b811 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
@@ -153,12 +153,20 @@ PresentationConnection::PresentationConnection(LocalFrame* frame,
m_id(id),
m_url(url),
m_state(WebPresentationConnectionState::Connecting),
- m_binaryType(BinaryTypeBlob) {}
+ m_binaryType(BinaryTypeBlob),
+ m_proxy(nullptr) {}
PresentationConnection::~PresentationConnection() {
ASSERT(!m_blobLoader);
}
+void PresentationConnection::setProxy(
+ std::unique_ptr<WebPresentationConnectionProxy> proxy) {
+ DCHECK(proxy);
+ DCHECK(!m_proxy);
+ m_proxy = std::move(proxy);
+}
+
// static
PresentationConnection* PresentationConnection::take(
ScriptPromiseResolver* resolver,
@@ -312,13 +320,13 @@ void PresentationConnection::handleMessageQueue() {
Message* message = m_messages.first().get();
switch (message->type) {
case MessageTypeText:
- client->sendString(m_url, m_id, message->text);
+ client->sendString(m_url, m_id, message->text, nullptr);
m_messages.removeFirst();
break;
case MessageTypeArrayBuffer:
client->sendArrayBuffer(m_url, m_id, static_cast<const uint8_t*>(
message->arrayBuffer->data()),
- message->arrayBuffer->byteLength());
+ message->arrayBuffer->byteLength(), nullptr);
m_messages.removeFirst();
break;
case MessageTypeBlob:
@@ -352,7 +360,7 @@ void PresentationConnection::setBinaryType(const String& binaryType) {
ASSERT_NOT_REACHED();
}
-void PresentationConnection::didReceiveTextMessage(const String& message) {
+void PresentationConnection::didReceiveTextMessage(const WebString& message) {
if (m_state != WebPresentationConnectionState::Connected)
return;
@@ -456,10 +464,11 @@ void PresentationConnection::didFinishLoadingBlob(DOMArrayBuffer* buffer) {
ASSERT(buffer && buffer->buffer());
// Send the loaded blob immediately here and continue processing the queue.
WebPresentationClient* client = presentationClient(getExecutionContext());
- if (client)
+ if (client) {
client->sendBlobData(m_url, m_id,
static_cast<const uint8_t*>(buffer->data()),
- buffer->byteLength());
+ buffer->byteLength(), m_proxy.get());
+ }
m_messages.removeFirst();
m_blobLoader.clear();

Powered by Google App Engine
This is Rietveld 408576698