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

Unified Diff: content/child/mojo/mojo_application.h

Issue 236813002: Move Mojo channel initialization closer to IPC::Channel setup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more missing deps Created 6 years, 8 months 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/child/child_thread.cc ('k') | content/child/mojo/mojo_application.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/mojo/mojo_application.h
diff --git a/content/child/mojo/mojo_application.h b/content/child/mojo/mojo_application.h
new file mode 100644
index 0000000000000000000000000000000000000000..fad9888940741fa86af22cc0d215f804871bd5d6
--- /dev/null
+++ b/content/child/mojo/mojo_application.h
@@ -0,0 +1,47 @@
+// Copyright 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_CHILD_MOJO_MOJO_APPLICATION_H_
+#define CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_
+
+#include "ipc/ipc_platform_file.h"
+#include "mojo/common/channel_init.h"
+#include "mojo/public/cpp/bindings/remote_ptr.h"
+#include "mojo/public/interfaces/shell/shell.mojom.h"
+
+namespace IPC {
+class Message;
+}
+
+namespace content {
+
+// MojoApplication represents the code needed to setup a child process as a
+// Mojo application via Chrome IPC. Instantiate MojoApplication and call its
+// OnMessageReceived method to give it a shot at handling Chrome IPC messages.
+// It makes the mojo::Shell interface available and calls methods on the given
+// mojo::ShellClient interface as calls come in.
+class MojoApplication {
+ public:
+ // The ShellClient pointer must remain valid for the lifetime of the
+ // MojoApplication instance.
+ explicit MojoApplication(mojo::ShellClient* shell_client);
+ ~MojoApplication();
+
+ bool OnMessageReceived(const IPC::Message& msg);
+
+ mojo::Shell* shell() { return shell_.get(); }
+
+ private:
+ void OnActivate(const IPC::PlatformFileForTransit& file);
+
+ mojo::common::ChannelInit channel_init_;
+ mojo::RemotePtr<mojo::Shell> shell_;
+ mojo::ShellClient* shell_client_;
+
+ DISALLOW_COPY_AND_ASSIGN(MojoApplication);
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_
« no previous file with comments | « content/child/child_thread.cc ('k') | content/child/mojo/mojo_application.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698