Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / public / common / mojo_channel_switches.cc
blob8f70ce287d08c7a24f970299ee2484966066c1f3
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/public/common/mojo_channel_switches.h"
7 #include "base/command_line.h"
8 #include "ipc/mojo/ipc_channel_mojo.h"
9 #include "mojo/common/common_type_converters.h"
11 namespace switches {
13 // Replaces renderer-browser IPC channel with ChnanelMojo.
14 // TODO(morrita): Now ChannelMojo for the renderer is on by default.
15 // Remove this once the change sticks.
16 const char kEnableRendererMojoChannel[] =
17 "enable-renderer-mojo-channel";
19 // Disale ChannelMojo usage regardless of the platform or the process type.
20 const char kDisableMojoChannel[] = "disable-mojo-channel";
22 } // namespace switches
24 namespace content {
26 bool ShouldUseMojoChannel() {
27 const base::CommandLine& command_line =
28 *base::CommandLine::ForCurrentProcess();
30 if (command_line.HasSwitch(switches::kDisableMojoChannel))
31 return false;
32 if (command_line.HasSwitch(switches::kEnableRendererMojoChannel))
33 return true;
34 return IPC::ChannelMojo::ShouldBeUsed();
37 } // namespace content