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

Unified Diff: content/public/common/mojo_shell_connection.h

Issue 1442893002: Move Shell connection to content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@i2
Patch Set: . Created 5 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/content_common.gypi ('k') | mandoline/ui/desktop_ui/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..af4cce1341484871827a2450e83114662ce8155e
--- /dev/null
+++ b/content/public/common/mojo_shell_connection.h
@@ -0,0 +1,59 @@
+// 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_COMMON_MOJO_SHELL_CONNECTION_H_
+#define CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_
+
+#include "content/common/content_export.h"
+
+namespace mojo {
+class ApplicationConnection;
+class ApplicationImpl;
+}
+
+namespace content {
+
+// Encapsulates a connection to a spawning external Mojo shell.
+// Access an instance by calling Get(), on the thread the Shell connection is
+// bound. Clients can implement Listener, which allows them to register services
+// to expose to inbound connections. Clients should call this any time after
+// the main message loop is created but not yet run (e.g. in the browser process
+// this object is created in PreMainMessageLoopRun(), so the BrowserMainParts
+// impl can access this in its implementation of that same method.
+class CONTENT_EXPORT MojoShellConnection {
+ public:
+ // Override to add additional services to inbound connections.
+ class Listener {
+ public:
+ virtual bool ConfigureIncomingConnection(
+ mojo::ApplicationConnection* connection) = 0;
+
+ protected:
+ virtual ~Listener() {}
+ };
+
+ // Will return null if no connection has been established (either because it
+ // hasn't happened yet or the application was not spawned from the external
+ // Mojo shell.
+ static MojoShellConnection* Get();
+
+ // Destroys the connection. Must be called on the thread the connection was
+ // created on.
+ static void Destroy();
+
+ // Returns an Initialized() ApplicationImpl.
+ virtual mojo::ApplicationImpl* GetApplication() = 0;
+
+ // [De]Register an impl of Listener that will be consulted when the wrapped
+ // ApplicationImpl exposes services to inbound connections.
+ virtual void AddListener(Listener* listener) = 0;
+ virtual void RemoveListener(Listener* listener) = 0;
+
+ protected:
+ virtual ~MojoShellConnection();
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_
« no previous file with comments | « content/content_common.gypi ('k') | mandoline/ui/desktop_ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698