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

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

Issue 387113003: Add a content API to create a message channel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address Jochen's review Created 6 years, 1 month 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/android/javatests/src/org/chromium/content/browser/PostMessageTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/message_port_provider.h
diff --git a/content/public/browser/message_port_provider.h b/content/public/browser/message_port_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..b7e155224f5d79221cf56cd9914d9baba83f9ef3
--- /dev/null
+++ b/content/public/browser/message_port_provider.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2014 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_MESSAGE_PORT_PROVIDER_H_
+#define CONTENT_PUBLIC_BROWSER_MESSAGE_PORT_PROVIDER_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "content/common/content_export.h"
+
+namespace content {
+
+class WebContents;
+
+// An interface consisting of methods that can be called to use Message ports.
+class CONTENT_EXPORT MessagePortProvider {
+ public:
+ // Posts a MessageEvent to the main frame using the given source and target
+ // origins and data. The caller may also provide any message port ids as
+ // part of the message.
+ // See https://html.spec.whatwg.org/multipage/comms.html#messageevent for
+ // further information on message events.
+ // Should be called on IO thread.
+ static void PostMessageToFrame(WebContents* web_contents,
+ const base::string16& source_origin,
+ const base::string16& target_origin,
+ const base::string16& data,
+ const std::vector<int>& ports);
+ // Creates a message channel and provide the ids of the message ports that are
jochen (gone - plz use gerrit) 2014/11/19 08:49:20 nit empty line above this line
sgurun-gerrit only 2014/11/19 19:16:21 Done.
+ // associated with this message channel.
+ // See https://html.spec.whatwg.org/multipage/comms.html#messagechannel
+ // Should be called on IO thread.
+ static void CreateMessageChannel(WebContents* web_contents,
+ int* port1,
+ int* port2);
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePortProvider);
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_MESSAGE_PORT_PROVIDER_H_
« no previous file with comments | « content/public/android/javatests/src/org/chromium/content/browser/PostMessageTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698