OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <ostream> | 8 #include <ostream> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 FilePath CommandLine::GetProgram() const { | 257 FilePath CommandLine::GetProgram() const { |
258 return FilePath(argv_[0]); | 258 return FilePath(argv_[0]); |
259 } | 259 } |
260 | 260 |
261 void CommandLine::SetProgram(const FilePath& program) { | 261 void CommandLine::SetProgram(const FilePath& program) { |
262 TrimWhitespace(program.value(), TRIM_ALL, &argv_[0]); | 262 TrimWhitespace(program.value(), TRIM_ALL, &argv_[0]); |
263 } | 263 } |
264 | 264 |
265 bool CommandLine::HasSwitch(const std::string& switch_string) const { | 265 bool CommandLine::HasSwitch(const std::string& switch_string) const { |
266 return switches_.find(LowerASCIIOnWindows(switch_string)) != switches_.end(); | 266 DCHECK_EQ(StringToLowerASCII(switch_string), switch_string); |
| 267 return switches_.find(switch_string) != switches_.end(); |
| 268 } |
| 269 |
| 270 bool CommandLine::HasSwitch(const char string_constant[]) const { |
| 271 return HasSwitch(std::string(string_constant)); |
267 } | 272 } |
268 | 273 |
269 std::string CommandLine::GetSwitchValueASCII( | 274 std::string CommandLine::GetSwitchValueASCII( |
270 const std::string& switch_string) const { | 275 const std::string& switch_string) const { |
271 StringType value = GetSwitchValueNative(switch_string); | 276 StringType value = GetSwitchValueNative(switch_string); |
272 if (!IsStringASCII(value)) { | 277 if (!IsStringASCII(value)) { |
273 DLOG(WARNING) << "Value of switch (" << switch_string << ") must be ASCII."; | 278 DLOG(WARNING) << "Value of switch (" << switch_string << ") must be ASCII."; |
274 return std::string(); | 279 return std::string(); |
275 } | 280 } |
276 #if defined(OS_WIN) | 281 #if defined(OS_WIN) |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 #if defined(OS_WIN) | 447 #if defined(OS_WIN) |
443 arg = QuoteForCommandLineToArgvW(arg, quote_placeholders); | 448 arg = QuoteForCommandLineToArgvW(arg, quote_placeholders); |
444 #endif | 449 #endif |
445 params.append(arg); | 450 params.append(arg); |
446 } | 451 } |
447 } | 452 } |
448 return params; | 453 return params; |
449 } | 454 } |
450 | 455 |
451 } // namespace base | 456 } // namespace base |
OLD | NEW |