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

Unified Diff: content/public/common/presentation_connection_message.h

Issue 2706463002: [Presentation API] Mojo typemap for content::PresentationConnectionMessage (Closed)
Patch Set: Fix compile error after rebase Created 3 years, 10 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
« no previous file with comments | « content/public/common/BUILD.gn ('k') | content/public/common/presentation_connection_message.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/common/presentation_connection_message.h
diff --git a/content/public/common/presentation_connection_message.h b/content/public/common/presentation_connection_message.h
index 646958e4dd41bfd8bc8aac6c6ead24fa6d15e397..d9130c13860f1f0ed32a54a23a2eda036669f004 100644
--- a/content/public/common/presentation_connection_message.h
+++ b/content/public/common/presentation_connection_message.h
@@ -5,33 +5,43 @@
#ifndef CONTENT_PUBLIC_COMMON_PRESENTATION_CONNECTION_MESSAGE_H_
#define CONTENT_PUBLIC_COMMON_PRESENTATION_CONNECTION_MESSAGE_H_
+#include <stddef.h> // For size_t
#include <stdint.h>
-#include <memory>
#include <string>
#include <vector>
+#include "base/optional.h"
#include "content/common/content_export.h"
namespace content {
-enum PresentationMessageType {
- TEXT,
- BINARY,
-};
+// The maximum number of bytes allowed in a presentation connection message.
+CONTENT_EXPORT extern const size_t kMaxPresentationConnectionMessageSize;
-// Represents a presentation connection message.
-// If this is a text message, |data| is null; otherwise, |message| is null.
-// Empty messages are allowed.
+// Represents a presentation connection message. If this is a text message,
+// |data| is null; otherwise, |message| is null. Empty messages are allowed.
struct CONTENT_EXPORT PresentationConnectionMessage {
public:
- explicit PresentationConnectionMessage(PresentationMessageType type);
+ // Constructs a new, untyped message (for Mojo). These messages are not valid
+ // and exactly one of |message| or |data| must be set.
+ PresentationConnectionMessage();
+ // PCM is a move-only type.
+ PresentationConnectionMessage(PresentationConnectionMessage&& other);
+ // Constructs a text message from |message|.
+ explicit PresentationConnectionMessage(std::string message);
+ // Constructs a binary message from |data|.
+ explicit PresentationConnectionMessage(std::vector<uint8_t> data);
~PresentationConnectionMessage();
bool is_binary() const;
- const PresentationMessageType type;
- std::string message;
- std::unique_ptr<std::vector<uint8_t>> data;
+
+ bool operator==(const PresentationConnectionMessage& other) const;
+ PresentationConnectionMessage& operator=(
+ PresentationConnectionMessage&& other);
+
+ base::Optional<std::string> message;
+ base::Optional<std::vector<uint8_t>> data;
};
} // namespace content
« no previous file with comments | « content/public/common/BUILD.gn ('k') | content/public/common/presentation_connection_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698