Index: content/public/common/mojo_channel_switches.cc |
diff --git a/content/public/common/mojo_channel_switches.cc b/content/public/common/mojo_channel_switches.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8f70ce287d08c7a24f970299ee2484966066c1f3 |
--- /dev/null |
+++ b/content/public/common/mojo_channel_switches.cc |
@@ -0,0 +1,37 @@ |
+// 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. |
+ |
+#include "content/public/common/mojo_channel_switches.h" |
+ |
+#include "base/command_line.h" |
+#include "ipc/mojo/ipc_channel_mojo.h" |
+#include "mojo/common/common_type_converters.h" |
+ |
+namespace switches { |
+ |
+// Replaces renderer-browser IPC channel with ChnanelMojo. |
+// TODO(morrita): Now ChannelMojo for the renderer is on by default. |
+// Remove this once the change sticks. |
+const char kEnableRendererMojoChannel[] = |
+ "enable-renderer-mojo-channel"; |
+ |
+// Disale ChannelMojo usage regardless of the platform or the process type. |
+const char kDisableMojoChannel[] = "disable-mojo-channel"; |
+ |
+} // namespace switches |
+ |
+namespace content { |
+ |
+bool ShouldUseMojoChannel() { |
+ const base::CommandLine& command_line = |
+ *base::CommandLine::ForCurrentProcess(); |
+ |
+ if (command_line.HasSwitch(switches::kDisableMojoChannel)) |
+ return false; |
+ if (command_line.HasSwitch(switches::kEnableRendererMojoChannel)) |
+ return true; |
+ return IPC::ChannelMojo::ShouldBeUsed(); |
+} |
+ |
+} // namespace content |