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

Unified Diff: content/renderer/mojo_message_filter.h

Issue 195993010: Adds the ability for the renderer to create the mojo channel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge to trunk and update ifdefs Created 6 years, 9 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
Index: content/renderer/mojo_message_filter.h
diff --git a/content/renderer/mojo_message_filter.h b/content/renderer/mojo_message_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..9cbe6b39de07bca1eb294b621f61b09afeae70ac
--- /dev/null
+++ b/content/renderer/mojo_message_filter.h
@@ -0,0 +1,48 @@
+// 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_RENDERER_MOJO_MESSAGE_FILTER_H_
+#define CONTENT_RENDERER_MOJO_MESSAGE_FILTER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "content/public/renderer/render_process_observer.h"
+#include "ipc/ipc_platform_file.h"
+
+namespace mojo {
+namespace embedder{
+struct ChannelInfo;
+}
+}
+
+namespace content {
+
+class MojoChannelInit;
+class RenderThread;
+
+// RenderProcessObserver implementation that initializes the mojo channel when
+// the right IPC is seen.
+// MojoMessageFilter deletes itself when the RenderProcess is shutdown.
+class MojoMessageFilter : public content::RenderProcessObserver {
+ public:
+ MojoMessageFilter(RenderThread* render_thread);
+
+ // RenderProcessObserver overrides:
+ virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
+ virtual void OnRenderProcessShutdown() OVERRIDE;
+
+ private:
+ virtual ~MojoMessageFilter();
+
+ void OnChannelCreated(const IPC::PlatformFileForTransit& file);
+
+ content::RenderThread* render_thread_;
+
+ scoped_ptr<MojoChannelInit> channel_init_;
+
+ DISALLOW_COPY_AND_ASSIGN(MojoMessageFilter);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MOJO_MESSAGE_FILTER_H_

Powered by Google App Engine
This is Rietveld 408576698