[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / content / public / browser / presentation_session_message.h
blob24e6a4cc72753537216d07217f1ec351e6a60c3c
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_PRESENTATION_SESSION_MESSAGE_H_
6 #define CONTENT_PUBLIC_BROWSER_PRESENTATION_SESSION_MESSAGE_H_
8 #include <string>
9 #include <vector>
11 #include "base/memory/scoped_ptr.h"
12 #include "content/common/content_export.h"
14 namespace content {
16 enum CONTENT_EXPORT PresentationMessageType {
17 TEXT,
18 ARRAY_BUFFER,
19 BLOB,
22 // Represents a presentation session message.
23 // If this is a text message, |data| is null; otherwise, |message| is null.
24 // Empty messages are allowed.
25 struct CONTENT_EXPORT PresentationSessionMessage {
26 public:
27 ~PresentationSessionMessage();
29 // Creates string message, which takes the ownership of |message|.
30 static scoped_ptr<PresentationSessionMessage> CreateStringMessage(
31 const std::string& presentation_url,
32 const std::string& presentation_id,
33 scoped_ptr<std::string> message);
35 // Creates array buffer message, which takes the ownership of |data|.
36 static scoped_ptr<PresentationSessionMessage> CreateArrayBufferMessage(
37 const std::string& presentation_url,
38 const std::string& presentation_id,
39 scoped_ptr<std::vector<uint8_t>> data);
41 // Creates blob message, which takes the ownership of |data|.
42 static scoped_ptr<PresentationSessionMessage> CreateBlobMessage(
43 const std::string& presentation_url,
44 const std::string& presentation_id,
45 scoped_ptr<std::vector<uint8_t>> data);
47 bool is_binary() const;
48 std::string presentation_url;
49 std::string presentation_id;
50 PresentationMessageType type;
51 scoped_ptr<std::string> message;
52 scoped_ptr<std::vector<uint8_t>> data;
54 private:
55 PresentationSessionMessage(const std::string& presentation_url,
56 const std::string& presentation_id,
57 scoped_ptr<std::string> message);
58 PresentationSessionMessage(const std::string& presentation_url,
59 const std::string& presentation_id,
60 PresentationMessageType type,
61 scoped_ptr<std::vector<uint8_t>> data);
64 } // namespace content
66 #endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SESSION_H_