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

Side by Side Diff: content/public/common/presentation_connection_message.h

Issue 2947403004: [MediaRouter] Replace RouteMessage with PresentationConnectionMessage (Closed)
Patch Set: rebase Created 3 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 #ifndef CONTENT_PUBLIC_COMMON_PRESENTATION_CONNECTION_MESSAGE_H_ 5 #ifndef CONTENT_PUBLIC_COMMON_PRESENTATION_CONNECTION_MESSAGE_H_
6 #define CONTENT_PUBLIC_COMMON_PRESENTATION_CONNECTION_MESSAGE_H_ 6 #define CONTENT_PUBLIC_COMMON_PRESENTATION_CONNECTION_MESSAGE_H_
7 7
8 #include <stddef.h> // For size_t 8 #include <stddef.h> // For size_t
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/optional.h" 14 #include "base/optional.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 // The maximum number of bytes allowed in a presentation connection message. 19 // The maximum number of bytes allowed in a presentation connection message.
20 CONTENT_EXPORT extern const size_t kMaxPresentationConnectionMessageSize; 20 CONTENT_EXPORT extern const size_t kMaxPresentationConnectionMessageSize;
21 21
22 // Represents a presentation connection message. If this is a text message, 22 // Represents a presentation connection message. If this is a text message,
23 // |data| is null; otherwise, |message| is null. Empty messages are allowed. 23 // |data| is null; otherwise, |message| is null. Empty messages are allowed.
24 struct CONTENT_EXPORT PresentationConnectionMessage { 24 struct CONTENT_EXPORT PresentationConnectionMessage {
25 public: 25 public:
26 // Constructs a new, untyped message (for Mojo). These messages are not valid 26 // Constructs a new, untyped message (for Mojo). These messages are not valid
27 // and exactly one of |message| or |data| must be set. 27 // and exactly one of |message| or |data| must be set.
28 PresentationConnectionMessage(); 28 PresentationConnectionMessage();
29 // PCM is a move-only type. 29 // Copy constructor / assignment are necessary due to MediaRouter allowing
30 PresentationConnectionMessage(PresentationConnectionMessage&& other); 30 // multiple RouteMessageObserver instances per MediaRoute.
31 PresentationConnectionMessage(const PresentationConnectionMessage& other);
32 PresentationConnectionMessage(PresentationConnectionMessage&& other) noexcept;
31 // Constructs a text message from |message|. 33 // Constructs a text message from |message|.
32 explicit PresentationConnectionMessage(std::string message); 34 explicit PresentationConnectionMessage(std::string message);
33 // Constructs a binary message from |data|. 35 // Constructs a binary message from |data|.
34 explicit PresentationConnectionMessage(std::vector<uint8_t> data); 36 explicit PresentationConnectionMessage(std::vector<uint8_t> data);
37
35 ~PresentationConnectionMessage(); 38 ~PresentationConnectionMessage();
36 39
37 bool is_binary() const; 40 bool is_binary() const;
38 41
39 bool operator==(const PresentationConnectionMessage& other) const; 42 bool operator==(const PresentationConnectionMessage& other) const;
40 PresentationConnectionMessage& operator=( 43 PresentationConnectionMessage& operator=(
44 const PresentationConnectionMessage& other);
45 PresentationConnectionMessage& operator=(
41 PresentationConnectionMessage&& other); 46 PresentationConnectionMessage&& other);
42 47
43 base::Optional<std::string> message; 48 base::Optional<std::string> message;
44 base::Optional<std::vector<uint8_t>> data; 49 base::Optional<std::vector<uint8_t>> data;
45 }; 50 };
46 51
47 } // namespace content 52 } // namespace content
48 53
49 #endif // CONTENT_PUBLIC_COMMON_PRESENTATION_CONNECTION_MESSAGE_H_ 54 #endif // CONTENT_PUBLIC_COMMON_PRESENTATION_CONNECTION_MESSAGE_H_
OLDNEW
« no previous file with comments | « chrome/common/media_router/route_message.cc ('k') | content/public/common/presentation_connection_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698