Index: content/browser/mojo/browser_shell_connection.h |
diff --git a/content/browser/mojo/browser_shell_connection.h b/content/browser/mojo/browser_shell_connection.h |
index 213085641a2a80c04a9f278ea5b9a9c2c085a463..75e58766d33ff5b65350aab45b2e9d31647cb077 100644 |
--- a/content/browser/mojo/browser_shell_connection.h |
+++ b/content/browser/mojo/browser_shell_connection.h |
@@ -33,7 +33,17 @@ class BrowserShellConnection |
public shell::InterfaceFactory<shell::mojom::ShellClientFactory>, |
public shell::mojom::ShellClientFactory { |
public: |
+ using ShellClientRequestHandler = |
+ base::Callback<void(shell::mojom::ShellClientRequest)>; |
+ |
+ // Constructs a connection which does not own a ShellClient pipe. This |
+ // connection must be manually fed new incoming connections via its |
+ // shell::ShellClient interface. |
+ BrowserShellConnection(); |
+ |
+ // Constructs a connection associated with its own ShellClient pipe. |
explicit BrowserShellConnection(shell::mojom::ShellClientRequest request); |
+ |
~BrowserShellConnection() override; |
shell::Connector* GetConnector(); |
@@ -48,6 +58,15 @@ class BrowserShellConnection |
const EmbeddedApplicationRunner::FactoryCallback& callback, |
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
+ // Adds a generic ShellClientRequestHandler for a given application name. This |
+ // will be used to satisfy any incoming calls to CreateShellClient() which |
+ // reference the given name. |
+ // |
+ // For in-process applications, it is preferrable to use |
+ // |AddEmbeddedApplication()| as defined above. |
+ void AddShellClientRequestHandler(const base::StringPiece& name, |
+ const ShellClientRequestHandler& handler); |
+ |
private: |
// shell::ShellClient: |
bool AcceptConnection(shell::Connection* connection) override; |
@@ -64,6 +83,7 @@ class BrowserShellConnection |
mojo::BindingSet<shell::mojom::ShellClientFactory> factory_bindings_; |
std::unordered_map<std::string, std::unique_ptr<EmbeddedApplicationRunner>> |
embedded_apps_; |
+ std::unordered_map<std::string, ShellClientRequestHandler> request_handlers_; |
DISALLOW_COPY_AND_ASSIGN(BrowserShellConnection); |
}; |