Chromium Code Reviews| 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_ |