| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/public/common/mojo_channel_switches.h" | 5 #include "content/public/common/mojo_channel_switches.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | |
| 8 #include "base/metrics/field_trial.h" | |
| 9 #include "base/strings/string_util.h" | |
| 10 #include "ipc/mojo/ipc_channel_mojo.h" | 7 #include "ipc/mojo/ipc_channel_mojo.h" |
| 11 #include "mojo/common/common_type_converters.h" | |
| 12 | 8 |
| 13 namespace switches { | 9 namespace switches { |
| 14 | 10 |
| 15 // Enable ChannelMojo on any supported platform. | |
| 16 const char kEnableMojoChannel[] = "enable-mojo-channel"; | |
| 17 | |
| 18 // The token to use to construct the message pipe on which to layer ChannelMojo. | 11 // The token to use to construct the message pipe on which to layer ChannelMojo. |
| 19 const char kMojoChannelToken[] = "mojo-channel-token"; | 12 const char kMojoChannelToken[] = "mojo-channel-token"; |
| 20 | 13 |
| 21 // The token to use to construct the message pipe for MojoApplication. | 14 // The token to use to construct the message pipe for MojoApplication. |
| 22 const char kMojoApplicationChannelToken[] = "mojo-application-channel-token"; | 15 const char kMojoApplicationChannelToken[] = "mojo-application-channel-token"; |
| 23 | 16 |
| 24 } // namespace switches | 17 } // namespace switches |
| 25 | |
| 26 namespace { | |
| 27 | |
| 28 const char kMojoChannelExperimentName[] = "MojoChannel"; | |
| 29 | |
| 30 } // namespace | |
| 31 | |
| 32 namespace content { | |
| 33 | |
| 34 bool ShouldUseMojoChannel() { | |
| 35 const std::string group = | |
| 36 base::FieldTrialList::FindFullName(kMojoChannelExperimentName); | |
| 37 | |
| 38 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 39 switches::kEnableMojoChannel)) | |
| 40 return true; | |
| 41 | |
| 42 return base::StartsWith( | |
| 43 group, "Enabled", base::CompareCase::INSENSITIVE_ASCII); | |
| 44 } | |
| 45 | |
| 46 } // namespace content | |
| OLD | NEW |