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

Unified Diff: content/public/browser/presentation_session_message.h

Issue 1118103002: Implements ListenForSessionMessages in PresentationServiceImpl; uses Swap to avoid copying large da… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses Mark's comments Created 5 years, 8 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/public/browser/presentation_session_message.h
diff --git a/content/public/browser/presentation_session_message.h b/content/public/browser/presentation_session_message.h
new file mode 100644
index 0000000000000000000000000000000000000000..a9ea3632bea86e4f43d91b9adb7a1e3e8ea0e1f1
--- /dev/null
+++ b/content/public/browser/presentation_session_message.h
@@ -0,0 +1,52 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_BROWSER_PRESENTATION_SESSION_MESSAGE_H_
+#define CONTENT_PUBLIC_BROWSER_PRESENTATION_SESSION_MESSAGE_H_
+
+#include <string>
+#include <vector>
+
+#include "base/memory/scoped_ptr.h"
+#include "content/common/content_export.h"
+
+namespace content {
+
+// Represents a presentation session message.
+// If this is a text message, |data| is null; otherwise, |message| is null.
+// Empty messages are allowed.
+struct CONTENT_EXPORT PresentationSessionMessage {
+ public:
+ ~PresentationSessionMessage();
+
+ // Creates string message, which takes the ownership of |message|.
+ static scoped_ptr<PresentationSessionMessage> CreateStringMessage(
imcheng (use chromium acct) 2015/05/04 19:53:55 I think you also need to add CONTENT_EXPORT to sta
haibinlu 2015/05/04 21:33:50 Done.
+ const std::string& presentation_url,
+ const std::string& presentation_id,
+ scoped_ptr<std::string> message);
+
+ // Creates binary message, which takes the ownership of |data|.
+ static scoped_ptr<PresentationSessionMessage> CreateBinaryMessage(
+ const std::string& presentation_url,
+ const std::string& presentation_id,
+ scoped_ptr<std::vector<uint8_t>> data);
+
+ bool is_binary() const;
+ const std::string presentation_url;
+ const std::string presentation_id;
+ scoped_ptr<std::string> message;
+ scoped_ptr<std::vector<uint8_t>> data;
+
+ private:
+ PresentationSessionMessage(const std::string& presentation_url,
+ const std::string& presentation_id,
+ scoped_ptr<std::string> message);
+ PresentationSessionMessage(const std::string& presentation_url,
+ const std::string& presentation_id,
+ scoped_ptr<std::vector<uint8_t>> data);
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SESSION_H_

Powered by Google App Engine
This is Rietveld 408576698