OLD | NEW |
---|---|
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_BROWSER_PRESENTATION_SESSION_MESSAGE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_PRESENTATION_SESSION_MESSAGE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_PRESENTATION_SESSION_MESSAGE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_PRESENTATION_SESSION_MESSAGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 enum CONTENT_EXPORT PresentationMessageType { | |
USE s.singapati at gmail.com
2015/05/18 15:51:16
This is some what duplication. Probably enum Binar
| |
17 TEXT, | |
18 ARRAY_BUFFER, | |
19 BLOB, | |
20 }; | |
21 | |
16 // Represents a presentation session message. | 22 // Represents a presentation session message. |
17 // If this is a text message, |data| is null; otherwise, |message| is null. | 23 // If this is a text message, |data| is null; otherwise, |message| is null. |
18 // Empty messages are allowed. | 24 // Empty messages are allowed. |
19 struct CONTENT_EXPORT PresentationSessionMessage { | 25 struct CONTENT_EXPORT PresentationSessionMessage { |
20 public: | 26 public: |
21 ~PresentationSessionMessage(); | 27 ~PresentationSessionMessage(); |
22 | 28 |
23 // Creates string message, which takes the ownership of |message|. | 29 // Creates string message, which takes the ownership of |message|. |
24 static scoped_ptr<PresentationSessionMessage> CreateStringMessage( | 30 static scoped_ptr<PresentationSessionMessage> CreateStringMessage( |
25 const std::string& presentation_url, | 31 const std::string& presentation_url, |
26 const std::string& presentation_id, | 32 const std::string& presentation_id, |
27 scoped_ptr<std::string> message); | 33 scoped_ptr<std::string> message); |
28 | 34 |
29 // Creates binary message, which takes the ownership of |data|. | 35 // Creates binary message, which takes the ownership of |data|. |
30 static scoped_ptr<PresentationSessionMessage> CreateBinaryMessage( | 36 static scoped_ptr<PresentationSessionMessage> CreateBinaryMessage( |
31 const std::string& presentation_url, | 37 const std::string& presentation_url, |
32 const std::string& presentation_id, | 38 const std::string& presentation_id, |
33 scoped_ptr<std::vector<uint8_t>> data); | 39 scoped_ptr<std::vector<uint8_t>> data, |
40 PresentationMessageType type); | |
34 | 41 |
35 bool is_binary() const; | 42 bool is_binary() const; |
36 std::string presentation_url; | 43 std::string presentation_url; |
37 std::string presentation_id; | 44 std::string presentation_id; |
38 scoped_ptr<std::string> message; | 45 scoped_ptr<std::string> message; |
39 scoped_ptr<std::vector<uint8_t>> data; | 46 scoped_ptr<std::vector<uint8_t>> data; |
47 PresentationMessageType type; | |
40 | 48 |
41 private: | 49 private: |
42 PresentationSessionMessage(const std::string& presentation_url, | 50 PresentationSessionMessage(const std::string& presentation_url, |
43 const std::string& presentation_id, | 51 const std::string& presentation_id, |
44 scoped_ptr<std::string> message); | 52 scoped_ptr<std::string> message); |
45 PresentationSessionMessage(const std::string& presentation_url, | 53 PresentationSessionMessage(const std::string& presentation_url, |
46 const std::string& presentation_id, | 54 const std::string& presentation_id, |
47 scoped_ptr<std::vector<uint8_t>> data); | 55 scoped_ptr<std::vector<uint8_t>> data, |
56 PresentationMessageType type); | |
48 }; | 57 }; |
49 | 58 |
50 } // namespace content | 59 } // namespace content |
51 | 60 |
52 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SESSION_H_ | 61 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SESSION_H_ |
OLD | NEW |