Chromium Code Reviews| Index: chromecast/base/chromecast_switches.cc |
| diff --git a/chromecast/base/chromecast_switches.cc b/chromecast/base/chromecast_switches.cc |
| index 469768cea65d3114f955b7ea50058dc7ffa7b8e9..59a7f7c07647ee9a482c0cca830b9822faad372a 100644 |
| --- a/chromecast/base/chromecast_switches.cc |
| +++ b/chromecast/base/chromecast_switches.cc |
| @@ -2,10 +2,16 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "base/command_line.h" |
|
halliwell
2016/03/05 01:01:50
ordering nit: put the header corresponding to the
jyw
2016/03/08 02:09:24
Done.
|
| #include "chromecast/base/chromecast_switches.h" |
| namespace switches { |
| +namespace { |
| +// Value indicating whether flag from command line switch is false. |
| +const char kSwitchValueFalse[] = "false"; |
| +} // namespace |
| + |
| // Enable the CMA media pipeline. |
| const char kEnableCmaMediaPipeline[] = "enable-cma-media-pipeline"; |
| @@ -32,6 +38,10 @@ const char kLastLaunchedApp[] = "last-launched-app"; |
| // started. |
| const char kPreviousApp[] = "previous-app"; |
| +// Flag indicating that a resource provider must be set up to provide cast |
| +// receiver with resources. Apps cannot start until provided resources. |
| +const char kAcceptResourceProvider[] = "accept-resource-provider"; |
| + |
| // Size of the ALSA output buffer in frames. This directly sets the latency of |
| // the output device. Latency can be calculated by multiplying the sample rate |
| // by the output buffer size. |
| @@ -56,3 +66,23 @@ const char kAlsaCheckCloseTimeout[] = "alsa-check-close-timeout"; |
| const char kAlsaNumOutputChannels[] = "alsa-num-output-channels"; |
| } // namespace switches |
| + |
| +namespace base { |
| + |
| +bool GetSwitchValueBoolean(const std::string& switch_string) { |
| + const base::CommandLine* command_line = |
| + base::CommandLine::ForCurrentProcess(); |
| + return command_line->HasSwitch(switch_string) && |
| + command_line->GetSwitchValueASCII(switch_string) |
| + .compare(switches::kSwitchValueFalse); |
|
halliwell
2016/03/05 01:01:50
seems like this function accepts any old value tha
byungchul
2016/03/07 17:19:40
These functions are used to disable a feature expl
halliwell
2016/03/07 23:33:55
Thanks for explanation. It definitely sounds good
kmackay
2016/03/08 00:06:11
Or, just have one function, and pass in the defaul
kmackay
2016/03/08 00:06:11
I'd rather just accept 'true' or 'false' (or no va
jyw
2016/03/08 02:09:24
Done.
|
| +} |
| + |
| +bool IsSwitchExplicitFalse(const std::string& switch_string) { |
| + const base::CommandLine* command_line = |
| + base::CommandLine::ForCurrentProcess(); |
| + return command_line->HasSwitch(switch_string) && |
| + command_line->GetSwitchValueASCII(switch_string) |
| + .compare(switches::kSwitchValueFalse) == 0; |
|
halliwell
2016/03/05 01:10:58
Also, just remembered: GetSwitchValueASCII returns
byungchul
2016/03/07 17:19:40
One benefit of these functions is consistency in c
|
| +} |
| + |
| +} // namespace base |