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

Unified Diff: content/common/mojo/mojo_shell_connection_impl.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/common/mojo/DEPS ('k') | content/common/mojo/mojo_shell_connection_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/mojo/mojo_shell_connection_impl.h
diff --git a/content/common/mojo/mojo_shell_connection_impl.h b/content/common/mojo/mojo_shell_connection_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..484e2ab79f6021c720d81effb403a8b25d9d54f4
--- /dev/null
+++ b/content/common/mojo/mojo_shell_connection_impl.h
@@ -0,0 +1,65 @@
+// 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_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_
+#define CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_
+
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/public/common/mojo_shell_connection.h"
+#include "mojo/application/public/cpp/application_delegate.h"
+
+namespace mojo {
+namespace runner {
+class RunnerConnection;
+}
+}
+
+namespace content {
+
+// Returns true if the Chrome browser process was launched from the external
+// Mojo shell.
+bool IsRunningInMojoShell();
+
+class MojoShellConnectionImpl : public MojoShellConnection,
+ public mojo::ApplicationDelegate {
+ public:
+ // Creates an instance of this class and stuffs it in TLS on the calling
+ // thread. Retrieve it using MojoShellConnection::Get(). Blocks the calling
+ // thread until calling GetApplication() will return an Initialized()
+ // application with a bound ShellPtr.
+ static void Create();
+
+ private:
+ MojoShellConnectionImpl();
+ ~MojoShellConnectionImpl() override;
+
+ // mojo::ApplicationDelegate:
+ void Initialize(mojo::ApplicationImpl* application) override;
+ bool ConfigureIncomingConnection(
+ mojo::ApplicationConnection* connection) override;
+
+ // MojoShellConnection:
+ mojo::ApplicationImpl* GetApplication() override;
+ void AddListener(Listener* listener) override;
+ void RemoveListener(Listener* listener) override;
+
+ // Blocks the calling thread until a connection to the spawning shell is
+ // established, an Application request from it is bound, and the Initialize()
+ // method on that application is called.
+ void WaitForShell();
+
+ bool initialized_;
+ scoped_ptr<mojo::runner::RunnerConnection> runner_connection_;
+ scoped_ptr<mojo::ApplicationImpl> application_impl_;
+ std::vector<Listener*> listeners_;
+
+ DISALLOW_COPY_AND_ASSIGN(MojoShellConnectionImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_
« no previous file with comments | « content/common/mojo/DEPS ('k') | content/common/mojo/mojo_shell_connection_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698