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

Unified Diff: content/renderer/presentation/presentation_dispatcher.cc

Issue 2622993002: [Presentation API] Move presentation.mojom to content/common/presentation (Closed)
Patch Set: Fix presentation_service_delegate. DEPS failure 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: content/renderer/presentation/presentation_dispatcher.cc
diff --git a/content/renderer/presentation/presentation_dispatcher.cc b/content/renderer/presentation/presentation_dispatcher.cc
index 7dcf920b1ab86b49b5c5b6a03812899cb811bf5d..6e72224be28a57cb9b3c7b2599d005961ecd7cd1 100644
--- a/content/renderer/presentation/presentation_dispatcher.cc
+++ b/content/renderer/presentation/presentation_dispatcher.cc
@@ -24,7 +24,6 @@
#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationError.h"
#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationReceiver.h"
#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationSessionInfo.h"
-#include "third_party/WebKit/public/platform/modules/presentation/presentation.mojom.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "url/gurl.h"
@@ -33,9 +32,9 @@ namespace mojo {
// Temporary type converter since Presentation API has not been Onion Soup-ed.
template <>
struct TypeConverter<blink::WebPresentationSessionInfo,
- blink::mojom::PresentationSessionInfoPtr> {
+ content::mojom::PresentationSessionInfoPtr> {
static blink::WebPresentationSessionInfo Convert(
- const blink::mojom::PresentationSessionInfoPtr& input) {
+ const content::mojom::PresentationSessionInfoPtr& input) {
return blink::WebPresentationSessionInfo(
blink::WebURL(input->url), blink::WebString::fromUTF8(input->id));
}
@@ -46,30 +45,30 @@ struct TypeConverter<blink::WebPresentationSessionInfo,
namespace {
blink::WebPresentationError::ErrorType GetWebPresentationErrorTypeFromMojo(
- blink::mojom::PresentationErrorType mojoErrorType) {
+ content::mojom::PresentationErrorType mojoErrorType) {
switch (mojoErrorType) {
- case blink::mojom::PresentationErrorType::NO_AVAILABLE_SCREENS:
+ case content::mojom::PresentationErrorType::NO_AVAILABLE_SCREENS:
return blink::WebPresentationError::ErrorTypeNoAvailableScreens;
- case blink::mojom::PresentationErrorType::SESSION_REQUEST_CANCELLED:
+ case content::mojom::PresentationErrorType::SESSION_REQUEST_CANCELLED:
return blink::WebPresentationError::ErrorTypeSessionRequestCancelled;
- case blink::mojom::PresentationErrorType::NO_PRESENTATION_FOUND:
+ case content::mojom::PresentationErrorType::NO_PRESENTATION_FOUND:
return blink::WebPresentationError::ErrorTypeNoPresentationFound;
- case blink::mojom::PresentationErrorType::UNKNOWN:
+ case content::mojom::PresentationErrorType::UNKNOWN:
default:
return blink::WebPresentationError::ErrorTypeUnknown;
}
}
blink::WebPresentationConnectionState GetWebPresentationConnectionStateFromMojo(
- blink::mojom::PresentationConnectionState mojoSessionState) {
+ content::mojom::PresentationConnectionState mojoSessionState) {
switch (mojoSessionState) {
- case blink::mojom::PresentationConnectionState::CONNECTING:
+ case content::mojom::PresentationConnectionState::CONNECTING:
return blink::WebPresentationConnectionState::Connecting;
- case blink::mojom::PresentationConnectionState::CONNECTED:
+ case content::mojom::PresentationConnectionState::CONNECTED:
return blink::WebPresentationConnectionState::Connected;
- case blink::mojom::PresentationConnectionState::CLOSED:
+ case content::mojom::PresentationConnectionState::CLOSED:
return blink::WebPresentationConnectionState::Closed;
- case blink::mojom::PresentationConnectionState::TERMINATED:
+ case content::mojom::PresentationConnectionState::TERMINATED:
return blink::WebPresentationConnectionState::Terminated;
default:
NOTREACHED();
@@ -79,13 +78,14 @@ blink::WebPresentationConnectionState GetWebPresentationConnectionStateFromMojo(
blink::WebPresentationConnectionCloseReason
GetWebPresentationConnectionCloseReasonFromMojo(
- blink::mojom::PresentationConnectionCloseReason mojoConnectionCloseReason) {
+ content::mojom::PresentationConnectionCloseReason
+ mojoConnectionCloseReason) {
switch (mojoConnectionCloseReason) {
- case blink::mojom::PresentationConnectionCloseReason::CONNECTION_ERROR:
+ case content::mojom::PresentationConnectionCloseReason::CONNECTION_ERROR:
return blink::WebPresentationConnectionCloseReason::Error;
- case blink::mojom::PresentationConnectionCloseReason::CLOSED:
+ case content::mojom::PresentationConnectionCloseReason::CLOSED:
return blink::WebPresentationConnectionCloseReason::Closed;
- case blink::mojom::PresentationConnectionCloseReason::WENT_AWAY:
+ case content::mojom::PresentationConnectionCloseReason::WENT_AWAY:
return blink::WebPresentationConnectionCloseReason::WentAway;
default:
NOTREACHED();
@@ -189,7 +189,7 @@ void PresentationDispatcher::sendArrayBuffer(
message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest(
presentationUrl, presentationId,
- blink::mojom::PresentationMessageType::BINARY, data, length)));
+ content::mojom::PresentationMessageType::BINARY, data, length)));
// Start processing request if only one in the queue.
if (message_request_queue_.size() == 1)
DoSendMessage(message_request_queue_.front().get());
@@ -209,7 +209,7 @@ void PresentationDispatcher::sendBlobData(
message_request_queue_.push(base::WrapUnique(CreateSendBinaryMessageRequest(
presentationUrl, presentationId,
- blink::mojom::PresentationMessageType::BINARY, data, length)));
+ content::mojom::PresentationMessageType::BINARY, data, length)));
// Start processing request if only one in the queue.
if (message_request_queue_.size() == 1)
DoSendMessage(message_request_queue_.front().get());
@@ -389,7 +389,7 @@ void PresentationDispatcher::OnScreenAvailabilityNotSupported(const GURL& url) {
}
void PresentationDispatcher::OnDefaultSessionStarted(
- blink::mojom::PresentationSessionInfoPtr session_info) {
+ content::mojom::PresentationSessionInfoPtr session_info) {
if (!controller_)
return;
@@ -402,8 +402,8 @@ void PresentationDispatcher::OnDefaultSessionStarted(
void PresentationDispatcher::OnSessionCreated(
std::unique_ptr<blink::WebPresentationConnectionCallback> callback,
- blink::mojom::PresentationSessionInfoPtr session_info,
- blink::mojom::PresentationErrorPtr error) {
+ content::mojom::PresentationSessionInfoPtr session_info,
+ content::mojom::PresentationErrorPtr error) {
DCHECK(callback);
if (!error.is_null()) {
DCHECK(session_info.is_null());
@@ -420,9 +420,9 @@ void PresentationDispatcher::OnSessionCreated(
}
void PresentationDispatcher::OnReceiverConnectionAvailable(
- blink::mojom::PresentationSessionInfoPtr session_info,
- blink::mojom::PresentationConnectionPtr,
- blink::mojom::PresentationConnectionRequest) {
+ content::mojom::PresentationSessionInfoPtr session_info,
+ content::mojom::PresentationConnectionPtr,
+ content::mojom::PresentationConnectionRequest) {
if (receiver_) {
receiver_->onReceiverConnectionAvailable(
mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info));
@@ -430,8 +430,8 @@ void PresentationDispatcher::OnReceiverConnectionAvailable(
}
void PresentationDispatcher::OnConnectionStateChanged(
- blink::mojom::PresentationSessionInfoPtr session_info,
- blink::mojom::PresentationConnectionState state) {
+ content::mojom::PresentationSessionInfoPtr session_info,
+ content::mojom::PresentationConnectionState state) {
if (!controller_)
return;
@@ -441,8 +441,8 @@ void PresentationDispatcher::OnConnectionStateChanged(
}
void PresentationDispatcher::OnConnectionClosed(
- blink::mojom::PresentationSessionInfoPtr session_info,
- blink::mojom::PresentationConnectionCloseReason reason,
+ content::mojom::PresentationSessionInfoPtr session_info,
+ content::mojom::PresentationConnectionCloseReason reason,
const std::string& message) {
if (!controller_)
return;
@@ -454,8 +454,8 @@ void PresentationDispatcher::OnConnectionClosed(
}
void PresentationDispatcher::OnConnectionMessagesReceived(
- blink::mojom::PresentationSessionInfoPtr session_info,
- std::vector<blink::mojom::ConnectionMessagePtr> messages) {
+ content::mojom::PresentationSessionInfoPtr session_info,
+ std::vector<content::mojom::ConnectionMessagePtr> messages) {
if (!controller_)
return;
@@ -465,14 +465,14 @@ void PresentationDispatcher::OnConnectionMessagesReceived(
auto web_session_info =
mojo::ConvertTo<blink::WebPresentationSessionInfo>(session_info);
switch (messages[i]->type) {
- case blink::mojom::PresentationMessageType::TEXT: {
+ case content::mojom::PresentationMessageType::TEXT: {
// TODO(mfoltz): Do we need to DCHECK(messages[i]->message)?
controller_->didReceiveSessionTextMessage(
web_session_info,
blink::WebString::fromUTF8(messages[i]->message.value()));
break;
}
- case blink::mojom::PresentationMessageType::BINARY: {
+ case content::mojom::PresentationMessageType::BINARY: {
// TODO(mfoltz): Do we need to DCHECK(messages[i]->data)?
controller_->didReceiveSessionBinaryMessage(
web_session_info, &(messages[i]->data->front()),
@@ -514,8 +514,8 @@ void PresentationDispatcher::UpdateListeningState(AvailabilityStatus* status) {
}
PresentationDispatcher::SendMessageRequest::SendMessageRequest(
- blink::mojom::PresentationSessionInfoPtr session_info,
- blink::mojom::ConnectionMessagePtr message)
+ content::mojom::PresentationSessionInfoPtr session_info,
+ content::mojom::ConnectionMessagePtr message)
: session_info(std::move(session_info)), message(std::move(message)) {}
PresentationDispatcher::SendMessageRequest::~SendMessageRequest() {}
@@ -526,14 +526,14 @@ PresentationDispatcher::CreateSendTextMessageRequest(
const blink::WebURL& presentationUrl,
const blink::WebString& presentationId,
const blink::WebString& message) {
- blink::mojom::PresentationSessionInfoPtr session_info =
- blink::mojom::PresentationSessionInfo::New();
+ content::mojom::PresentationSessionInfoPtr session_info =
+ content::mojom::PresentationSessionInfo::New();
session_info->url = presentationUrl;
session_info->id = presentationId.utf8();
- blink::mojom::ConnectionMessagePtr session_message =
- blink::mojom::ConnectionMessage::New();
- session_message->type = blink::mojom::PresentationMessageType::TEXT;
+ content::mojom::ConnectionMessagePtr session_message =
+ content::mojom::ConnectionMessage::New();
+ session_message->type = content::mojom::PresentationMessageType::TEXT;
session_message->message = message.utf8();
return new SendMessageRequest(std::move(session_info),
std::move(session_message));
@@ -544,16 +544,16 @@ PresentationDispatcher::SendMessageRequest*
PresentationDispatcher::CreateSendBinaryMessageRequest(
const blink::WebURL& presentationUrl,
const blink::WebString& presentationId,
- blink::mojom::PresentationMessageType type,
+ content::mojom::PresentationMessageType type,
const uint8_t* data,
size_t length) {
- blink::mojom::PresentationSessionInfoPtr session_info =
- blink::mojom::PresentationSessionInfo::New();
+ content::mojom::PresentationSessionInfoPtr session_info =
+ content::mojom::PresentationSessionInfo::New();
session_info->url = presentationUrl;
session_info->id = presentationId.utf8();
- blink::mojom::ConnectionMessagePtr session_message =
- blink::mojom::ConnectionMessage::New();
+ content::mojom::ConnectionMessagePtr session_message =
+ content::mojom::ConnectionMessage::New();
session_message->type = type;
session_message->data = std::vector<uint8_t>(data, data + length);
return new SendMessageRequest(std::move(session_info),

Powered by Google App Engine
This is Rietveld 408576698