| Index: base/command_line.cc
|
| diff --git a/base/command_line.cc b/base/command_line.cc
|
| index 7050242e676c70b471705505c442588a43445b29..8161a895c6adaf388733ce583d59d4fb2bae2cb4 100644
|
| --- a/base/command_line.cc
|
| +++ b/base/command_line.cc
|
| @@ -363,6 +363,47 @@ void CommandLine::AppendSwitchASCII(const std::string& switch_string,
|
| #endif
|
| }
|
|
|
| +namespace {
|
| +
|
| +class DoesSwitchEqual {
|
| + public:
|
| + explicit DoesSwitchEqual(const CommandLine::StringType& switch_string)
|
| + : switch_string_(switch_string) {
|
| + }
|
| + bool operator()(const CommandLine::StringType& arg_string) const {
|
| + return
|
| + (arg_string.compare(0, switch_string_.length(), switch_string_) == 0);
|
| + }
|
| + private:
|
| + const CommandLine::StringType switch_string_;
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| +void CommandLine::RemoveSwitch(const std::string& switch_string) {
|
| + std::string switch_key(LowerASCIIOnWindows(switch_string));
|
| +#if defined(OS_WIN)
|
| + StringType combined_switch_string(ASCIIToWide(switch_key));
|
| +#elif defined(OS_POSIX)
|
| + StringType combined_switch_string(switch_string);
|
| +#endif
|
| + size_t prefix_length = GetSwitchPrefixLength(combined_switch_string);
|
| +
|
| + if (!HasSwitch(switch_key.substr(prefix_length)))
|
| + return;
|
| +
|
| + switches_.erase(switch_key.substr(prefix_length));
|
| +
|
| + if (prefix_length == 0)
|
| + combined_switch_string = kSwitchPrefixes[0] + combined_switch_string;
|
| + size_t previous_size = argv_.size();
|
| + argv_.erase(std::remove_if(argv_.begin(), argv_.end(),
|
| + DoesSwitchEqual(combined_switch_string)),
|
| + argv_.end());
|
| + DCHECK((argv_.size() + 1) == previous_size);
|
| + begin_args_--;
|
| +}
|
| +
|
| void CommandLine::CopySwitchesFrom(const CommandLine& source,
|
| const char* const switches[],
|
| size_t count) {
|
|
|