Chromium Code Reviews| Index: base/command_line.h |
| diff --git a/base/command_line.h b/base/command_line.h |
| index fd06e61c774ce0c13a2ef03817a5a8d7ee0561dc..6356732226e49784940ab6e8735df9484180f6e8 100644 |
| --- a/base/command_line.h |
| +++ b/base/command_line.h |
| @@ -97,12 +97,34 @@ class BASE_EXPORT CommandLine { |
| // Constructs and returns the represented command line string. |
| // CAUTION! This should be avoided on POSIX because quoting behavior is |
| // unclear. |
| - StringType GetCommandLineString() const; |
| + StringType GetCommandLineString() const { |
| + return GetCommandLineStringInternal(false); |
| + } |
| + |
| +#if defined(OS_WIN) |
| + // Constructs and returns the represented command line string. Assumes the |
| + // command line contains placeholders (eg, %1) and quotes any program or |
| + // argument with a '%' in it. |
|
Mark Mentovai
2014/09/25 13:14:15
The comment here and on the other method should sa
Matt Giuca
2014/09/26 03:49:05
Done.
|
| + StringType GetCommandLineStringWithPlaceholders() const { |
| + return GetCommandLineStringInternal(true); |
| + } |
| +#endif |
| // Constructs and returns the represented arguments string. |
| // CAUTION! This should be avoided on POSIX because quoting behavior is |
| // unclear. |
| - StringType GetArgumentsString() const; |
| + StringType GetArgumentsString() const { |
| + return GetArgumentsStringInternal(false); |
| + } |
| + |
| +#if defined(OS_WIN) |
| + // Constructs and returns the represented arguments string. Assumes the |
| + // command line contains placeholders (eg, %1) and quotes any argument with a |
| + // '%' in it. |
| + StringType GetArgumentsStringWithPlaceholders() const { |
| + return GetArgumentsStringInternal(true); |
| + } |
| +#endif |
| // Returns the original command line string as a vector of strings. |
| const StringVector& argv() const { return argv_; } |
| @@ -173,6 +195,14 @@ class BASE_EXPORT CommandLine { |
| // CommandLine cl(*CommandLine::ForCurrentProcess()); |
| // cl.AppendSwitch(...); |
| + // Internal version of GetCommandLineString. If |quote_placeholders| is true, |
| + // also quotes parts with '%' in them. |
| + StringType GetCommandLineStringInternal(bool quote_placeholders) const; |
| + |
| + // Internal version of GetArgumentsString. If |quote_placeholders| is true, |
| + // also quotes parts with '%' in them. |
| + StringType GetArgumentsStringInternal(bool quote_placeholders) const; |
| + |
| // The singleton CommandLine representing the current process's command line. |
| static CommandLine* current_process_commandline_; |