Index: content/public/common/mojo_shell_connection.h |
diff --git a/content/public/common/mojo_shell_connection.h b/content/public/common/mojo_shell_connection.h |
index 1fbe2439a4ad789882fe00729c2cebe94c9446dc..68eca44f07ba7b447de56d3538379d0d8d0703f0 100644 |
--- a/content/public/common/mojo_shell_connection.h |
+++ b/content/public/common/mojo_shell_connection.h |
@@ -8,6 +8,7 @@ |
#include <memory> |
#include "base/callback_forward.h" |
+#include "base/sequenced_task_runner.h" |
#include "content/common/content_export.h" |
#include "content/public/common/mojo_application_info.h" |
#include "services/shell/public/cpp/identity.h" |
@@ -35,6 +36,8 @@ class CONTENT_EXPORT MojoShellConnection { |
using ShellClientRequestHandler = |
base::Callback<void(shell::mojom::ShellClientRequest)>; |
using Factory = base::Callback<std::unique_ptr<MojoShellConnection>(void)>; |
+ using ConnectionFilter = |
+ base::Callback<bool(shell::Connection*, shell::Connector*)>; |
// Stores an instance of |connection| in TLS for the current process. Must be |
// called on the thread the connection was created on. |
@@ -55,13 +58,15 @@ class CONTENT_EXPORT MojoShellConnection { |
// called before the MojoShellConnection has been created. |
static void SetFactoryForTest(Factory* factory); |
- // Creates a MojoShellConnection from |request|. |
+ // Creates a MojoShellConnection from |request|. The connection bind |
+ // its interfaces and accept new connections on |io_task_runner| only. |
static std::unique_ptr<MojoShellConnection> Create( |
- shell::mojom::ShellClientRequest request); |
+ shell::mojom::ShellClientRequest request, |
+ scoped_refptr<base::SequencedTaskRunner> io_task_runner); |
- // Returns the bound shell::ShellConnection object. |
- // TODO(rockot): remove. |
- virtual shell::ShellConnection* GetShellConnection() = 0; |
+ // Sets a closure to be invoked once the connection receives an Initialize() |
+ // request from the shell. |
+ virtual void SetInitializeHandler(const base::Closure& handler) = 0; |
// Returns the shell::Connector received via this connection's ShellClient |
// implementation. Use this to initiate connections as this object's Identity. |
@@ -76,13 +81,10 @@ class CONTENT_EXPORT MojoShellConnection { |
// run immediately before returning from this function. |
virtual void SetConnectionLostClosure(const base::Closure& closure) = 0; |
- // Allows the caller to expose interfaces to the caller using the identity of |
- // this object's ShellClient. As distinct from AddEmbeddedService() and |
- // AddShellClientRequestHandler() which specify unique identities for the |
- // registered services. |
- virtual void AddEmbeddedShellClient( |
- std::unique_ptr<shell::ShellClient> shell_client) = 0; |
- virtual void AddEmbeddedShellClient(shell::ShellClient* shell_client) = 0; |
+ // Allows the caller to filter inbound connections and/or expose interfaces |
+ // on them. Note that ConnectionFilters are always invoked on the |
+ // |io_task_runner| (see Create above.) |
+ virtual void AddConnectionFilter(const ConnectionFilter& filter) = 0; |
// Adds an embedded service to this connection's ShellClientFactory. |
// |info| provides details on how to construct new instances of the |